blob: e7a34f233572b39848c17fc2b6dcfd77130e3e74 [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 Veillardd93f6252004-11-02 15:53:51 +00007941test_xmlDictCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00007942 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007943
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00007944 int mem_base;
7945 xmlDictPtr ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007946
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00007947 mem_base = xmlMemBlocks();
7948
7949 ret_val = xmlDictCreate();
7950 desret_xmlDictPtr(ret_val);
7951 call_tests++;
7952 xmlResetLastError();
7953 if (mem_base != xmlMemBlocks()) {
7954 printf("Leak of %d blocks found in xmlDictCreate",
7955 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00007956 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00007957 printf("\n");
7958 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00007959 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007960
Daniel Veillard42595322004-11-08 10:52:06 +00007961 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00007962}
7963
7964
7965static int
7966test_xmlDictCreateSub(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00007967 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007968
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00007969 int mem_base;
7970 xmlDictPtr ret_val;
7971 xmlDictPtr sub; /* an existing dictionnary */
7972 int n_sub;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007973
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00007974 for (n_sub = 0;n_sub < gen_nb_xmlDictPtr;n_sub++) {
7975 mem_base = xmlMemBlocks();
7976 sub = gen_xmlDictPtr(n_sub, 0);
7977
7978 ret_val = xmlDictCreateSub(sub);
7979 desret_xmlDictPtr(ret_val);
7980 call_tests++;
7981 des_xmlDictPtr(n_sub, sub, 0);
7982 xmlResetLastError();
7983 if (mem_base != xmlMemBlocks()) {
7984 printf("Leak of %d blocks found in xmlDictCreateSub",
7985 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00007986 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00007987 printf(" %d", n_sub);
7988 printf("\n");
7989 }
7990 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00007991 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007992
Daniel Veillard42595322004-11-08 10:52:06 +00007993 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00007994}
7995
7996
7997static int
Daniel Veillard91b955c2004-12-10 10:26:42 +00007998test_xmlDictExists(void) {
7999 int test_ret = 0;
8000
8001 int mem_base;
8002 const xmlChar * ret_val;
8003 xmlDictPtr dict; /* the dictionnary */
8004 int n_dict;
8005 xmlChar * name; /* the name of the userdata */
8006 int n_name;
8007 int len; /* the length of the name, if -1 it is recomputed */
8008 int n_len;
8009
8010 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8011 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
8012 for (n_len = 0;n_len < gen_nb_int;n_len++) {
8013 mem_base = xmlMemBlocks();
8014 dict = gen_xmlDictPtr(n_dict, 0);
8015 name = gen_const_xmlChar_ptr(n_name, 1);
8016 len = gen_int(n_len, 2);
8017
8018 ret_val = xmlDictExists(dict, (const xmlChar *)name, len);
8019 desret_const_xmlChar_ptr(ret_val);
8020 call_tests++;
8021 des_xmlDictPtr(n_dict, dict, 0);
8022 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
8023 des_int(n_len, len, 2);
8024 xmlResetLastError();
8025 if (mem_base != xmlMemBlocks()) {
8026 printf("Leak of %d blocks found in xmlDictExists",
8027 xmlMemBlocks() - mem_base);
8028 test_ret++;
8029 printf(" %d", n_dict);
8030 printf(" %d", n_name);
8031 printf(" %d", n_len);
8032 printf("\n");
8033 }
8034 }
8035 }
8036 }
8037 function_tests++;
8038
8039 return(test_ret);
8040}
8041
8042
8043static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00008044test_xmlDictLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008045 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008046
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008047 int mem_base;
8048 const xmlChar * ret_val;
8049 xmlDictPtr dict; /* the dictionnary */
8050 int n_dict;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008051 xmlChar * name; /* the name of the userdata */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008052 int n_name;
8053 int len; /* the length of the name, if -1 it is recomputed */
8054 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008055
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008056 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8057 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
8058 for (n_len = 0;n_len < gen_nb_int;n_len++) {
8059 mem_base = xmlMemBlocks();
8060 dict = gen_xmlDictPtr(n_dict, 0);
8061 name = gen_const_xmlChar_ptr(n_name, 1);
8062 len = gen_int(n_len, 2);
8063
William M. Brackf13f77f2004-11-12 16:03:48 +00008064 ret_val = xmlDictLookup(dict, (const xmlChar *)name, len);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008065 desret_const_xmlChar_ptr(ret_val);
8066 call_tests++;
8067 des_xmlDictPtr(n_dict, dict, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00008068 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008069 des_int(n_len, len, 2);
8070 xmlResetLastError();
8071 if (mem_base != xmlMemBlocks()) {
8072 printf("Leak of %d blocks found in xmlDictLookup",
8073 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008074 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008075 printf(" %d", n_dict);
8076 printf(" %d", n_name);
8077 printf(" %d", n_len);
8078 printf("\n");
8079 }
8080 }
8081 }
8082 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008083 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008084
Daniel Veillard42595322004-11-08 10:52:06 +00008085 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008086}
8087
8088
8089static int
8090test_xmlDictOwns(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008091 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008092
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008093 int mem_base;
8094 int ret_val;
8095 xmlDictPtr dict; /* the dictionnary */
8096 int n_dict;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008097 xmlChar * str; /* the string */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008098 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008099
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008100 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8101 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
8102 mem_base = xmlMemBlocks();
8103 dict = gen_xmlDictPtr(n_dict, 0);
8104 str = gen_const_xmlChar_ptr(n_str, 1);
8105
William M. Brackf13f77f2004-11-12 16:03:48 +00008106 ret_val = xmlDictOwns(dict, (const xmlChar *)str);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008107 desret_int(ret_val);
8108 call_tests++;
8109 des_xmlDictPtr(n_dict, dict, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00008110 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008111 xmlResetLastError();
8112 if (mem_base != xmlMemBlocks()) {
8113 printf("Leak of %d blocks found in xmlDictOwns",
8114 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008115 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008116 printf(" %d", n_dict);
8117 printf(" %d", n_str);
8118 printf("\n");
8119 }
8120 }
8121 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008122 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008123
Daniel Veillard42595322004-11-08 10:52:06 +00008124 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008125}
8126
8127
8128static int
8129test_xmlDictQLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008130 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008131
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008132 int mem_base;
8133 const xmlChar * ret_val;
8134 xmlDictPtr dict; /* the dictionnary */
8135 int n_dict;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008136 xmlChar * prefix; /* the prefix */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008137 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008138 xmlChar * name; /* the name */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008139 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008140
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008141 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8142 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
8143 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
8144 mem_base = xmlMemBlocks();
8145 dict = gen_xmlDictPtr(n_dict, 0);
8146 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
8147 name = gen_const_xmlChar_ptr(n_name, 2);
8148
William M. Brackf13f77f2004-11-12 16:03:48 +00008149 ret_val = xmlDictQLookup(dict, (const xmlChar *)prefix, (const xmlChar *)name);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008150 desret_const_xmlChar_ptr(ret_val);
8151 call_tests++;
8152 des_xmlDictPtr(n_dict, dict, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00008153 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
8154 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008155 xmlResetLastError();
8156 if (mem_base != xmlMemBlocks()) {
8157 printf("Leak of %d blocks found in xmlDictQLookup",
8158 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008159 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008160 printf(" %d", n_dict);
8161 printf(" %d", n_prefix);
8162 printf(" %d", n_name);
8163 printf("\n");
8164 }
8165 }
8166 }
8167 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008168 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008169
Daniel Veillard42595322004-11-08 10:52:06 +00008170 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008171}
8172
8173
8174static int
8175test_xmlDictReference(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008176 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008177
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008178 int mem_base;
8179 int ret_val;
8180 xmlDictPtr dict; /* the dictionnary */
8181 int n_dict;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008182
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008183 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8184 mem_base = xmlMemBlocks();
8185 dict = gen_xmlDictPtr(n_dict, 0);
8186
8187 ret_val = xmlDictReference(dict);
8188 xmlDictFree(dict);
8189 desret_int(ret_val);
8190 call_tests++;
8191 des_xmlDictPtr(n_dict, dict, 0);
8192 xmlResetLastError();
8193 if (mem_base != xmlMemBlocks()) {
8194 printf("Leak of %d blocks found in xmlDictReference",
8195 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008196 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008197 printf(" %d", n_dict);
8198 printf("\n");
8199 }
8200 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008201 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008202
Daniel Veillard42595322004-11-08 10:52:06 +00008203 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008204}
8205
8206
8207static int
8208test_xmlDictSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008209 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008210
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008211 int mem_base;
8212 int ret_val;
8213 xmlDictPtr dict; /* the dictionnary */
8214 int n_dict;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008215
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008216 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8217 mem_base = xmlMemBlocks();
8218 dict = gen_xmlDictPtr(n_dict, 0);
8219
8220 ret_val = xmlDictSize(dict);
8221 desret_int(ret_val);
8222 call_tests++;
8223 des_xmlDictPtr(n_dict, dict, 0);
8224 xmlResetLastError();
8225 if (mem_base != xmlMemBlocks()) {
8226 printf("Leak of %d blocks found in xmlDictSize",
8227 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008228 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008229 printf(" %d", n_dict);
8230 printf("\n");
8231 }
8232 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008233 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008234
Daniel Veillard42595322004-11-08 10:52:06 +00008235 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008236}
8237
8238static int
8239test_dict(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008240 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008241
Daniel Veillard91b955c2004-12-10 10:26:42 +00008242 if (quiet == 0) printf("Testing dict : 8 of 9 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00008243 test_ret += test_xmlDictCreate();
8244 test_ret += test_xmlDictCreateSub();
Daniel Veillard91b955c2004-12-10 10:26:42 +00008245 test_ret += test_xmlDictExists();
Daniel Veillard42595322004-11-08 10:52:06 +00008246 test_ret += test_xmlDictLookup();
8247 test_ret += test_xmlDictOwns();
8248 test_ret += test_xmlDictQLookup();
8249 test_ret += test_xmlDictReference();
8250 test_ret += test_xmlDictSize();
Daniel Veillardd93f6252004-11-02 15:53:51 +00008251
Daniel Veillard42595322004-11-08 10:52:06 +00008252 if (test_ret != 0)
8253 printf("Module dict: %d errors\n", test_ret);
8254 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008255}
8256
8257static int
8258test_UTF8Toisolat1(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008259 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008260
William M. Brack21e4ef22005-01-02 09:53:13 +00008261#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00008262#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +00008263 int mem_base;
8264 int ret_val;
8265 unsigned char * out; /* a pointer to an array of bytes to store the result */
8266 int n_out;
8267 int * outlen; /* the length of @out */
8268 int n_outlen;
8269 unsigned char * in; /* a pointer to an array of UTF-8 chars */
8270 int n_in;
8271 int * inlen; /* the length of @in */
8272 int n_inlen;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008273
Daniel Veillardce682bc2004-11-05 17:22:25 +00008274 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
8275 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
8276 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
8277 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
8278 mem_base = xmlMemBlocks();
8279 out = gen_unsigned_char_ptr(n_out, 0);
8280 outlen = gen_int_ptr(n_outlen, 1);
8281 in = gen_const_unsigned_char_ptr(n_in, 2);
8282 inlen = gen_int_ptr(n_inlen, 3);
8283
William M. Brackf13f77f2004-11-12 16:03:48 +00008284 ret_val = UTF8Toisolat1(out, outlen, (const unsigned char *)in, inlen);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008285 desret_int(ret_val);
8286 call_tests++;
8287 des_unsigned_char_ptr(n_out, out, 0);
8288 des_int_ptr(n_outlen, outlen, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00008289 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008290 des_int_ptr(n_inlen, inlen, 3);
8291 xmlResetLastError();
8292 if (mem_base != xmlMemBlocks()) {
8293 printf("Leak of %d blocks found in UTF8Toisolat1",
8294 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008295 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008296 printf(" %d", n_out);
8297 printf(" %d", n_outlen);
8298 printf(" %d", n_in);
8299 printf(" %d", n_inlen);
8300 printf("\n");
8301 }
8302 }
8303 }
8304 }
8305 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008306 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00008307#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00008308#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +00008309
Daniel Veillard42595322004-11-08 10:52:06 +00008310 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008311}
8312
8313
8314static int
8315test_isolat1ToUTF8(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008316 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008317
Daniel Veillardce682bc2004-11-05 17:22:25 +00008318 int mem_base;
8319 int ret_val;
8320 unsigned char * out; /* a pointer to an array of bytes to store the result */
8321 int n_out;
8322 int * outlen; /* the length of @out */
8323 int n_outlen;
8324 unsigned char * in; /* a pointer to an array of ISO Latin 1 chars */
8325 int n_in;
8326 int * inlen; /* the length of @in */
8327 int n_inlen;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008328
Daniel Veillardce682bc2004-11-05 17:22:25 +00008329 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
8330 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
8331 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
8332 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
8333 mem_base = xmlMemBlocks();
8334 out = gen_unsigned_char_ptr(n_out, 0);
8335 outlen = gen_int_ptr(n_outlen, 1);
8336 in = gen_const_unsigned_char_ptr(n_in, 2);
8337 inlen = gen_int_ptr(n_inlen, 3);
8338
William M. Brackf13f77f2004-11-12 16:03:48 +00008339 ret_val = isolat1ToUTF8(out, outlen, (const unsigned char *)in, inlen);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008340 desret_int(ret_val);
8341 call_tests++;
8342 des_unsigned_char_ptr(n_out, out, 0);
8343 des_int_ptr(n_outlen, outlen, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00008344 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008345 des_int_ptr(n_inlen, inlen, 3);
8346 xmlResetLastError();
8347 if (mem_base != xmlMemBlocks()) {
8348 printf("Leak of %d blocks found in isolat1ToUTF8",
8349 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008350 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008351 printf(" %d", n_out);
8352 printf(" %d", n_outlen);
8353 printf(" %d", n_in);
8354 printf(" %d", n_inlen);
8355 printf("\n");
8356 }
8357 }
8358 }
8359 }
8360 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008361 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008362
Daniel Veillard42595322004-11-08 10:52:06 +00008363 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008364}
8365
8366
8367static int
8368test_xmlAddEncodingAlias(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008369 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008370
8371 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008372 char * name; /* the encoding name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00008373 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008374 char * alias; /* the alias name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00008375 int n_alias;
8376
8377 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
8378 for (n_alias = 0;n_alias < gen_nb_const_char_ptr;n_alias++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00008379 name = gen_const_char_ptr(n_name, 0);
8380 alias = gen_const_char_ptr(n_alias, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008381
William M. Brackf13f77f2004-11-12 16:03:48 +00008382 ret_val = xmlAddEncodingAlias((const char *)name, (const char *)alias);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008383 desret_int(ret_val);
8384 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00008385 des_const_char_ptr(n_name, (const char *)name, 0);
8386 des_const_char_ptr(n_alias, (const char *)alias, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008387 xmlResetLastError();
8388 }
8389 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008390 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008391
Daniel Veillard42595322004-11-08 10:52:06 +00008392 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008393}
8394
8395
Daniel Veillardce682bc2004-11-05 17:22:25 +00008396#define gen_nb_xmlCharEncodingHandler_ptr 1
8397static xmlCharEncodingHandler * gen_xmlCharEncodingHandler_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
8398 return(NULL);
8399}
8400static void des_xmlCharEncodingHandler_ptr(int no ATTRIBUTE_UNUSED, xmlCharEncodingHandler * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
8401}
8402
Daniel Veillardd93f6252004-11-02 15:53:51 +00008403static int
8404test_xmlCharEncCloseFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008405 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008406
Daniel Veillardce682bc2004-11-05 17:22:25 +00008407 int mem_base;
8408 int ret_val;
8409 xmlCharEncodingHandler * handler; /* char enconding transformation data structure */
8410 int n_handler;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008411
Daniel Veillardce682bc2004-11-05 17:22:25 +00008412 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8413 mem_base = xmlMemBlocks();
8414 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8415
8416 ret_val = xmlCharEncCloseFunc(handler);
8417 desret_int(ret_val);
8418 call_tests++;
8419 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8420 xmlResetLastError();
8421 if (mem_base != xmlMemBlocks()) {
8422 printf("Leak of %d blocks found in xmlCharEncCloseFunc",
8423 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008424 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008425 printf(" %d", n_handler);
8426 printf("\n");
8427 }
8428 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008429 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008430
Daniel Veillard42595322004-11-08 10:52:06 +00008431 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008432}
8433
8434
8435static int
8436test_xmlCharEncFirstLine(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008437 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008438
Daniel Veillardce682bc2004-11-05 17:22:25 +00008439 int mem_base;
8440 int ret_val;
8441 xmlCharEncodingHandler * handler; /* char enconding transformation data structure */
8442 int n_handler;
8443 xmlBufferPtr out; /* an xmlBuffer for the output. */
8444 int n_out;
8445 xmlBufferPtr in; /* an xmlBuffer for the input */
8446 int n_in;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008447
Daniel Veillardce682bc2004-11-05 17:22:25 +00008448 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8449 for (n_out = 0;n_out < gen_nb_xmlBufferPtr;n_out++) {
8450 for (n_in = 0;n_in < gen_nb_xmlBufferPtr;n_in++) {
8451 mem_base = xmlMemBlocks();
8452 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8453 out = gen_xmlBufferPtr(n_out, 1);
8454 in = gen_xmlBufferPtr(n_in, 2);
8455
8456 ret_val = xmlCharEncFirstLine(handler, out, in);
8457 desret_int(ret_val);
8458 call_tests++;
8459 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8460 des_xmlBufferPtr(n_out, out, 1);
8461 des_xmlBufferPtr(n_in, in, 2);
8462 xmlResetLastError();
8463 if (mem_base != xmlMemBlocks()) {
8464 printf("Leak of %d blocks found in xmlCharEncFirstLine",
8465 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008466 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008467 printf(" %d", n_handler);
8468 printf(" %d", n_out);
8469 printf(" %d", n_in);
8470 printf("\n");
8471 }
8472 }
8473 }
8474 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008475 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008476
Daniel Veillard42595322004-11-08 10:52:06 +00008477 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008478}
8479
8480
8481static int
8482test_xmlCharEncInFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008483 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008484
Daniel Veillardce682bc2004-11-05 17:22:25 +00008485 int mem_base;
8486 int ret_val;
8487 xmlCharEncodingHandler * handler; /* char encoding transformation data structure */
8488 int n_handler;
8489 xmlBufferPtr out; /* an xmlBuffer for the output. */
8490 int n_out;
8491 xmlBufferPtr in; /* an xmlBuffer for the input */
8492 int n_in;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008493
Daniel Veillardce682bc2004-11-05 17:22:25 +00008494 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8495 for (n_out = 0;n_out < gen_nb_xmlBufferPtr;n_out++) {
8496 for (n_in = 0;n_in < gen_nb_xmlBufferPtr;n_in++) {
8497 mem_base = xmlMemBlocks();
8498 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8499 out = gen_xmlBufferPtr(n_out, 1);
8500 in = gen_xmlBufferPtr(n_in, 2);
8501
8502 ret_val = xmlCharEncInFunc(handler, out, in);
8503 desret_int(ret_val);
8504 call_tests++;
8505 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8506 des_xmlBufferPtr(n_out, out, 1);
8507 des_xmlBufferPtr(n_in, in, 2);
8508 xmlResetLastError();
8509 if (mem_base != xmlMemBlocks()) {
8510 printf("Leak of %d blocks found in xmlCharEncInFunc",
8511 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008512 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008513 printf(" %d", n_handler);
8514 printf(" %d", n_out);
8515 printf(" %d", n_in);
8516 printf("\n");
8517 }
8518 }
8519 }
8520 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008521 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008522
Daniel Veillard42595322004-11-08 10:52:06 +00008523 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008524}
8525
8526
8527static int
8528test_xmlCharEncOutFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008529 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008530
Daniel Veillardce682bc2004-11-05 17:22:25 +00008531 int mem_base;
8532 int ret_val;
8533 xmlCharEncodingHandler * handler; /* char enconding transformation data structure */
8534 int n_handler;
8535 xmlBufferPtr out; /* an xmlBuffer for the output. */
8536 int n_out;
8537 xmlBufferPtr in; /* an xmlBuffer for the input */
8538 int n_in;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008539
Daniel Veillardce682bc2004-11-05 17:22:25 +00008540 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8541 for (n_out = 0;n_out < gen_nb_xmlBufferPtr;n_out++) {
8542 for (n_in = 0;n_in < gen_nb_xmlBufferPtr;n_in++) {
8543 mem_base = xmlMemBlocks();
8544 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8545 out = gen_xmlBufferPtr(n_out, 1);
8546 in = gen_xmlBufferPtr(n_in, 2);
8547
8548 ret_val = xmlCharEncOutFunc(handler, out, in);
8549 desret_int(ret_val);
8550 call_tests++;
8551 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8552 des_xmlBufferPtr(n_out, out, 1);
8553 des_xmlBufferPtr(n_in, in, 2);
8554 xmlResetLastError();
8555 if (mem_base != xmlMemBlocks()) {
8556 printf("Leak of %d blocks found in xmlCharEncOutFunc",
8557 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008558 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008559 printf(" %d", n_handler);
8560 printf(" %d", n_out);
8561 printf(" %d", n_in);
8562 printf("\n");
8563 }
8564 }
8565 }
8566 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008567 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008568
Daniel Veillard42595322004-11-08 10:52:06 +00008569 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008570}
8571
8572
8573static int
8574test_xmlCleanupCharEncodingHandlers(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008575 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008576
8577
8578
8579 xmlCleanupCharEncodingHandlers();
8580 call_tests++;
8581 xmlResetLastError();
Daniel Veillard3d97e662004-11-04 10:49:00 +00008582 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008583
Daniel Veillard42595322004-11-08 10:52:06 +00008584 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008585}
8586
8587
8588static int
8589test_xmlCleanupEncodingAliases(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008590 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008591
8592 int mem_base;
8593
8594 mem_base = xmlMemBlocks();
8595
8596 xmlCleanupEncodingAliases();
8597 call_tests++;
8598 xmlResetLastError();
8599 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00008600 printf("Leak of %d blocks found in xmlCleanupEncodingAliases",
Daniel Veillardd93f6252004-11-02 15:53:51 +00008601 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008602 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00008603 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00008604 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008605 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008606
Daniel Veillard42595322004-11-08 10:52:06 +00008607 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008608}
8609
8610
8611static int
8612test_xmlDelEncodingAlias(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008613 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008614
8615 int mem_base;
8616 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008617 char * alias; /* the alias name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00008618 int n_alias;
8619
8620 for (n_alias = 0;n_alias < gen_nb_const_char_ptr;n_alias++) {
8621 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00008622 alias = gen_const_char_ptr(n_alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008623
William M. Brackf13f77f2004-11-12 16:03:48 +00008624 ret_val = xmlDelEncodingAlias((const char *)alias);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008625 desret_int(ret_val);
8626 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00008627 des_const_char_ptr(n_alias, (const char *)alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008628 xmlResetLastError();
8629 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00008630 printf("Leak of %d blocks found in xmlDelEncodingAlias",
Daniel Veillardd93f6252004-11-02 15:53:51 +00008631 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008632 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00008633 printf(" %d", n_alias);
8634 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00008635 }
8636 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008637 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008638
Daniel Veillard42595322004-11-08 10:52:06 +00008639 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008640}
8641
8642
8643static int
8644test_xmlDetectCharEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008645 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008646
Daniel Veillardce682bc2004-11-05 17:22:25 +00008647 int mem_base;
8648 xmlCharEncoding ret_val;
8649 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). */
8650 int n_in;
8651 int len; /* pointer to the length of the buffer */
8652 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008653
Daniel Veillardce682bc2004-11-05 17:22:25 +00008654 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
8655 for (n_len = 0;n_len < gen_nb_int;n_len++) {
8656 mem_base = xmlMemBlocks();
8657 in = gen_const_unsigned_char_ptr(n_in, 0);
8658 len = gen_int(n_len, 1);
8659
William M. Brackf13f77f2004-11-12 16:03:48 +00008660 ret_val = xmlDetectCharEncoding((const unsigned char *)in, len);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008661 desret_xmlCharEncoding(ret_val);
8662 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00008663 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008664 des_int(n_len, len, 1);
8665 xmlResetLastError();
8666 if (mem_base != xmlMemBlocks()) {
8667 printf("Leak of %d blocks found in xmlDetectCharEncoding",
8668 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008669 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008670 printf(" %d", n_in);
8671 printf(" %d", n_len);
8672 printf("\n");
8673 }
8674 }
8675 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008676 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008677
Daniel Veillard42595322004-11-08 10:52:06 +00008678 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008679}
8680
8681
8682static int
8683test_xmlFindCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008684 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008685
8686
8687 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00008688 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008689}
8690
8691
8692static int
8693test_xmlGetCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008694 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008695
8696
8697 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00008698 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008699}
8700
8701
8702static int
8703test_xmlGetCharEncodingName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008704 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008705
Daniel Veillard3d97e662004-11-04 10:49:00 +00008706 int mem_base;
8707 const char * ret_val;
8708 xmlCharEncoding enc; /* the encoding */
8709 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008710
Daniel Veillard3d97e662004-11-04 10:49:00 +00008711 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
8712 mem_base = xmlMemBlocks();
8713 enc = gen_xmlCharEncoding(n_enc, 0);
8714
8715 ret_val = xmlGetCharEncodingName(enc);
8716 desret_const_char_ptr(ret_val);
8717 call_tests++;
8718 des_xmlCharEncoding(n_enc, enc, 0);
8719 xmlResetLastError();
8720 if (mem_base != xmlMemBlocks()) {
8721 printf("Leak of %d blocks found in xmlGetCharEncodingName",
8722 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008723 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00008724 printf(" %d", n_enc);
8725 printf("\n");
8726 }
8727 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008728 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008729
Daniel Veillard42595322004-11-08 10:52:06 +00008730 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008731}
8732
8733
8734static int
8735test_xmlGetEncodingAlias(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008736 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008737
8738 int mem_base;
8739 const char * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008740 char * alias; /* the alias name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00008741 int n_alias;
8742
8743 for (n_alias = 0;n_alias < gen_nb_const_char_ptr;n_alias++) {
8744 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00008745 alias = gen_const_char_ptr(n_alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008746
William M. Brackf13f77f2004-11-12 16:03:48 +00008747 ret_val = xmlGetEncodingAlias((const char *)alias);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008748 desret_const_char_ptr(ret_val);
8749 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00008750 des_const_char_ptr(n_alias, (const char *)alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008751 xmlResetLastError();
8752 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00008753 printf("Leak of %d blocks found in xmlGetEncodingAlias",
Daniel Veillardd93f6252004-11-02 15:53:51 +00008754 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008755 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00008756 printf(" %d", n_alias);
8757 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00008758 }
8759 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008760 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008761
Daniel Veillard42595322004-11-08 10:52:06 +00008762 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008763}
8764
8765
8766static int
8767test_xmlInitCharEncodingHandlers(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008768 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008769
8770
8771
8772 xmlInitCharEncodingHandlers();
8773 call_tests++;
8774 xmlResetLastError();
Daniel Veillard3d97e662004-11-04 10:49:00 +00008775 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008776
Daniel Veillard42595322004-11-08 10:52:06 +00008777 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008778}
8779
8780
8781static int
8782test_xmlNewCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008783 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008784
8785
8786 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00008787 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008788}
8789
8790
8791static int
8792test_xmlParseCharEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008793 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008794
Daniel Veillard3d97e662004-11-04 10:49:00 +00008795 int mem_base;
8796 xmlCharEncoding ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008797 char * name; /* the encoding name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillard3d97e662004-11-04 10:49:00 +00008798 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008799
Daniel Veillard3d97e662004-11-04 10:49:00 +00008800 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
8801 mem_base = xmlMemBlocks();
8802 name = gen_const_char_ptr(n_name, 0);
8803
William M. Brackf13f77f2004-11-12 16:03:48 +00008804 ret_val = xmlParseCharEncoding((const char *)name);
Daniel Veillard3d97e662004-11-04 10:49:00 +00008805 desret_xmlCharEncoding(ret_val);
8806 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00008807 des_const_char_ptr(n_name, (const char *)name, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00008808 xmlResetLastError();
8809 if (mem_base != xmlMemBlocks()) {
8810 printf("Leak of %d blocks found in xmlParseCharEncoding",
8811 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008812 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00008813 printf(" %d", n_name);
8814 printf("\n");
8815 }
8816 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008817 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008818
Daniel Veillard42595322004-11-08 10:52:06 +00008819 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008820}
8821
8822
Daniel Veillardce682bc2004-11-05 17:22:25 +00008823#define gen_nb_xmlCharEncodingHandlerPtr 1
8824static xmlCharEncodingHandlerPtr gen_xmlCharEncodingHandlerPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
8825 return(NULL);
8826}
8827static void des_xmlCharEncodingHandlerPtr(int no ATTRIBUTE_UNUSED, xmlCharEncodingHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
8828}
8829
Daniel Veillardd93f6252004-11-02 15:53:51 +00008830static int
8831test_xmlRegisterCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008832 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008833
Daniel Veillardce682bc2004-11-05 17:22:25 +00008834 int mem_base;
8835 xmlCharEncodingHandlerPtr handler; /* the xmlCharEncodingHandlerPtr handler block */
8836 int n_handler;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008837
Daniel Veillardce682bc2004-11-05 17:22:25 +00008838 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandlerPtr;n_handler++) {
8839 mem_base = xmlMemBlocks();
8840 handler = gen_xmlCharEncodingHandlerPtr(n_handler, 0);
8841
8842 xmlRegisterCharEncodingHandler(handler);
8843 call_tests++;
8844 des_xmlCharEncodingHandlerPtr(n_handler, handler, 0);
8845 xmlResetLastError();
8846 if (mem_base != xmlMemBlocks()) {
8847 printf("Leak of %d blocks found in xmlRegisterCharEncodingHandler",
8848 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008849 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008850 printf(" %d", n_handler);
8851 printf("\n");
8852 }
8853 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008854 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008855
Daniel Veillard42595322004-11-08 10:52:06 +00008856 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008857}
8858
8859static int
8860test_encoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008861 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008862
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008863 if (quiet == 0) printf("Testing encoding : 16 of 19 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00008864 test_ret += test_UTF8Toisolat1();
8865 test_ret += test_isolat1ToUTF8();
8866 test_ret += test_xmlAddEncodingAlias();
8867 test_ret += test_xmlCharEncCloseFunc();
8868 test_ret += test_xmlCharEncFirstLine();
8869 test_ret += test_xmlCharEncInFunc();
8870 test_ret += test_xmlCharEncOutFunc();
8871 test_ret += test_xmlCleanupCharEncodingHandlers();
8872 test_ret += test_xmlCleanupEncodingAliases();
8873 test_ret += test_xmlDelEncodingAlias();
8874 test_ret += test_xmlDetectCharEncoding();
8875 test_ret += test_xmlFindCharEncodingHandler();
8876 test_ret += test_xmlGetCharEncodingHandler();
8877 test_ret += test_xmlGetCharEncodingName();
8878 test_ret += test_xmlGetEncodingAlias();
8879 test_ret += test_xmlInitCharEncodingHandlers();
8880 test_ret += test_xmlNewCharEncodingHandler();
8881 test_ret += test_xmlParseCharEncoding();
8882 test_ret += test_xmlRegisterCharEncodingHandler();
Daniel Veillardd93f6252004-11-02 15:53:51 +00008883
Daniel Veillard42595322004-11-08 10:52:06 +00008884 if (test_ret != 0)
8885 printf("Module encoding: %d errors\n", test_ret);
8886 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008887}
8888
8889static int
8890test_xmlAddDocEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008891 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008892
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008893 int mem_base;
8894 xmlEntityPtr ret_val;
8895 xmlDocPtr doc; /* the document */
8896 int n_doc;
8897 xmlChar * name; /* the entity name */
8898 int n_name;
8899 int type; /* the entity type XML_xxx_yyy_ENTITY */
8900 int n_type;
8901 xmlChar * ExternalID; /* the entity external ID if available */
8902 int n_ExternalID;
8903 xmlChar * SystemID; /* the entity system ID if available */
8904 int n_SystemID;
8905 xmlChar * content; /* the entity content */
8906 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008907
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008908 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
8909 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
8910 for (n_type = 0;n_type < gen_nb_int;n_type++) {
8911 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
8912 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
8913 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
8914 mem_base = xmlMemBlocks();
8915 doc = gen_xmlDocPtr(n_doc, 0);
8916 name = gen_const_xmlChar_ptr(n_name, 1);
8917 type = gen_int(n_type, 2);
8918 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 3);
8919 SystemID = gen_const_xmlChar_ptr(n_SystemID, 4);
8920 content = gen_const_xmlChar_ptr(n_content, 5);
8921
William M. Brackf13f77f2004-11-12 16:03:48 +00008922 ret_val = xmlAddDocEntity(doc, (const xmlChar *)name, type, (const xmlChar *)ExternalID, (const xmlChar *)SystemID, (const xmlChar *)content);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008923 desret_xmlEntityPtr(ret_val);
8924 call_tests++;
8925 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00008926 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008927 des_int(n_type, type, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00008928 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 3);
8929 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 4);
8930 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 5);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008931 xmlResetLastError();
8932 if (mem_base != xmlMemBlocks()) {
8933 printf("Leak of %d blocks found in xmlAddDocEntity",
8934 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008935 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008936 printf(" %d", n_doc);
8937 printf(" %d", n_name);
8938 printf(" %d", n_type);
8939 printf(" %d", n_ExternalID);
8940 printf(" %d", n_SystemID);
8941 printf(" %d", n_content);
8942 printf("\n");
8943 }
8944 }
8945 }
8946 }
8947 }
8948 }
8949 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008950 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008951
Daniel Veillard42595322004-11-08 10:52:06 +00008952 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008953}
8954
8955
8956static int
8957test_xmlAddDtdEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008958 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008959
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008960 int mem_base;
8961 xmlEntityPtr ret_val;
8962 xmlDocPtr doc; /* the document */
8963 int n_doc;
8964 xmlChar * name; /* the entity name */
8965 int n_name;
8966 int type; /* the entity type XML_xxx_yyy_ENTITY */
8967 int n_type;
8968 xmlChar * ExternalID; /* the entity external ID if available */
8969 int n_ExternalID;
8970 xmlChar * SystemID; /* the entity system ID if available */
8971 int n_SystemID;
8972 xmlChar * content; /* the entity content */
8973 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008974
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008975 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
8976 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
8977 for (n_type = 0;n_type < gen_nb_int;n_type++) {
8978 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
8979 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
8980 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
8981 mem_base = xmlMemBlocks();
8982 doc = gen_xmlDocPtr(n_doc, 0);
8983 name = gen_const_xmlChar_ptr(n_name, 1);
8984 type = gen_int(n_type, 2);
8985 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 3);
8986 SystemID = gen_const_xmlChar_ptr(n_SystemID, 4);
8987 content = gen_const_xmlChar_ptr(n_content, 5);
8988
William M. Brackf13f77f2004-11-12 16:03:48 +00008989 ret_val = xmlAddDtdEntity(doc, (const xmlChar *)name, type, (const xmlChar *)ExternalID, (const xmlChar *)SystemID, (const xmlChar *)content);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008990 desret_xmlEntityPtr(ret_val);
8991 call_tests++;
8992 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00008993 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008994 des_int(n_type, type, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00008995 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 3);
8996 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 4);
8997 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 5);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008998 xmlResetLastError();
8999 if (mem_base != xmlMemBlocks()) {
9000 printf("Leak of %d blocks found in xmlAddDtdEntity",
9001 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009002 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009003 printf(" %d", n_doc);
9004 printf(" %d", n_name);
9005 printf(" %d", n_type);
9006 printf(" %d", n_ExternalID);
9007 printf(" %d", n_SystemID);
9008 printf(" %d", n_content);
9009 printf("\n");
9010 }
9011 }
9012 }
9013 }
9014 }
9015 }
9016 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009017 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009018
Daniel Veillard42595322004-11-08 10:52:06 +00009019 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009020}
9021
9022
9023static int
9024test_xmlCleanupPredefinedEntities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009025 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009026
William M. Brack21e4ef22005-01-02 09:53:13 +00009027#if defined(LIBXML_LEGACY_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00009028#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +00009029 int mem_base;
9030
9031 mem_base = xmlMemBlocks();
9032
9033 xmlCleanupPredefinedEntities();
9034 call_tests++;
9035 xmlResetLastError();
9036 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00009037 printf("Leak of %d blocks found in xmlCleanupPredefinedEntities",
Daniel Veillardd93f6252004-11-02 15:53:51 +00009038 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009039 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00009040 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00009041 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009042 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00009043#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00009044#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00009045
Daniel Veillard42595322004-11-08 10:52:06 +00009046 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009047}
9048
9049
Daniel Veillardce682bc2004-11-05 17:22:25 +00009050#define gen_nb_xmlEntitiesTablePtr 1
9051static xmlEntitiesTablePtr gen_xmlEntitiesTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9052 return(NULL);
9053}
9054static void des_xmlEntitiesTablePtr(int no ATTRIBUTE_UNUSED, xmlEntitiesTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9055}
9056
Daniel Veillardd93f6252004-11-02 15:53:51 +00009057static int
9058test_xmlCopyEntitiesTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009059 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009060
9061
9062 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009063 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009064}
9065
9066
9067static int
9068test_xmlCreateEntitiesTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009069 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009070
9071
9072 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009073 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009074}
9075
9076
9077static int
9078test_xmlDumpEntitiesTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009079 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009080
William M. Brack21e4ef22005-01-02 09:53:13 +00009081#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00009082 int mem_base;
9083 xmlBufferPtr buf; /* An XML buffer. */
9084 int n_buf;
9085 xmlEntitiesTablePtr table; /* An entity table */
9086 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009087
Daniel Veillardce682bc2004-11-05 17:22:25 +00009088 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
9089 for (n_table = 0;n_table < gen_nb_xmlEntitiesTablePtr;n_table++) {
9090 mem_base = xmlMemBlocks();
9091 buf = gen_xmlBufferPtr(n_buf, 0);
9092 table = gen_xmlEntitiesTablePtr(n_table, 1);
9093
9094 xmlDumpEntitiesTable(buf, table);
9095 call_tests++;
9096 des_xmlBufferPtr(n_buf, buf, 0);
9097 des_xmlEntitiesTablePtr(n_table, table, 1);
9098 xmlResetLastError();
9099 if (mem_base != xmlMemBlocks()) {
9100 printf("Leak of %d blocks found in xmlDumpEntitiesTable",
9101 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009102 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009103 printf(" %d", n_buf);
9104 printf(" %d", n_table);
9105 printf("\n");
9106 }
9107 }
9108 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009109 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009110#endif
9111
Daniel Veillard42595322004-11-08 10:52:06 +00009112 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009113}
9114
9115
Daniel Veillardce682bc2004-11-05 17:22:25 +00009116#define gen_nb_xmlEntityPtr 1
9117static xmlEntityPtr gen_xmlEntityPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9118 return(NULL);
9119}
9120static void des_xmlEntityPtr(int no ATTRIBUTE_UNUSED, xmlEntityPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9121}
9122
Daniel Veillardd93f6252004-11-02 15:53:51 +00009123static int
9124test_xmlDumpEntityDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009125 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009126
William M. Brack21e4ef22005-01-02 09:53:13 +00009127#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00009128 int mem_base;
9129 xmlBufferPtr buf; /* An XML buffer. */
9130 int n_buf;
9131 xmlEntityPtr ent; /* An entity table */
9132 int n_ent;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009133
Daniel Veillardce682bc2004-11-05 17:22:25 +00009134 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
9135 for (n_ent = 0;n_ent < gen_nb_xmlEntityPtr;n_ent++) {
9136 mem_base = xmlMemBlocks();
9137 buf = gen_xmlBufferPtr(n_buf, 0);
9138 ent = gen_xmlEntityPtr(n_ent, 1);
9139
9140 xmlDumpEntityDecl(buf, ent);
9141 call_tests++;
9142 des_xmlBufferPtr(n_buf, buf, 0);
9143 des_xmlEntityPtr(n_ent, ent, 1);
9144 xmlResetLastError();
9145 if (mem_base != xmlMemBlocks()) {
9146 printf("Leak of %d blocks found in xmlDumpEntityDecl",
9147 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009148 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009149 printf(" %d", n_buf);
9150 printf(" %d", n_ent);
9151 printf("\n");
9152 }
9153 }
9154 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009155 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009156#endif
9157
Daniel Veillard42595322004-11-08 10:52:06 +00009158 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009159}
9160
9161
9162static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00009163test_xmlEncodeEntitiesReentrant(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009164 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009165
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009166 int mem_base;
9167 xmlChar * ret_val;
9168 xmlDocPtr doc; /* the document containing the string */
9169 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009170 xmlChar * input; /* A string to convert to XML. */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009171 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009172
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009173 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9174 for (n_input = 0;n_input < gen_nb_const_xmlChar_ptr;n_input++) {
9175 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009176 doc = gen_xmlDocPtr(n_doc, 0);
9177 input = gen_const_xmlChar_ptr(n_input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009178
William M. Brackf13f77f2004-11-12 16:03:48 +00009179 ret_val = xmlEncodeEntitiesReentrant(doc, (const xmlChar *)input);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009180 desret_xmlChar_ptr(ret_val);
9181 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009182 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009183 des_const_xmlChar_ptr(n_input, (const xmlChar *)input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009184 xmlResetLastError();
9185 if (mem_base != xmlMemBlocks()) {
9186 printf("Leak of %d blocks found in xmlEncodeEntitiesReentrant",
9187 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009188 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009189 printf(" %d", n_doc);
9190 printf(" %d", n_input);
9191 printf("\n");
9192 }
9193 }
9194 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009195 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009196
Daniel Veillard42595322004-11-08 10:52:06 +00009197 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009198}
9199
9200
9201static int
9202test_xmlEncodeSpecialChars(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009203 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009204
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009205 int mem_base;
9206 xmlChar * ret_val;
9207 xmlDocPtr doc; /* the document containing the string */
9208 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009209 xmlChar * input; /* A string to convert to XML. */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009210 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009211
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009212 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9213 for (n_input = 0;n_input < gen_nb_const_xmlChar_ptr;n_input++) {
9214 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009215 doc = gen_xmlDocPtr(n_doc, 0);
9216 input = gen_const_xmlChar_ptr(n_input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009217
William M. Brackf13f77f2004-11-12 16:03:48 +00009218 ret_val = xmlEncodeSpecialChars(doc, (const xmlChar *)input);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009219 desret_xmlChar_ptr(ret_val);
9220 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009221 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009222 des_const_xmlChar_ptr(n_input, (const xmlChar *)input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009223 xmlResetLastError();
9224 if (mem_base != xmlMemBlocks()) {
9225 printf("Leak of %d blocks found in xmlEncodeSpecialChars",
9226 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009227 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009228 printf(" %d", n_doc);
9229 printf(" %d", n_input);
9230 printf("\n");
9231 }
9232 }
9233 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009234 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009235
Daniel Veillard42595322004-11-08 10:52:06 +00009236 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009237}
9238
9239
9240static int
9241test_xmlGetDocEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009242 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009243
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009244 int mem_base;
9245 xmlEntityPtr ret_val;
9246 xmlDocPtr doc; /* the document referencing the entity */
9247 int n_doc;
9248 xmlChar * name; /* the entity name */
9249 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009250
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009251 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9252 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9253 mem_base = xmlMemBlocks();
9254 doc = gen_xmlDocPtr(n_doc, 0);
9255 name = gen_const_xmlChar_ptr(n_name, 1);
9256
William M. Brackf13f77f2004-11-12 16:03:48 +00009257 ret_val = xmlGetDocEntity(doc, (const xmlChar *)name);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009258 desret_xmlEntityPtr(ret_val);
9259 call_tests++;
9260 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009261 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009262 xmlResetLastError();
9263 if (mem_base != xmlMemBlocks()) {
9264 printf("Leak of %d blocks found in xmlGetDocEntity",
9265 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009266 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009267 printf(" %d", n_doc);
9268 printf(" %d", n_name);
9269 printf("\n");
9270 }
9271 }
9272 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009273 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009274
Daniel Veillard42595322004-11-08 10:52:06 +00009275 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009276}
9277
9278
9279static int
9280test_xmlGetDtdEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009281 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009282
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009283 int mem_base;
9284 xmlEntityPtr ret_val;
9285 xmlDocPtr doc; /* the document referencing the entity */
9286 int n_doc;
9287 xmlChar * name; /* the entity name */
9288 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009289
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009290 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9291 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9292 mem_base = xmlMemBlocks();
9293 doc = gen_xmlDocPtr(n_doc, 0);
9294 name = gen_const_xmlChar_ptr(n_name, 1);
9295
William M. Brackf13f77f2004-11-12 16:03:48 +00009296 ret_val = xmlGetDtdEntity(doc, (const xmlChar *)name);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009297 desret_xmlEntityPtr(ret_val);
9298 call_tests++;
9299 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009300 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009301 xmlResetLastError();
9302 if (mem_base != xmlMemBlocks()) {
9303 printf("Leak of %d blocks found in xmlGetDtdEntity",
9304 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009305 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009306 printf(" %d", n_doc);
9307 printf(" %d", n_name);
9308 printf("\n");
9309 }
9310 }
9311 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009312 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009313
Daniel Veillard42595322004-11-08 10:52:06 +00009314 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009315}
9316
9317
9318static int
9319test_xmlGetParameterEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009320 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009321
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009322 int mem_base;
9323 xmlEntityPtr ret_val;
9324 xmlDocPtr doc; /* the document referencing the entity */
9325 int n_doc;
9326 xmlChar * name; /* the entity name */
9327 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009328
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009329 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9330 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9331 mem_base = xmlMemBlocks();
9332 doc = gen_xmlDocPtr(n_doc, 0);
9333 name = gen_const_xmlChar_ptr(n_name, 1);
9334
William M. Brackf13f77f2004-11-12 16:03:48 +00009335 ret_val = xmlGetParameterEntity(doc, (const xmlChar *)name);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009336 desret_xmlEntityPtr(ret_val);
9337 call_tests++;
9338 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009339 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009340 xmlResetLastError();
9341 if (mem_base != xmlMemBlocks()) {
9342 printf("Leak of %d blocks found in xmlGetParameterEntity",
9343 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009344 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009345 printf(" %d", n_doc);
9346 printf(" %d", n_name);
9347 printf("\n");
9348 }
9349 }
9350 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009351 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009352
Daniel Veillard42595322004-11-08 10:52:06 +00009353 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009354}
9355
9356
9357static int
9358test_xmlGetPredefinedEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009359 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009360
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009361 int mem_base;
9362 xmlEntityPtr ret_val;
9363 xmlChar * name; /* the entity name */
9364 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009365
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009366 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9367 mem_base = xmlMemBlocks();
9368 name = gen_const_xmlChar_ptr(n_name, 0);
9369
William M. Brackf13f77f2004-11-12 16:03:48 +00009370 ret_val = xmlGetPredefinedEntity((const xmlChar *)name);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009371 desret_xmlEntityPtr(ret_val);
9372 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00009373 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009374 xmlResetLastError();
9375 if (mem_base != xmlMemBlocks()) {
9376 printf("Leak of %d blocks found in xmlGetPredefinedEntity",
9377 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009378 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009379 printf(" %d", n_name);
9380 printf("\n");
9381 }
9382 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009383 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009384
Daniel Veillard42595322004-11-08 10:52:06 +00009385 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009386}
9387
9388
9389static int
9390test_xmlInitializePredefinedEntities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009391 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009392
William M. Brack21e4ef22005-01-02 09:53:13 +00009393#if defined(LIBXML_LEGACY_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00009394#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +00009395 int mem_base;
9396
9397 mem_base = xmlMemBlocks();
9398
9399 xmlInitializePredefinedEntities();
9400 call_tests++;
9401 xmlResetLastError();
9402 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00009403 printf("Leak of %d blocks found in xmlInitializePredefinedEntities",
Daniel Veillardd93f6252004-11-02 15:53:51 +00009404 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009405 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00009406 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00009407 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009408 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00009409#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00009410#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00009411
Daniel Veillard42595322004-11-08 10:52:06 +00009412 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009413}
9414
9415static int
9416test_entities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009417 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009418
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009419 if (quiet == 0) printf("Testing entities : 12 of 16 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00009420 test_ret += test_xmlAddDocEntity();
9421 test_ret += test_xmlAddDtdEntity();
9422 test_ret += test_xmlCleanupPredefinedEntities();
9423 test_ret += test_xmlCopyEntitiesTable();
9424 test_ret += test_xmlCreateEntitiesTable();
9425 test_ret += test_xmlDumpEntitiesTable();
9426 test_ret += test_xmlDumpEntityDecl();
9427 test_ret += test_xmlEncodeEntitiesReentrant();
9428 test_ret += test_xmlEncodeSpecialChars();
9429 test_ret += test_xmlGetDocEntity();
9430 test_ret += test_xmlGetDtdEntity();
9431 test_ret += test_xmlGetParameterEntity();
9432 test_ret += test_xmlGetPredefinedEntity();
9433 test_ret += test_xmlInitializePredefinedEntities();
Daniel Veillardd93f6252004-11-02 15:53:51 +00009434
Daniel Veillard42595322004-11-08 10:52:06 +00009435 if (test_ret != 0)
9436 printf("Module entities: %d errors\n", test_ret);
9437 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009438}
9439
9440static int
9441test_xmlHashAddEntry(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009442 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009443
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009444 int mem_base;
9445 int ret_val;
9446 xmlHashTablePtr table; /* the hash table */
9447 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009448 xmlChar * name; /* the name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009449 int n_name;
9450 void * userdata; /* a pointer to the userdata */
9451 int n_userdata;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009452
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009453 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9454 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9455 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
9456 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009457 table = gen_xmlHashTablePtr(n_table, 0);
9458 name = gen_const_xmlChar_ptr(n_name, 1);
9459 userdata = gen_userdata(n_userdata, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009460
William M. Brackf13f77f2004-11-12 16:03:48 +00009461 ret_val = xmlHashAddEntry(table, (const xmlChar *)name, userdata);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009462 desret_int(ret_val);
9463 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009464 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009465 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +00009466 des_userdata(n_userdata, userdata, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009467 xmlResetLastError();
9468 if (mem_base != xmlMemBlocks()) {
9469 printf("Leak of %d blocks found in xmlHashAddEntry",
9470 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009471 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009472 printf(" %d", n_table);
9473 printf(" %d", n_name);
9474 printf(" %d", n_userdata);
9475 printf("\n");
9476 }
9477 }
9478 }
9479 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009480 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009481
Daniel Veillard42595322004-11-08 10:52:06 +00009482 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009483}
9484
9485
9486static int
9487test_xmlHashAddEntry2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009488 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009489
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009490 int mem_base;
9491 int ret_val;
9492 xmlHashTablePtr table; /* the hash table */
9493 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009494 xmlChar * name; /* the name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009495 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009496 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009497 int n_name2;
9498 void * userdata; /* a pointer to the userdata */
9499 int n_userdata;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009500
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009501 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9502 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9503 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9504 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
9505 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009506 table = gen_xmlHashTablePtr(n_table, 0);
9507 name = gen_const_xmlChar_ptr(n_name, 1);
9508 name2 = gen_const_xmlChar_ptr(n_name2, 2);
9509 userdata = gen_userdata(n_userdata, 3);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009510
William M. Brackf13f77f2004-11-12 16:03:48 +00009511 ret_val = xmlHashAddEntry2(table, (const xmlChar *)name, (const xmlChar *)name2, userdata);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009512 desret_int(ret_val);
9513 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009514 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009515 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
9516 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00009517 des_userdata(n_userdata, userdata, 3);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009518 xmlResetLastError();
9519 if (mem_base != xmlMemBlocks()) {
9520 printf("Leak of %d blocks found in xmlHashAddEntry2",
9521 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009522 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009523 printf(" %d", n_table);
9524 printf(" %d", n_name);
9525 printf(" %d", n_name2);
9526 printf(" %d", n_userdata);
9527 printf("\n");
9528 }
9529 }
9530 }
9531 }
9532 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009533 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009534
Daniel Veillard42595322004-11-08 10:52:06 +00009535 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009536}
9537
9538
9539static int
9540test_xmlHashAddEntry3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009541 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009542
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009543 int mem_base;
9544 int ret_val;
9545 xmlHashTablePtr table; /* the hash table */
9546 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009547 xmlChar * name; /* the name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009548 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009549 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009550 int n_name2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009551 xmlChar * name3; /* a third name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009552 int n_name3;
9553 void * userdata; /* a pointer to the userdata */
9554 int n_userdata;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009555
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009556 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9557 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9558 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9559 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
9560 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
9561 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009562 table = gen_xmlHashTablePtr(n_table, 0);
9563 name = gen_const_xmlChar_ptr(n_name, 1);
9564 name2 = gen_const_xmlChar_ptr(n_name2, 2);
9565 name3 = gen_const_xmlChar_ptr(n_name3, 3);
9566 userdata = gen_userdata(n_userdata, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009567
William M. Brackf13f77f2004-11-12 16:03:48 +00009568 ret_val = xmlHashAddEntry3(table, (const xmlChar *)name, (const xmlChar *)name2, (const xmlChar *)name3, userdata);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009569 desret_int(ret_val);
9570 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009571 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009572 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
9573 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
9574 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +00009575 des_userdata(n_userdata, userdata, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009576 xmlResetLastError();
9577 if (mem_base != xmlMemBlocks()) {
9578 printf("Leak of %d blocks found in xmlHashAddEntry3",
9579 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009580 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009581 printf(" %d", n_table);
9582 printf(" %d", n_name);
9583 printf(" %d", n_name2);
9584 printf(" %d", n_name3);
9585 printf(" %d", n_userdata);
9586 printf("\n");
9587 }
9588 }
9589 }
9590 }
9591 }
9592 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009593 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009594
Daniel Veillard42595322004-11-08 10:52:06 +00009595 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009596}
9597
9598
9599static int
9600test_xmlHashCopy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009601 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009602
9603
9604 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009605 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009606}
9607
9608
9609static int
9610test_xmlHashCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009611 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009612
9613
9614 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009615 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009616}
9617
9618
9619static int
9620test_xmlHashLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009621 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009622
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009623 int mem_base;
9624 void * ret_val;
9625 xmlHashTablePtr table; /* the hash table */
9626 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009627 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009628 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009629
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009630 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9631 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9632 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009633 table = gen_xmlHashTablePtr(n_table, 0);
9634 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009635
William M. Brackf13f77f2004-11-12 16:03:48 +00009636 ret_val = xmlHashLookup(table, (const xmlChar *)name);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009637 desret_void_ptr(ret_val);
9638 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009639 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009640 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009641 xmlResetLastError();
9642 if (mem_base != xmlMemBlocks()) {
9643 printf("Leak of %d blocks found in xmlHashLookup",
9644 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009645 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009646 printf(" %d", n_table);
9647 printf(" %d", n_name);
9648 printf("\n");
9649 }
9650 }
9651 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009652 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009653
Daniel Veillard42595322004-11-08 10:52:06 +00009654 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009655}
9656
9657
9658static int
9659test_xmlHashLookup2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009660 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009661
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009662 int mem_base;
9663 void * ret_val;
9664 xmlHashTablePtr table; /* the hash table */
9665 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009666 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009667 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009668 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009669 int n_name2;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009670
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009671 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9672 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9673 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9674 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009675 table = gen_xmlHashTablePtr(n_table, 0);
9676 name = gen_const_xmlChar_ptr(n_name, 1);
9677 name2 = gen_const_xmlChar_ptr(n_name2, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009678
William M. Brackf13f77f2004-11-12 16:03:48 +00009679 ret_val = xmlHashLookup2(table, (const xmlChar *)name, (const xmlChar *)name2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009680 desret_void_ptr(ret_val);
9681 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009682 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009683 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
9684 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009685 xmlResetLastError();
9686 if (mem_base != xmlMemBlocks()) {
9687 printf("Leak of %d blocks found in xmlHashLookup2",
9688 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009689 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009690 printf(" %d", n_table);
9691 printf(" %d", n_name);
9692 printf(" %d", n_name2);
9693 printf("\n");
9694 }
9695 }
9696 }
9697 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009698 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009699
Daniel Veillard42595322004-11-08 10:52:06 +00009700 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009701}
9702
9703
9704static int
9705test_xmlHashLookup3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009706 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009707
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009708 int mem_base;
9709 void * ret_val;
9710 xmlHashTablePtr table; /* the hash table */
9711 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009712 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009713 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009714 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009715 int n_name2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009716 xmlChar * name3; /* a third name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009717 int n_name3;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009718
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009719 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9720 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9721 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9722 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
9723 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009724 table = gen_xmlHashTablePtr(n_table, 0);
9725 name = gen_const_xmlChar_ptr(n_name, 1);
9726 name2 = gen_const_xmlChar_ptr(n_name2, 2);
9727 name3 = gen_const_xmlChar_ptr(n_name3, 3);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009728
William M. Brackf13f77f2004-11-12 16:03:48 +00009729 ret_val = xmlHashLookup3(table, (const xmlChar *)name, (const xmlChar *)name2, (const xmlChar *)name3);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009730 desret_void_ptr(ret_val);
9731 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009732 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009733 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
9734 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
9735 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 3);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009736 xmlResetLastError();
9737 if (mem_base != xmlMemBlocks()) {
9738 printf("Leak of %d blocks found in xmlHashLookup3",
9739 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009740 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009741 printf(" %d", n_table);
9742 printf(" %d", n_name);
9743 printf(" %d", n_name2);
9744 printf(" %d", n_name3);
9745 printf("\n");
9746 }
9747 }
9748 }
9749 }
9750 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009751 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009752
Daniel Veillard42595322004-11-08 10:52:06 +00009753 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009754}
9755
9756
9757static int
9758test_xmlHashQLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009759 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009760
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009761 int mem_base;
9762 void * ret_val;
9763 xmlHashTablePtr table; /* the hash table */
9764 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009765 xmlChar * prefix; /* the prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009766 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009767 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009768 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009769
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009770 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9771 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
9772 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9773 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009774 table = gen_xmlHashTablePtr(n_table, 0);
9775 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
9776 name = gen_const_xmlChar_ptr(n_name, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009777
William M. Brackf13f77f2004-11-12 16:03:48 +00009778 ret_val = xmlHashQLookup(table, (const xmlChar *)prefix, (const xmlChar *)name);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009779 desret_void_ptr(ret_val);
9780 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009781 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009782 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
9783 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009784 xmlResetLastError();
9785 if (mem_base != xmlMemBlocks()) {
9786 printf("Leak of %d blocks found in xmlHashQLookup",
9787 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009788 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009789 printf(" %d", n_table);
9790 printf(" %d", n_prefix);
9791 printf(" %d", n_name);
9792 printf("\n");
9793 }
9794 }
9795 }
9796 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009797 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009798
Daniel Veillard42595322004-11-08 10:52:06 +00009799 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009800}
9801
9802
9803static int
9804test_xmlHashQLookup2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009805 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009806
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009807 int mem_base;
9808 void * ret_val;
9809 xmlHashTablePtr table; /* the hash table */
9810 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009811 xmlChar * prefix; /* the prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009812 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009813 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009814 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009815 xmlChar * prefix2; /* the second prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009816 int n_prefix2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009817 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009818 int n_name2;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009819
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009820 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9821 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
9822 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9823 for (n_prefix2 = 0;n_prefix2 < gen_nb_const_xmlChar_ptr;n_prefix2++) {
9824 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9825 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009826 table = gen_xmlHashTablePtr(n_table, 0);
9827 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
9828 name = gen_const_xmlChar_ptr(n_name, 2);
9829 prefix2 = gen_const_xmlChar_ptr(n_prefix2, 3);
9830 name2 = gen_const_xmlChar_ptr(n_name2, 4);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009831
William M. Brackf13f77f2004-11-12 16:03:48 +00009832 ret_val = xmlHashQLookup2(table, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)prefix2, (const xmlChar *)name2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009833 desret_void_ptr(ret_val);
9834 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009835 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009836 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
9837 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
9838 des_const_xmlChar_ptr(n_prefix2, (const xmlChar *)prefix2, 3);
9839 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 4);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009840 xmlResetLastError();
9841 if (mem_base != xmlMemBlocks()) {
9842 printf("Leak of %d blocks found in xmlHashQLookup2",
9843 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009844 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009845 printf(" %d", n_table);
9846 printf(" %d", n_prefix);
9847 printf(" %d", n_name);
9848 printf(" %d", n_prefix2);
9849 printf(" %d", n_name2);
9850 printf("\n");
9851 }
9852 }
9853 }
9854 }
9855 }
9856 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009857 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009858
Daniel Veillard42595322004-11-08 10:52:06 +00009859 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009860}
9861
9862
9863static int
9864test_xmlHashQLookup3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009865 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009866
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009867 int mem_base;
9868 void * ret_val;
9869 xmlHashTablePtr table; /* the hash table */
9870 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009871 xmlChar * prefix; /* the prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009872 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009873 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009874 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009875 xmlChar * prefix2; /* the second prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009876 int n_prefix2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009877 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009878 int n_name2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009879 xmlChar * prefix3; /* the third prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009880 int n_prefix3;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009881 xmlChar * name3; /* a third name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009882 int n_name3;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009883
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009884 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9885 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
9886 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9887 for (n_prefix2 = 0;n_prefix2 < gen_nb_const_xmlChar_ptr;n_prefix2++) {
9888 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9889 for (n_prefix3 = 0;n_prefix3 < gen_nb_const_xmlChar_ptr;n_prefix3++) {
9890 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
9891 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009892 table = gen_xmlHashTablePtr(n_table, 0);
9893 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
9894 name = gen_const_xmlChar_ptr(n_name, 2);
9895 prefix2 = gen_const_xmlChar_ptr(n_prefix2, 3);
9896 name2 = gen_const_xmlChar_ptr(n_name2, 4);
9897 prefix3 = gen_const_xmlChar_ptr(n_prefix3, 5);
9898 name3 = gen_const_xmlChar_ptr(n_name3, 6);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009899
William M. Brackf13f77f2004-11-12 16:03:48 +00009900 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 +00009901 desret_void_ptr(ret_val);
9902 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009903 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009904 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
9905 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
9906 des_const_xmlChar_ptr(n_prefix2, (const xmlChar *)prefix2, 3);
9907 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 4);
9908 des_const_xmlChar_ptr(n_prefix3, (const xmlChar *)prefix3, 5);
9909 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 6);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009910 xmlResetLastError();
9911 if (mem_base != xmlMemBlocks()) {
9912 printf("Leak of %d blocks found in xmlHashQLookup3",
9913 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009914 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009915 printf(" %d", n_table);
9916 printf(" %d", n_prefix);
9917 printf(" %d", n_name);
9918 printf(" %d", n_prefix2);
9919 printf(" %d", n_name2);
9920 printf(" %d", n_prefix3);
9921 printf(" %d", n_name3);
9922 printf("\n");
9923 }
9924 }
9925 }
9926 }
9927 }
9928 }
9929 }
9930 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009931 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009932
Daniel Veillard42595322004-11-08 10:52:06 +00009933 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009934}
9935
9936
9937static int
9938test_xmlHashRemoveEntry(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009939 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009940
Daniel Veillard42595322004-11-08 10:52:06 +00009941 int mem_base;
9942 int ret_val;
9943 xmlHashTablePtr table; /* the hash table */
9944 int n_table;
9945 xmlChar * name; /* the name of the userdata */
9946 int n_name;
9947 xmlHashDeallocator f; /* the deallocator function for removed item (if any) */
9948 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009949
Daniel Veillard42595322004-11-08 10:52:06 +00009950 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9951 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9952 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
9953 mem_base = xmlMemBlocks();
9954 table = gen_xmlHashTablePtr(n_table, 0);
9955 name = gen_const_xmlChar_ptr(n_name, 1);
9956 f = gen_xmlHashDeallocator(n_f, 2);
9957
William M. Brackf13f77f2004-11-12 16:03:48 +00009958 ret_val = xmlHashRemoveEntry(table, (const xmlChar *)name, f);
Daniel Veillard42595322004-11-08 10:52:06 +00009959 desret_int(ret_val);
9960 call_tests++;
9961 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009962 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard42595322004-11-08 10:52:06 +00009963 des_xmlHashDeallocator(n_f, f, 2);
9964 xmlResetLastError();
9965 if (mem_base != xmlMemBlocks()) {
9966 printf("Leak of %d blocks found in xmlHashRemoveEntry",
9967 xmlMemBlocks() - mem_base);
9968 test_ret++;
9969 printf(" %d", n_table);
9970 printf(" %d", n_name);
9971 printf(" %d", n_f);
9972 printf("\n");
9973 }
9974 }
9975 }
9976 }
Daniel Veillard42595322004-11-08 10:52:06 +00009977 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009978
Daniel Veillard42595322004-11-08 10:52:06 +00009979 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009980}
9981
9982
9983static int
9984test_xmlHashRemoveEntry2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009985 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009986
Daniel Veillard42595322004-11-08 10:52:06 +00009987 int mem_base;
9988 int ret_val;
9989 xmlHashTablePtr table; /* the hash table */
9990 int n_table;
9991 xmlChar * name; /* the name of the userdata */
9992 int n_name;
9993 xmlChar * name2; /* a second name of the userdata */
9994 int n_name2;
9995 xmlHashDeallocator f; /* the deallocator function for removed item (if any) */
9996 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009997
Daniel Veillard42595322004-11-08 10:52:06 +00009998 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9999 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10000 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10001 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10002 mem_base = xmlMemBlocks();
10003 table = gen_xmlHashTablePtr(n_table, 0);
10004 name = gen_const_xmlChar_ptr(n_name, 1);
10005 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10006 f = gen_xmlHashDeallocator(n_f, 3);
10007
William M. Brackf13f77f2004-11-12 16:03:48 +000010008 ret_val = xmlHashRemoveEntry2(table, (const xmlChar *)name, (const xmlChar *)name2, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010009 desret_int(ret_val);
10010 call_tests++;
10011 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010012 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
10013 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
Daniel Veillard42595322004-11-08 10:52:06 +000010014 des_xmlHashDeallocator(n_f, f, 3);
10015 xmlResetLastError();
10016 if (mem_base != xmlMemBlocks()) {
10017 printf("Leak of %d blocks found in xmlHashRemoveEntry2",
10018 xmlMemBlocks() - mem_base);
10019 test_ret++;
10020 printf(" %d", n_table);
10021 printf(" %d", n_name);
10022 printf(" %d", n_name2);
10023 printf(" %d", n_f);
10024 printf("\n");
10025 }
10026 }
10027 }
10028 }
10029 }
Daniel Veillard42595322004-11-08 10:52:06 +000010030 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010031
Daniel Veillard42595322004-11-08 10:52:06 +000010032 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010033}
10034
10035
10036static int
10037test_xmlHashRemoveEntry3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010038 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010039
Daniel Veillard42595322004-11-08 10:52:06 +000010040 int mem_base;
10041 int ret_val;
10042 xmlHashTablePtr table; /* the hash table */
10043 int n_table;
10044 xmlChar * name; /* the name of the userdata */
10045 int n_name;
10046 xmlChar * name2; /* a second name of the userdata */
10047 int n_name2;
10048 xmlChar * name3; /* a third name of the userdata */
10049 int n_name3;
10050 xmlHashDeallocator f; /* the deallocator function for removed item (if any) */
10051 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010052
Daniel Veillard42595322004-11-08 10:52:06 +000010053 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10054 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10055 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10056 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
10057 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10058 mem_base = xmlMemBlocks();
10059 table = gen_xmlHashTablePtr(n_table, 0);
10060 name = gen_const_xmlChar_ptr(n_name, 1);
10061 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10062 name3 = gen_const_xmlChar_ptr(n_name3, 3);
10063 f = gen_xmlHashDeallocator(n_f, 4);
10064
William M. Brackf13f77f2004-11-12 16:03:48 +000010065 ret_val = xmlHashRemoveEntry3(table, (const xmlChar *)name, (const xmlChar *)name2, (const xmlChar *)name3, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010066 desret_int(ret_val);
10067 call_tests++;
10068 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010069 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
10070 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
10071 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000010072 des_xmlHashDeallocator(n_f, f, 4);
10073 xmlResetLastError();
10074 if (mem_base != xmlMemBlocks()) {
10075 printf("Leak of %d blocks found in xmlHashRemoveEntry3",
10076 xmlMemBlocks() - mem_base);
10077 test_ret++;
10078 printf(" %d", n_table);
10079 printf(" %d", n_name);
10080 printf(" %d", n_name2);
10081 printf(" %d", n_name3);
10082 printf(" %d", n_f);
10083 printf("\n");
10084 }
10085 }
10086 }
10087 }
10088 }
10089 }
Daniel Veillard42595322004-11-08 10:52:06 +000010090 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010091
Daniel Veillard42595322004-11-08 10:52:06 +000010092 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010093}
10094
10095
10096static int
10097test_xmlHashScan(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010098 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010099
10100
10101 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010102 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010103}
10104
10105
10106static int
10107test_xmlHashScan3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010108 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010109
10110
10111 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010112 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010113}
10114
10115
10116static int
10117test_xmlHashScanFull(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010118 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010119
10120
10121 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010122 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010123}
10124
10125
10126static int
10127test_xmlHashScanFull3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010128 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010129
10130
10131 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010132 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010133}
10134
10135
10136static int
10137test_xmlHashSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010138 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010139
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010140 int mem_base;
10141 int ret_val;
10142 xmlHashTablePtr table; /* the hash table */
10143 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010144
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010145 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10146 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010147 table = gen_xmlHashTablePtr(n_table, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010148
10149 ret_val = xmlHashSize(table);
10150 desret_int(ret_val);
10151 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010152 des_xmlHashTablePtr(n_table, table, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010153 xmlResetLastError();
10154 if (mem_base != xmlMemBlocks()) {
10155 printf("Leak of %d blocks found in xmlHashSize",
10156 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010157 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010158 printf(" %d", n_table);
10159 printf("\n");
10160 }
10161 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010162 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010163
Daniel Veillard42595322004-11-08 10:52:06 +000010164 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010165}
10166
10167
10168static int
10169test_xmlHashUpdateEntry(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010170 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010171
Daniel Veillard42595322004-11-08 10:52:06 +000010172 int mem_base;
10173 int ret_val;
10174 xmlHashTablePtr table; /* the hash table */
10175 int n_table;
10176 xmlChar * name; /* the name of the userdata */
10177 int n_name;
10178 void * userdata; /* a pointer to the userdata */
10179 int n_userdata;
10180 xmlHashDeallocator f; /* the deallocator function for replaced item (if any) */
10181 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010182
Daniel Veillard42595322004-11-08 10:52:06 +000010183 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10184 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10185 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
10186 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10187 mem_base = xmlMemBlocks();
10188 table = gen_xmlHashTablePtr(n_table, 0);
10189 name = gen_const_xmlChar_ptr(n_name, 1);
10190 userdata = gen_userdata(n_userdata, 2);
10191 f = gen_xmlHashDeallocator(n_f, 3);
10192
William M. Brackf13f77f2004-11-12 16:03:48 +000010193 ret_val = xmlHashUpdateEntry(table, (const xmlChar *)name, userdata, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010194 desret_int(ret_val);
10195 call_tests++;
10196 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010197 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000010198 des_userdata(n_userdata, userdata, 2);
10199 des_xmlHashDeallocator(n_f, f, 3);
10200 xmlResetLastError();
10201 if (mem_base != xmlMemBlocks()) {
10202 printf("Leak of %d blocks found in xmlHashUpdateEntry",
10203 xmlMemBlocks() - mem_base);
10204 test_ret++;
10205 printf(" %d", n_table);
10206 printf(" %d", n_name);
10207 printf(" %d", n_userdata);
10208 printf(" %d", n_f);
10209 printf("\n");
10210 }
10211 }
10212 }
10213 }
10214 }
Daniel Veillard42595322004-11-08 10:52:06 +000010215 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010216
Daniel Veillard42595322004-11-08 10:52:06 +000010217 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010218}
10219
10220
10221static int
10222test_xmlHashUpdateEntry2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010223 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010224
Daniel Veillard42595322004-11-08 10:52:06 +000010225 int mem_base;
10226 int ret_val;
10227 xmlHashTablePtr table; /* the hash table */
10228 int n_table;
10229 xmlChar * name; /* the name of the userdata */
10230 int n_name;
10231 xmlChar * name2; /* a second name of the userdata */
10232 int n_name2;
10233 void * userdata; /* a pointer to the userdata */
10234 int n_userdata;
10235 xmlHashDeallocator f; /* the deallocator function for replaced item (if any) */
10236 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010237
Daniel Veillard42595322004-11-08 10:52:06 +000010238 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10239 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10240 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10241 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
10242 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10243 mem_base = xmlMemBlocks();
10244 table = gen_xmlHashTablePtr(n_table, 0);
10245 name = gen_const_xmlChar_ptr(n_name, 1);
10246 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10247 userdata = gen_userdata(n_userdata, 3);
10248 f = gen_xmlHashDeallocator(n_f, 4);
10249
William M. Brackf13f77f2004-11-12 16:03:48 +000010250 ret_val = xmlHashUpdateEntry2(table, (const xmlChar *)name, (const xmlChar *)name2, userdata, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010251 desret_int(ret_val);
10252 call_tests++;
10253 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010254 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
10255 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
Daniel Veillard42595322004-11-08 10:52:06 +000010256 des_userdata(n_userdata, userdata, 3);
10257 des_xmlHashDeallocator(n_f, f, 4);
10258 xmlResetLastError();
10259 if (mem_base != xmlMemBlocks()) {
10260 printf("Leak of %d blocks found in xmlHashUpdateEntry2",
10261 xmlMemBlocks() - mem_base);
10262 test_ret++;
10263 printf(" %d", n_table);
10264 printf(" %d", n_name);
10265 printf(" %d", n_name2);
10266 printf(" %d", n_userdata);
10267 printf(" %d", n_f);
10268 printf("\n");
10269 }
10270 }
10271 }
10272 }
10273 }
10274 }
Daniel Veillard42595322004-11-08 10:52:06 +000010275 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010276
Daniel Veillard42595322004-11-08 10:52:06 +000010277 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010278}
10279
10280
10281static int
10282test_xmlHashUpdateEntry3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010283 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010284
Daniel Veillard42595322004-11-08 10:52:06 +000010285 int mem_base;
10286 int ret_val;
10287 xmlHashTablePtr table; /* the hash table */
10288 int n_table;
10289 xmlChar * name; /* the name of the userdata */
10290 int n_name;
10291 xmlChar * name2; /* a second name of the userdata */
10292 int n_name2;
10293 xmlChar * name3; /* a third name of the userdata */
10294 int n_name3;
10295 void * userdata; /* a pointer to the userdata */
10296 int n_userdata;
10297 xmlHashDeallocator f; /* the deallocator function for replaced item (if any) */
10298 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010299
Daniel Veillard42595322004-11-08 10:52:06 +000010300 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10301 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10302 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10303 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
10304 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
10305 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10306 mem_base = xmlMemBlocks();
10307 table = gen_xmlHashTablePtr(n_table, 0);
10308 name = gen_const_xmlChar_ptr(n_name, 1);
10309 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10310 name3 = gen_const_xmlChar_ptr(n_name3, 3);
10311 userdata = gen_userdata(n_userdata, 4);
10312 f = gen_xmlHashDeallocator(n_f, 5);
10313
William M. Brackf13f77f2004-11-12 16:03:48 +000010314 ret_val = xmlHashUpdateEntry3(table, (const xmlChar *)name, (const xmlChar *)name2, (const xmlChar *)name3, userdata, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010315 desret_int(ret_val);
10316 call_tests++;
10317 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010318 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
10319 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
10320 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000010321 des_userdata(n_userdata, userdata, 4);
10322 des_xmlHashDeallocator(n_f, f, 5);
10323 xmlResetLastError();
10324 if (mem_base != xmlMemBlocks()) {
10325 printf("Leak of %d blocks found in xmlHashUpdateEntry3",
10326 xmlMemBlocks() - mem_base);
10327 test_ret++;
10328 printf(" %d", n_table);
10329 printf(" %d", n_name);
10330 printf(" %d", n_name2);
10331 printf(" %d", n_name3);
10332 printf(" %d", n_userdata);
10333 printf(" %d", n_f);
10334 printf("\n");
10335 }
10336 }
10337 }
10338 }
10339 }
10340 }
10341 }
Daniel Veillard42595322004-11-08 10:52:06 +000010342 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010343
Daniel Veillard42595322004-11-08 10:52:06 +000010344 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010345}
10346
10347static int
10348test_hash(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010349 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010350
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010351 if (quiet == 0) printf("Testing hash : 16 of 23 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000010352 test_ret += test_xmlHashAddEntry();
10353 test_ret += test_xmlHashAddEntry2();
10354 test_ret += test_xmlHashAddEntry3();
10355 test_ret += test_xmlHashCopy();
10356 test_ret += test_xmlHashCreate();
10357 test_ret += test_xmlHashLookup();
10358 test_ret += test_xmlHashLookup2();
10359 test_ret += test_xmlHashLookup3();
10360 test_ret += test_xmlHashQLookup();
10361 test_ret += test_xmlHashQLookup2();
10362 test_ret += test_xmlHashQLookup3();
10363 test_ret += test_xmlHashRemoveEntry();
10364 test_ret += test_xmlHashRemoveEntry2();
10365 test_ret += test_xmlHashRemoveEntry3();
10366 test_ret += test_xmlHashScan();
10367 test_ret += test_xmlHashScan3();
10368 test_ret += test_xmlHashScanFull();
10369 test_ret += test_xmlHashScanFull3();
10370 test_ret += test_xmlHashSize();
10371 test_ret += test_xmlHashUpdateEntry();
10372 test_ret += test_xmlHashUpdateEntry2();
10373 test_ret += test_xmlHashUpdateEntry3();
Daniel Veillardd93f6252004-11-02 15:53:51 +000010374
Daniel Veillard42595322004-11-08 10:52:06 +000010375 if (test_ret != 0)
10376 printf("Module hash: %d errors\n", test_ret);
10377 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010378}
10379
Daniel Veillardce682bc2004-11-05 17:22:25 +000010380#define gen_nb_xmlLinkPtr 1
10381static xmlLinkPtr gen_xmlLinkPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10382 return(NULL);
10383}
10384static void des_xmlLinkPtr(int no ATTRIBUTE_UNUSED, xmlLinkPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10385}
10386
Daniel Veillardd93f6252004-11-02 15:53:51 +000010387static int
10388test_xmlLinkGetData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010389 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010390
Daniel Veillardce682bc2004-11-05 17:22:25 +000010391 int mem_base;
10392 void * ret_val;
10393 xmlLinkPtr lk; /* a link */
10394 int n_lk;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010395
Daniel Veillardce682bc2004-11-05 17:22:25 +000010396 for (n_lk = 0;n_lk < gen_nb_xmlLinkPtr;n_lk++) {
10397 mem_base = xmlMemBlocks();
10398 lk = gen_xmlLinkPtr(n_lk, 0);
10399
10400 ret_val = xmlLinkGetData(lk);
10401 desret_void_ptr(ret_val);
10402 call_tests++;
10403 des_xmlLinkPtr(n_lk, lk, 0);
10404 xmlResetLastError();
10405 if (mem_base != xmlMemBlocks()) {
10406 printf("Leak of %d blocks found in xmlLinkGetData",
10407 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010408 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010409 printf(" %d", n_lk);
10410 printf("\n");
10411 }
10412 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000010413 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010414
Daniel Veillard42595322004-11-08 10:52:06 +000010415 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010416}
10417
10418
10419static int
10420test_xmlListAppend(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010421 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010422
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010423 int mem_base;
10424 int ret_val;
10425 xmlListPtr l; /* a list */
10426 int n_l;
10427 void * data; /* the data */
10428 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010429
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010430 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10431 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10432 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010433 l = gen_xmlListPtr(n_l, 0);
10434 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010435
10436 ret_val = xmlListAppend(l, data);
10437 desret_int(ret_val);
10438 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010439 des_xmlListPtr(n_l, l, 0);
10440 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010441 xmlResetLastError();
10442 if (mem_base != xmlMemBlocks()) {
10443 printf("Leak of %d blocks found in xmlListAppend",
10444 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010445 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010446 printf(" %d", n_l);
10447 printf(" %d", n_data);
10448 printf("\n");
10449 }
10450 }
10451 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010452 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010453
Daniel Veillard42595322004-11-08 10:52:06 +000010454 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010455}
10456
10457
10458static int
10459test_xmlListClear(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010460 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010461
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010462 int mem_base;
10463 xmlListPtr l; /* a list */
10464 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010465
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010466 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10467 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010468 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010469
10470 xmlListClear(l);
10471 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010472 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010473 xmlResetLastError();
10474 if (mem_base != xmlMemBlocks()) {
10475 printf("Leak of %d blocks found in xmlListClear",
10476 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010477 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010478 printf(" %d", n_l);
10479 printf("\n");
10480 }
10481 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010482 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010483
Daniel Veillard42595322004-11-08 10:52:06 +000010484 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010485}
10486
10487
Daniel Veillardce682bc2004-11-05 17:22:25 +000010488#define gen_nb_const_xmlListPtr 1
10489static xmlListPtr gen_const_xmlListPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10490 return(NULL);
10491}
10492static void des_const_xmlListPtr(int no ATTRIBUTE_UNUSED, const xmlListPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10493}
10494
Daniel Veillardd93f6252004-11-02 15:53:51 +000010495static int
10496test_xmlListCopy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010497 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010498
Daniel Veillardce682bc2004-11-05 17:22:25 +000010499 int mem_base;
10500 int ret_val;
10501 xmlListPtr cur; /* the new list */
10502 int n_cur;
10503 xmlListPtr old; /* the old list */
10504 int n_old;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010505
Daniel Veillardce682bc2004-11-05 17:22:25 +000010506 for (n_cur = 0;n_cur < gen_nb_xmlListPtr;n_cur++) {
10507 for (n_old = 0;n_old < gen_nb_const_xmlListPtr;n_old++) {
10508 mem_base = xmlMemBlocks();
10509 cur = gen_xmlListPtr(n_cur, 0);
10510 old = gen_const_xmlListPtr(n_old, 1);
10511
William M. Brackf13f77f2004-11-12 16:03:48 +000010512 ret_val = xmlListCopy(cur, (const xmlListPtr)old);
Daniel Veillardce682bc2004-11-05 17:22:25 +000010513 desret_int(ret_val);
10514 call_tests++;
10515 des_xmlListPtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010516 des_const_xmlListPtr(n_old, (const xmlListPtr)old, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000010517 xmlResetLastError();
10518 if (mem_base != xmlMemBlocks()) {
10519 printf("Leak of %d blocks found in xmlListCopy",
10520 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010521 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010522 printf(" %d", n_cur);
10523 printf(" %d", n_old);
10524 printf("\n");
10525 }
10526 }
10527 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000010528 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010529
Daniel Veillard42595322004-11-08 10:52:06 +000010530 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010531}
10532
10533
10534static int
10535test_xmlListCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010536 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010537
10538
10539 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010540 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010541}
10542
10543
10544static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000010545test_xmlListDup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010546 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010547
10548
10549 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010550 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010551}
10552
10553
10554static int
10555test_xmlListEmpty(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010556 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010557
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010558 int mem_base;
10559 int ret_val;
10560 xmlListPtr l; /* a list */
10561 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010562
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010563 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10564 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010565 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010566
10567 ret_val = xmlListEmpty(l);
10568 desret_int(ret_val);
10569 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010570 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010571 xmlResetLastError();
10572 if (mem_base != xmlMemBlocks()) {
10573 printf("Leak of %d blocks found in xmlListEmpty",
10574 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010575 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010576 printf(" %d", n_l);
10577 printf("\n");
10578 }
10579 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010580 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010581
Daniel Veillard42595322004-11-08 10:52:06 +000010582 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010583}
10584
10585
10586static int
10587test_xmlListEnd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010588 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010589
10590
10591 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010592 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010593}
10594
10595
10596static int
10597test_xmlListFront(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010598 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010599
10600
10601 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010602 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010603}
10604
10605
10606static int
10607test_xmlListInsert(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010608 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010609
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010610 int mem_base;
10611 int ret_val;
10612 xmlListPtr l; /* a list */
10613 int n_l;
10614 void * data; /* the data */
10615 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010616
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010617 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10618 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10619 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010620 l = gen_xmlListPtr(n_l, 0);
10621 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010622
10623 ret_val = xmlListInsert(l, data);
10624 desret_int(ret_val);
10625 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010626 des_xmlListPtr(n_l, l, 0);
10627 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010628 xmlResetLastError();
10629 if (mem_base != xmlMemBlocks()) {
10630 printf("Leak of %d blocks found in xmlListInsert",
10631 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010632 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010633 printf(" %d", n_l);
10634 printf(" %d", n_data);
10635 printf("\n");
10636 }
10637 }
10638 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010639 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010640
Daniel Veillard42595322004-11-08 10:52:06 +000010641 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010642}
10643
10644
10645static int
10646test_xmlListMerge(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010647 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010648
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010649 int mem_base;
10650 xmlListPtr l1; /* the original list */
10651 int n_l1;
10652 xmlListPtr l2; /* the new list */
10653 int n_l2;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010654
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010655 for (n_l1 = 0;n_l1 < gen_nb_xmlListPtr;n_l1++) {
10656 for (n_l2 = 0;n_l2 < gen_nb_xmlListPtr;n_l2++) {
10657 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010658 l1 = gen_xmlListPtr(n_l1, 0);
10659 l2 = gen_xmlListPtr(n_l2, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010660
10661 xmlListMerge(l1, l2);
10662 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010663 des_xmlListPtr(n_l1, l1, 0);
10664 des_xmlListPtr(n_l2, l2, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010665 xmlResetLastError();
10666 if (mem_base != xmlMemBlocks()) {
10667 printf("Leak of %d blocks found in xmlListMerge",
10668 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010669 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010670 printf(" %d", n_l1);
10671 printf(" %d", n_l2);
10672 printf("\n");
10673 }
10674 }
10675 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010676 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010677
Daniel Veillard42595322004-11-08 10:52:06 +000010678 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010679}
10680
10681
10682static int
10683test_xmlListPopBack(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010684 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010685
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010686 int mem_base;
10687 xmlListPtr l; /* a list */
10688 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010689
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010690 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10691 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010692 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010693
10694 xmlListPopBack(l);
10695 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010696 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010697 xmlResetLastError();
10698 if (mem_base != xmlMemBlocks()) {
10699 printf("Leak of %d blocks found in xmlListPopBack",
10700 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010701 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010702 printf(" %d", n_l);
10703 printf("\n");
10704 }
10705 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010706 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010707
Daniel Veillard42595322004-11-08 10:52:06 +000010708 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010709}
10710
10711
10712static int
10713test_xmlListPopFront(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010714 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010715
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010716 int mem_base;
10717 xmlListPtr l; /* a list */
10718 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010719
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010720 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10721 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010722 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010723
10724 xmlListPopFront(l);
10725 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010726 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010727 xmlResetLastError();
10728 if (mem_base != xmlMemBlocks()) {
10729 printf("Leak of %d blocks found in xmlListPopFront",
10730 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010731 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010732 printf(" %d", n_l);
10733 printf("\n");
10734 }
10735 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010736 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010737
Daniel Veillard42595322004-11-08 10:52:06 +000010738 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010739}
10740
10741
10742static int
10743test_xmlListPushBack(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010744 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010745
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010746 int mem_base;
10747 int ret_val;
10748 xmlListPtr l; /* a list */
10749 int n_l;
10750 void * data; /* new data */
10751 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010752
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010753 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10754 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10755 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010756 l = gen_xmlListPtr(n_l, 0);
10757 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010758
10759 ret_val = xmlListPushBack(l, data);
10760 desret_int(ret_val);
10761 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010762 des_xmlListPtr(n_l, l, 0);
10763 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010764 xmlResetLastError();
10765 if (mem_base != xmlMemBlocks()) {
10766 printf("Leak of %d blocks found in xmlListPushBack",
10767 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010768 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010769 printf(" %d", n_l);
10770 printf(" %d", n_data);
10771 printf("\n");
10772 }
10773 }
10774 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010775 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010776
Daniel Veillard42595322004-11-08 10:52:06 +000010777 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010778}
10779
10780
10781static int
10782test_xmlListPushFront(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010783 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010784
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010785 int mem_base;
10786 int ret_val;
10787 xmlListPtr l; /* a list */
10788 int n_l;
10789 void * data; /* new data */
10790 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010791
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010792 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10793 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10794 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010795 l = gen_xmlListPtr(n_l, 0);
10796 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010797
10798 ret_val = xmlListPushFront(l, data);
10799 desret_int(ret_val);
10800 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010801 des_xmlListPtr(n_l, l, 0);
10802 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010803 xmlResetLastError();
10804 if (mem_base != xmlMemBlocks()) {
10805 printf("Leak of %d blocks found in xmlListPushFront",
10806 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010807 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010808 printf(" %d", n_l);
10809 printf(" %d", n_data);
10810 printf("\n");
10811 }
10812 }
10813 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010814 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010815
Daniel Veillard42595322004-11-08 10:52:06 +000010816 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010817}
10818
10819
10820static int
10821test_xmlListRemoveAll(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010822 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010823
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010824 int mem_base;
10825 int ret_val;
10826 xmlListPtr l; /* a list */
10827 int n_l;
10828 void * data; /* list data */
10829 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010830
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010831 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10832 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10833 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010834 l = gen_xmlListPtr(n_l, 0);
10835 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010836
10837 ret_val = xmlListRemoveAll(l, data);
10838 desret_int(ret_val);
10839 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010840 des_xmlListPtr(n_l, l, 0);
10841 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010842 xmlResetLastError();
10843 if (mem_base != xmlMemBlocks()) {
10844 printf("Leak of %d blocks found in xmlListRemoveAll",
10845 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010846 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010847 printf(" %d", n_l);
10848 printf(" %d", n_data);
10849 printf("\n");
10850 }
10851 }
10852 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010853 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010854
Daniel Veillard42595322004-11-08 10:52:06 +000010855 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010856}
10857
10858
10859static int
10860test_xmlListRemoveFirst(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010861 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010862
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010863 int mem_base;
10864 int ret_val;
10865 xmlListPtr l; /* a list */
10866 int n_l;
10867 void * data; /* list data */
10868 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010869
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010870 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10871 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10872 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010873 l = gen_xmlListPtr(n_l, 0);
10874 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010875
10876 ret_val = xmlListRemoveFirst(l, data);
10877 desret_int(ret_val);
10878 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010879 des_xmlListPtr(n_l, l, 0);
10880 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010881 xmlResetLastError();
10882 if (mem_base != xmlMemBlocks()) {
10883 printf("Leak of %d blocks found in xmlListRemoveFirst",
10884 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010885 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010886 printf(" %d", n_l);
10887 printf(" %d", n_data);
10888 printf("\n");
10889 }
10890 }
10891 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010892 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010893
Daniel Veillard42595322004-11-08 10:52:06 +000010894 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010895}
10896
10897
10898static int
10899test_xmlListRemoveLast(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010900 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010901
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010902 int mem_base;
10903 int ret_val;
10904 xmlListPtr l; /* a list */
10905 int n_l;
10906 void * data; /* list data */
10907 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010908
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010909 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10910 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10911 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010912 l = gen_xmlListPtr(n_l, 0);
10913 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010914
10915 ret_val = xmlListRemoveLast(l, data);
10916 desret_int(ret_val);
10917 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010918 des_xmlListPtr(n_l, l, 0);
10919 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010920 xmlResetLastError();
10921 if (mem_base != xmlMemBlocks()) {
10922 printf("Leak of %d blocks found in xmlListRemoveLast",
10923 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010924 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010925 printf(" %d", n_l);
10926 printf(" %d", n_data);
10927 printf("\n");
10928 }
10929 }
10930 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010931 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010932
Daniel Veillard42595322004-11-08 10:52:06 +000010933 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010934}
10935
10936
10937static int
10938test_xmlListReverse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010939 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010940
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010941 int mem_base;
10942 xmlListPtr l; /* a list */
10943 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010944
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010945 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10946 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010947 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010948
10949 xmlListReverse(l);
10950 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010951 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010952 xmlResetLastError();
10953 if (mem_base != xmlMemBlocks()) {
10954 printf("Leak of %d blocks found in xmlListReverse",
10955 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010956 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010957 printf(" %d", n_l);
10958 printf("\n");
10959 }
10960 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010961 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010962
Daniel Veillard42595322004-11-08 10:52:06 +000010963 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010964}
10965
10966
10967static int
10968test_xmlListReverseSearch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010969 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010970
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010971 int mem_base;
10972 void * ret_val;
10973 xmlListPtr l; /* a list */
10974 int n_l;
10975 void * data; /* a search value */
10976 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010977
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010978 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10979 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10980 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010981 l = gen_xmlListPtr(n_l, 0);
10982 data = gen_userdata(n_data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010983
10984 ret_val = xmlListReverseSearch(l, data);
10985 desret_void_ptr(ret_val);
10986 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010987 des_xmlListPtr(n_l, l, 0);
10988 des_userdata(n_data, data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010989 xmlResetLastError();
10990 if (mem_base != xmlMemBlocks()) {
10991 printf("Leak of %d blocks found in xmlListReverseSearch",
10992 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010993 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010994 printf(" %d", n_l);
10995 printf(" %d", n_data);
10996 printf("\n");
10997 }
10998 }
10999 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011000 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011001
Daniel Veillard42595322004-11-08 10:52:06 +000011002 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011003}
11004
11005
11006static int
11007test_xmlListReverseWalk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011008 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011009
11010
11011 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011012 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011013}
11014
11015
11016static int
11017test_xmlListSearch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011018 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011019
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011020 int mem_base;
11021 void * ret_val;
11022 xmlListPtr l; /* a list */
11023 int n_l;
11024 void * data; /* a search value */
11025 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011026
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011027 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11028 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
11029 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011030 l = gen_xmlListPtr(n_l, 0);
11031 data = gen_userdata(n_data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011032
11033 ret_val = xmlListSearch(l, data);
11034 desret_void_ptr(ret_val);
11035 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011036 des_xmlListPtr(n_l, l, 0);
11037 des_userdata(n_data, data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011038 xmlResetLastError();
11039 if (mem_base != xmlMemBlocks()) {
11040 printf("Leak of %d blocks found in xmlListSearch",
11041 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011042 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011043 printf(" %d", n_l);
11044 printf(" %d", n_data);
11045 printf("\n");
11046 }
11047 }
11048 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011049 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011050
Daniel Veillard42595322004-11-08 10:52:06 +000011051 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011052}
11053
11054
11055static int
11056test_xmlListSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011057 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011058
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011059 int mem_base;
11060 int ret_val;
11061 xmlListPtr l; /* a list */
11062 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011063
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011064 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11065 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011066 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011067
11068 ret_val = xmlListSize(l);
11069 desret_int(ret_val);
11070 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011071 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011072 xmlResetLastError();
11073 if (mem_base != xmlMemBlocks()) {
11074 printf("Leak of %d blocks found in xmlListSize",
11075 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011076 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011077 printf(" %d", n_l);
11078 printf("\n");
11079 }
11080 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011081 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011082
Daniel Veillard42595322004-11-08 10:52:06 +000011083 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011084}
11085
11086
11087static int
11088test_xmlListSort(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011089 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011090
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011091 int mem_base;
11092 xmlListPtr l; /* a list */
11093 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011094
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011095 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11096 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011097 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011098
11099 xmlListSort(l);
11100 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011101 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011102 xmlResetLastError();
11103 if (mem_base != xmlMemBlocks()) {
11104 printf("Leak of %d blocks found in xmlListSort",
11105 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011106 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011107 printf(" %d", n_l);
11108 printf("\n");
11109 }
11110 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011111 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011112
Daniel Veillard42595322004-11-08 10:52:06 +000011113 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011114}
11115
11116
11117static int
11118test_xmlListWalk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011119 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011120
11121
11122 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011123 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011124}
11125
11126static int
11127test_list(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011128 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011129
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011130 if (quiet == 0) printf("Testing list : 19 of 26 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000011131 test_ret += test_xmlLinkGetData();
11132 test_ret += test_xmlListAppend();
11133 test_ret += test_xmlListClear();
11134 test_ret += test_xmlListCopy();
11135 test_ret += test_xmlListCreate();
11136 test_ret += test_xmlListDup();
11137 test_ret += test_xmlListEmpty();
11138 test_ret += test_xmlListEnd();
11139 test_ret += test_xmlListFront();
11140 test_ret += test_xmlListInsert();
11141 test_ret += test_xmlListMerge();
11142 test_ret += test_xmlListPopBack();
11143 test_ret += test_xmlListPopFront();
11144 test_ret += test_xmlListPushBack();
11145 test_ret += test_xmlListPushFront();
11146 test_ret += test_xmlListRemoveAll();
11147 test_ret += test_xmlListRemoveFirst();
11148 test_ret += test_xmlListRemoveLast();
11149 test_ret += test_xmlListReverse();
11150 test_ret += test_xmlListReverseSearch();
11151 test_ret += test_xmlListReverseWalk();
11152 test_ret += test_xmlListSearch();
11153 test_ret += test_xmlListSize();
11154 test_ret += test_xmlListSort();
11155 test_ret += test_xmlListWalk();
Daniel Veillardd93f6252004-11-02 15:53:51 +000011156
Daniel Veillard42595322004-11-08 10:52:06 +000011157 if (test_ret != 0)
11158 printf("Module list: %d errors\n", test_ret);
11159 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011160}
11161
11162static int
11163test_xmlNanoFTPCheckResponse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011164 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011165
William M. Brack21e4ef22005-01-02 09:53:13 +000011166#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011167 int mem_base;
11168 int ret_val;
11169 void * ctx; /* an FTP context */
11170 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011171
Daniel Veillard27f20102004-11-05 11:50:11 +000011172 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11173 mem_base = xmlMemBlocks();
11174 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11175
11176 ret_val = xmlNanoFTPCheckResponse(ctx);
11177 desret_int(ret_val);
11178 call_tests++;
11179 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11180 xmlResetLastError();
11181 if (mem_base != xmlMemBlocks()) {
11182 printf("Leak of %d blocks found in xmlNanoFTPCheckResponse",
11183 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011184 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011185 printf(" %d", n_ctx);
11186 printf("\n");
11187 }
11188 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011189 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011190#endif
11191
Daniel Veillard42595322004-11-08 10:52:06 +000011192 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011193}
11194
11195
11196static int
11197test_xmlNanoFTPCleanup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011198 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011199
William M. Brack21e4ef22005-01-02 09:53:13 +000011200#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000011201 int mem_base;
11202
11203 mem_base = xmlMemBlocks();
11204
11205 xmlNanoFTPCleanup();
11206 call_tests++;
11207 xmlResetLastError();
11208 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000011209 printf("Leak of %d blocks found in xmlNanoFTPCleanup",
Daniel Veillardd93f6252004-11-02 15:53:51 +000011210 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011211 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000011212 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000011213 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011214 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011215#endif
11216
Daniel Veillard42595322004-11-08 10:52:06 +000011217 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011218}
11219
11220
11221static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000011222test_xmlNanoFTPCloseConnection(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011223 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011224
William M. Brack21e4ef22005-01-02 09:53:13 +000011225#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011226 int mem_base;
Daniel Veillard27f20102004-11-05 11:50:11 +000011227 int ret_val;
11228 void * ctx; /* an FTP context */
11229 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011230
Daniel Veillard27f20102004-11-05 11:50:11 +000011231 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011232 mem_base = xmlMemBlocks();
Daniel Veillard27f20102004-11-05 11:50:11 +000011233 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011234
Daniel Veillard27f20102004-11-05 11:50:11 +000011235 ret_val = xmlNanoFTPCloseConnection(ctx);
11236 desret_int(ret_val);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011237 call_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011238 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011239 xmlResetLastError();
11240 if (mem_base != xmlMemBlocks()) {
Daniel Veillard27f20102004-11-05 11:50:11 +000011241 printf("Leak of %d blocks found in xmlNanoFTPCloseConnection",
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011242 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011243 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011244 printf(" %d", n_ctx);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011245 printf("\n");
11246 }
11247 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011248 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011249#endif
11250
Daniel Veillard42595322004-11-08 10:52:06 +000011251 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011252}
11253
11254
11255static int
11256test_xmlNanoFTPCwd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011257 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011258
William M. Brack21e4ef22005-01-02 09:53:13 +000011259#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011260 int mem_base;
11261 int ret_val;
11262 void * ctx; /* an FTP context */
11263 int n_ctx;
Daniel Veillardce682bc2004-11-05 17:22:25 +000011264 char * directory; /* a directory on the server */
Daniel Veillard27f20102004-11-05 11:50:11 +000011265 int n_directory;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011266
Daniel Veillard27f20102004-11-05 11:50:11 +000011267 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11268 for (n_directory = 0;n_directory < gen_nb_const_char_ptr;n_directory++) {
11269 mem_base = xmlMemBlocks();
11270 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11271 directory = gen_const_char_ptr(n_directory, 1);
11272
William M. Brackf13f77f2004-11-12 16:03:48 +000011273 ret_val = xmlNanoFTPCwd(ctx, (const char *)directory);
Daniel Veillard27f20102004-11-05 11:50:11 +000011274 desret_int(ret_val);
11275 call_tests++;
11276 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000011277 des_const_char_ptr(n_directory, (const char *)directory, 1);
Daniel Veillard27f20102004-11-05 11:50:11 +000011278 xmlResetLastError();
11279 if (mem_base != xmlMemBlocks()) {
11280 printf("Leak of %d blocks found in xmlNanoFTPCwd",
11281 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011282 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011283 printf(" %d", n_ctx);
11284 printf(" %d", n_directory);
11285 printf("\n");
11286 }
11287 }
11288 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011289 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011290#endif
11291
Daniel Veillard42595322004-11-08 10:52:06 +000011292 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011293}
11294
11295
11296static int
11297test_xmlNanoFTPDele(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011298 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011299
William M. Brack21e4ef22005-01-02 09:53:13 +000011300#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011301 int mem_base;
11302 int ret_val;
11303 void * ctx; /* an FTP context */
11304 int n_ctx;
11305 const char * file; /* a file or directory on the server */
11306 int n_file;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011307
Daniel Veillard27f20102004-11-05 11:50:11 +000011308 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11309 for (n_file = 0;n_file < gen_nb_filepath;n_file++) {
11310 mem_base = xmlMemBlocks();
11311 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11312 file = gen_filepath(n_file, 1);
11313
11314 ret_val = xmlNanoFTPDele(ctx, file);
11315 desret_int(ret_val);
11316 call_tests++;
11317 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11318 des_filepath(n_file, file, 1);
11319 xmlResetLastError();
11320 if (mem_base != xmlMemBlocks()) {
11321 printf("Leak of %d blocks found in xmlNanoFTPDele",
11322 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011323 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011324 printf(" %d", n_ctx);
11325 printf(" %d", n_file);
11326 printf("\n");
11327 }
11328 }
11329 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011330 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011331#endif
11332
Daniel Veillard42595322004-11-08 10:52:06 +000011333 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011334}
11335
11336
11337static int
11338test_xmlNanoFTPGet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011339 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011340
11341
11342 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011343 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011344}
11345
11346
11347static int
11348test_xmlNanoFTPGetConnection(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011349 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011350
William M. Brack21e4ef22005-01-02 09:53:13 +000011351#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011352 int mem_base;
11353 int ret_val;
11354 void * ctx; /* an FTP context */
11355 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011356
Daniel Veillard27f20102004-11-05 11:50:11 +000011357 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11358 mem_base = xmlMemBlocks();
11359 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11360
11361 ret_val = xmlNanoFTPGetConnection(ctx);
11362 desret_int(ret_val);
11363 call_tests++;
11364 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11365 xmlResetLastError();
11366 if (mem_base != xmlMemBlocks()) {
11367 printf("Leak of %d blocks found in xmlNanoFTPGetConnection",
11368 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011369 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011370 printf(" %d", n_ctx);
11371 printf("\n");
11372 }
11373 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011374 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011375#endif
11376
Daniel Veillard42595322004-11-08 10:52:06 +000011377 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011378}
11379
11380
11381static int
11382test_xmlNanoFTPGetResponse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011383 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011384
William M. Brack21e4ef22005-01-02 09:53:13 +000011385#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011386 int mem_base;
11387 int ret_val;
11388 void * ctx; /* an FTP context */
11389 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011390
Daniel Veillard27f20102004-11-05 11:50:11 +000011391 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11392 mem_base = xmlMemBlocks();
11393 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11394
11395 ret_val = xmlNanoFTPGetResponse(ctx);
11396 desret_int(ret_val);
11397 call_tests++;
11398 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11399 xmlResetLastError();
11400 if (mem_base != xmlMemBlocks()) {
11401 printf("Leak of %d blocks found in xmlNanoFTPGetResponse",
11402 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011403 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011404 printf(" %d", n_ctx);
11405 printf("\n");
11406 }
11407 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011408 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011409#endif
11410
Daniel Veillard42595322004-11-08 10:52:06 +000011411 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011412}
11413
11414
11415static int
11416test_xmlNanoFTPGetSocket(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011417 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011418
William M. Brack21e4ef22005-01-02 09:53:13 +000011419#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011420 int mem_base;
11421 int ret_val;
11422 void * ctx; /* an FTP context */
11423 int n_ctx;
11424 const char * filename; /* the file to retrieve (or NULL if path is in context). */
11425 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011426
Daniel Veillard27f20102004-11-05 11:50:11 +000011427 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11428 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
11429 mem_base = xmlMemBlocks();
11430 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11431 filename = gen_filepath(n_filename, 1);
11432
11433 ret_val = xmlNanoFTPGetSocket(ctx, filename);
11434 desret_int(ret_val);
11435 call_tests++;
11436 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11437 des_filepath(n_filename, filename, 1);
11438 xmlResetLastError();
11439 if (mem_base != xmlMemBlocks()) {
11440 printf("Leak of %d blocks found in xmlNanoFTPGetSocket",
11441 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011442 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011443 printf(" %d", n_ctx);
11444 printf(" %d", n_filename);
11445 printf("\n");
11446 }
11447 }
11448 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011449 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011450#endif
11451
Daniel Veillard42595322004-11-08 10:52:06 +000011452 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011453}
11454
11455
11456static int
11457test_xmlNanoFTPInit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011458 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011459
William M. Brack21e4ef22005-01-02 09:53:13 +000011460#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000011461 int mem_base;
11462
11463 mem_base = xmlMemBlocks();
11464
11465 xmlNanoFTPInit();
11466 call_tests++;
11467 xmlResetLastError();
11468 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000011469 printf("Leak of %d blocks found in xmlNanoFTPInit",
Daniel Veillardd93f6252004-11-02 15:53:51 +000011470 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011471 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000011472 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000011473 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011474 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011475#endif
11476
Daniel Veillard42595322004-11-08 10:52:06 +000011477 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011478}
11479
11480
11481static int
11482test_xmlNanoFTPList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011483 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011484
11485
11486 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011487 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011488}
11489
11490
11491static int
11492test_xmlNanoFTPNewCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011493 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011494
11495
11496 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011497 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011498}
11499
11500
11501static int
11502test_xmlNanoFTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011503 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011504
William M. Brack21e4ef22005-01-02 09:53:13 +000011505#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011506 int mem_base;
11507 void * ret_val;
11508 const char * URL; /* the URL to the resource */
11509 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011510
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011511 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
11512 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011513 URL = gen_filepath(n_URL, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011514
11515 ret_val = xmlNanoFTPOpen(URL);
11516 desret_void_ptr(ret_val);
11517 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011518 des_filepath(n_URL, URL, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011519 xmlResetLastError();
11520 if (mem_base != xmlMemBlocks()) {
11521 printf("Leak of %d blocks found in xmlNanoFTPOpen",
11522 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011523 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011524 printf(" %d", n_URL);
11525 printf("\n");
11526 }
11527 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011528 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011529#endif
11530
Daniel Veillard42595322004-11-08 10:52:06 +000011531 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011532}
11533
11534
11535static int
11536test_xmlNanoFTPProxy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011537 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011538
William M. Brack21e4ef22005-01-02 09:53:13 +000011539#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000011540 char * host; /* the proxy host name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000011541 int n_host;
11542 int port; /* the proxy port */
11543 int n_port;
Daniel Veillardce682bc2004-11-05 17:22:25 +000011544 char * user; /* the proxy user name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000011545 int n_user;
Daniel Veillardce682bc2004-11-05 17:22:25 +000011546 char * passwd; /* the proxy password */
Daniel Veillardd93f6252004-11-02 15:53:51 +000011547 int n_passwd;
11548 int type; /* the type of proxy 1 for using SITE, 2 for USER a@b */
11549 int n_type;
11550
11551 for (n_host = 0;n_host < gen_nb_const_char_ptr;n_host++) {
11552 for (n_port = 0;n_port < gen_nb_int;n_port++) {
11553 for (n_user = 0;n_user < gen_nb_const_char_ptr;n_user++) {
11554 for (n_passwd = 0;n_passwd < gen_nb_const_char_ptr;n_passwd++) {
11555 for (n_type = 0;n_type < gen_nb_int;n_type++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +000011556 host = gen_const_char_ptr(n_host, 0);
11557 port = gen_int(n_port, 1);
11558 user = gen_const_char_ptr(n_user, 2);
11559 passwd = gen_const_char_ptr(n_passwd, 3);
11560 type = gen_int(n_type, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011561
William M. Brackf13f77f2004-11-12 16:03:48 +000011562 xmlNanoFTPProxy((const char *)host, port, (const char *)user, (const char *)passwd, type);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011563 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000011564 des_const_char_ptr(n_host, (const char *)host, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000011565 des_int(n_port, port, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000011566 des_const_char_ptr(n_user, (const char *)user, 2);
11567 des_const_char_ptr(n_passwd, (const char *)passwd, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +000011568 des_int(n_type, type, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011569 xmlResetLastError();
11570 }
11571 }
11572 }
11573 }
11574 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011575 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011576#endif
11577
Daniel Veillard42595322004-11-08 10:52:06 +000011578 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011579}
11580
11581
11582static int
11583test_xmlNanoFTPQuit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011584 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011585
William M. Brack21e4ef22005-01-02 09:53:13 +000011586#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011587 int mem_base;
11588 int ret_val;
11589 void * ctx; /* an FTP context */
11590 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011591
Daniel Veillard27f20102004-11-05 11:50:11 +000011592 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11593 mem_base = xmlMemBlocks();
11594 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11595
11596 ret_val = xmlNanoFTPQuit(ctx);
11597 desret_int(ret_val);
11598 call_tests++;
11599 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11600 xmlResetLastError();
11601 if (mem_base != xmlMemBlocks()) {
11602 printf("Leak of %d blocks found in xmlNanoFTPQuit",
11603 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011604 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011605 printf(" %d", n_ctx);
11606 printf("\n");
11607 }
11608 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011609 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011610#endif
11611
Daniel Veillard42595322004-11-08 10:52:06 +000011612 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011613}
11614
11615
11616static int
11617test_xmlNanoFTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011618 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011619
William M. Brack21e4ef22005-01-02 09:53:13 +000011620#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011621 int mem_base;
11622 int ret_val;
11623 void * ctx; /* the FTP context */
11624 int n_ctx;
11625 void * dest; /* a buffer */
11626 int n_dest;
11627 int len; /* the buffer length */
11628 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011629
Daniel Veillard27f20102004-11-05 11:50:11 +000011630 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11631 for (n_dest = 0;n_dest < gen_nb_void_ptr;n_dest++) {
11632 for (n_len = 0;n_len < gen_nb_int;n_len++) {
11633 mem_base = xmlMemBlocks();
11634 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11635 dest = gen_void_ptr(n_dest, 1);
11636 len = gen_int(n_len, 2);
11637
11638 ret_val = xmlNanoFTPRead(ctx, dest, len);
11639 desret_int(ret_val);
11640 call_tests++;
11641 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11642 des_void_ptr(n_dest, dest, 1);
11643 des_int(n_len, len, 2);
11644 xmlResetLastError();
11645 if (mem_base != xmlMemBlocks()) {
11646 printf("Leak of %d blocks found in xmlNanoFTPRead",
11647 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011648 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011649 printf(" %d", n_ctx);
11650 printf(" %d", n_dest);
11651 printf(" %d", n_len);
11652 printf("\n");
11653 }
11654 }
11655 }
11656 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011657 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011658#endif
11659
Daniel Veillard42595322004-11-08 10:52:06 +000011660 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011661}
11662
11663
11664static int
11665test_xmlNanoFTPScanProxy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011666 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011667
William M. Brack21e4ef22005-01-02 09:53:13 +000011668#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000011669 const char * URL; /* The proxy URL used to initialize the proxy context */
11670 int n_URL;
11671
11672 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +000011673 URL = gen_filepath(n_URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011674
11675 xmlNanoFTPScanProxy(URL);
11676 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011677 des_filepath(n_URL, URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011678 xmlResetLastError();
11679 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011680 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011681#endif
11682
Daniel Veillard42595322004-11-08 10:52:06 +000011683 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011684}
11685
11686
11687static int
11688test_xmlNanoFTPUpdateURL(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011689 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011690
William M. Brack21e4ef22005-01-02 09:53:13 +000011691#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011692 int mem_base;
11693 int ret_val;
11694 void * ctx; /* an FTP context */
11695 int n_ctx;
11696 const char * URL; /* The URL used to update the context */
11697 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011698
Daniel Veillard27f20102004-11-05 11:50:11 +000011699 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11700 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
11701 mem_base = xmlMemBlocks();
11702 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11703 URL = gen_filepath(n_URL, 1);
11704
11705 ret_val = xmlNanoFTPUpdateURL(ctx, URL);
11706 desret_int(ret_val);
11707 call_tests++;
11708 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11709 des_filepath(n_URL, URL, 1);
11710 xmlResetLastError();
11711 if (mem_base != xmlMemBlocks()) {
11712 printf("Leak of %d blocks found in xmlNanoFTPUpdateURL",
11713 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011714 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011715 printf(" %d", n_ctx);
11716 printf(" %d", n_URL);
11717 printf("\n");
11718 }
11719 }
11720 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011721 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011722#endif
11723
Daniel Veillard42595322004-11-08 10:52:06 +000011724 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011725}
11726
11727static int
11728test_nanoftp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011729 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011730
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011731 if (quiet == 0) printf("Testing nanoftp : 15 of 22 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000011732 test_ret += test_xmlNanoFTPCheckResponse();
11733 test_ret += test_xmlNanoFTPCleanup();
11734 test_ret += test_xmlNanoFTPCloseConnection();
11735 test_ret += test_xmlNanoFTPCwd();
11736 test_ret += test_xmlNanoFTPDele();
11737 test_ret += test_xmlNanoFTPGet();
11738 test_ret += test_xmlNanoFTPGetConnection();
11739 test_ret += test_xmlNanoFTPGetResponse();
11740 test_ret += test_xmlNanoFTPGetSocket();
11741 test_ret += test_xmlNanoFTPInit();
11742 test_ret += test_xmlNanoFTPList();
11743 test_ret += test_xmlNanoFTPNewCtxt();
11744 test_ret += test_xmlNanoFTPOpen();
11745 test_ret += test_xmlNanoFTPProxy();
11746 test_ret += test_xmlNanoFTPQuit();
11747 test_ret += test_xmlNanoFTPRead();
11748 test_ret += test_xmlNanoFTPScanProxy();
11749 test_ret += test_xmlNanoFTPUpdateURL();
Daniel Veillardd93f6252004-11-02 15:53:51 +000011750
Daniel Veillard42595322004-11-08 10:52:06 +000011751 if (test_ret != 0)
11752 printf("Module nanoftp: %d errors\n", test_ret);
11753 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011754}
11755
11756static int
11757test_xmlNanoHTTPAuthHeader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011758 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011759
William M. Brack21e4ef22005-01-02 09:53:13 +000011760#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011761 int mem_base;
11762 const char * ret_val;
11763 void * ctx; /* the HTTP context */
11764 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011765
Daniel Veillard27f20102004-11-05 11:50:11 +000011766 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
11767 mem_base = xmlMemBlocks();
11768 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
11769
11770 ret_val = xmlNanoHTTPAuthHeader(ctx);
11771 desret_const_char_ptr(ret_val);
11772 call_tests++;
11773 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
11774 xmlResetLastError();
11775 if (mem_base != xmlMemBlocks()) {
11776 printf("Leak of %d blocks found in xmlNanoHTTPAuthHeader",
11777 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011778 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011779 printf(" %d", n_ctx);
11780 printf("\n");
11781 }
11782 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011783 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011784#endif
11785
Daniel Veillard42595322004-11-08 10:52:06 +000011786 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011787}
11788
11789
11790static int
11791test_xmlNanoHTTPCleanup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011792 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011793
William M. Brack21e4ef22005-01-02 09:53:13 +000011794#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000011795 int mem_base;
11796
11797 mem_base = xmlMemBlocks();
11798
11799 xmlNanoHTTPCleanup();
11800 call_tests++;
11801 xmlResetLastError();
11802 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000011803 printf("Leak of %d blocks found in xmlNanoHTTPCleanup",
Daniel Veillardd93f6252004-11-02 15:53:51 +000011804 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011805 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000011806 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000011807 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011808 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011809#endif
11810
Daniel Veillard42595322004-11-08 10:52:06 +000011811 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011812}
11813
11814
11815static int
11816test_xmlNanoHTTPClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011817 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011818
William M. Brack21e4ef22005-01-02 09:53:13 +000011819#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011820 int mem_base;
11821 void * ctx; /* the HTTP context */
11822 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011823
Daniel Veillard27f20102004-11-05 11:50:11 +000011824 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
11825 mem_base = xmlMemBlocks();
11826 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
11827
11828 xmlNanoHTTPClose(ctx);
11829 call_tests++;
11830 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
11831 xmlResetLastError();
11832 if (mem_base != xmlMemBlocks()) {
11833 printf("Leak of %d blocks found in xmlNanoHTTPClose",
11834 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011835 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011836 printf(" %d", n_ctx);
11837 printf("\n");
11838 }
11839 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011840 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011841#endif
11842
Daniel Veillard42595322004-11-08 10:52:06 +000011843 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011844}
11845
11846
11847static int
11848test_xmlNanoHTTPContentLength(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011849 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011850
William M. Brack21e4ef22005-01-02 09:53:13 +000011851#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011852 int mem_base;
11853 int ret_val;
11854 void * ctx; /* the HTTP context */
11855 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011856
Daniel Veillard27f20102004-11-05 11:50:11 +000011857 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
11858 mem_base = xmlMemBlocks();
11859 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
11860
11861 ret_val = xmlNanoHTTPContentLength(ctx);
11862 desret_int(ret_val);
11863 call_tests++;
11864 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
11865 xmlResetLastError();
11866 if (mem_base != xmlMemBlocks()) {
11867 printf("Leak of %d blocks found in xmlNanoHTTPContentLength",
11868 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011869 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011870 printf(" %d", n_ctx);
11871 printf("\n");
11872 }
11873 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011874 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011875#endif
11876
Daniel Veillard42595322004-11-08 10:52:06 +000011877 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011878}
11879
11880
11881static int
11882test_xmlNanoHTTPEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011883 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011884
William M. Brack21e4ef22005-01-02 09:53:13 +000011885#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011886 int mem_base;
11887 const char * ret_val;
11888 void * ctx; /* the HTTP context */
11889 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011890
Daniel Veillard27f20102004-11-05 11:50:11 +000011891 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
11892 mem_base = xmlMemBlocks();
11893 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
11894
11895 ret_val = xmlNanoHTTPEncoding(ctx);
11896 desret_const_char_ptr(ret_val);
11897 call_tests++;
11898 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
11899 xmlResetLastError();
11900 if (mem_base != xmlMemBlocks()) {
11901 printf("Leak of %d blocks found in xmlNanoHTTPEncoding",
11902 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011903 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011904 printf(" %d", n_ctx);
11905 printf("\n");
11906 }
11907 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011908 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011909#endif
11910
Daniel Veillard42595322004-11-08 10:52:06 +000011911 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011912}
11913
11914
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000011915#define gen_nb_char_ptr_ptr 1
11916static char ** gen_char_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
11917 return(NULL);
11918}
11919static void des_char_ptr_ptr(int no ATTRIBUTE_UNUSED, char ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
11920}
11921
Daniel Veillardd93f6252004-11-02 15:53:51 +000011922static int
11923test_xmlNanoHTTPFetch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011924 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011925
William M. Brack21e4ef22005-01-02 09:53:13 +000011926#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000011927 int mem_base;
11928 int ret_val;
11929 const char * URL; /* The URL to load */
11930 int n_URL;
11931 const char * filename; /* the filename where the content should be saved */
11932 int n_filename;
11933 char ** contentType; /* if available the Content-Type information will be returned at that location */
11934 int n_contentType;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011935
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000011936 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
11937 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
11938 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
11939 mem_base = xmlMemBlocks();
11940 URL = gen_filepath(n_URL, 0);
11941 filename = gen_filepath(n_filename, 1);
11942 contentType = gen_char_ptr_ptr(n_contentType, 2);
11943
11944 ret_val = xmlNanoHTTPFetch(URL, filename, contentType);
11945 desret_int(ret_val);
11946 call_tests++;
11947 des_filepath(n_URL, URL, 0);
11948 des_filepath(n_filename, filename, 1);
11949 des_char_ptr_ptr(n_contentType, contentType, 2);
11950 xmlResetLastError();
11951 if (mem_base != xmlMemBlocks()) {
11952 printf("Leak of %d blocks found in xmlNanoHTTPFetch",
11953 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011954 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000011955 printf(" %d", n_URL);
11956 printf(" %d", n_filename);
11957 printf(" %d", n_contentType);
11958 printf("\n");
11959 }
11960 }
11961 }
11962 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011963 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000011964#endif
11965
Daniel Veillard42595322004-11-08 10:52:06 +000011966 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011967}
11968
11969
11970static int
11971test_xmlNanoHTTPInit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011972 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011973
William M. Brack21e4ef22005-01-02 09:53:13 +000011974#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000011975 int mem_base;
11976
11977 mem_base = xmlMemBlocks();
11978
11979 xmlNanoHTTPInit();
11980 call_tests++;
11981 xmlResetLastError();
11982 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000011983 printf("Leak of %d blocks found in xmlNanoHTTPInit",
Daniel Veillardd93f6252004-11-02 15:53:51 +000011984 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011985 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000011986 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000011987 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011988 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011989#endif
11990
Daniel Veillard42595322004-11-08 10:52:06 +000011991 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011992}
11993
11994
11995static int
11996test_xmlNanoHTTPMethod(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011997 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011998
William M. Brack21e4ef22005-01-02 09:53:13 +000011999#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012000 int mem_base;
12001 void * ret_val;
12002 const char * URL; /* The URL to load */
12003 int n_URL;
12004 char * method; /* the HTTP method to use */
12005 int n_method;
12006 char * input; /* the input string if any */
12007 int n_input;
12008 char ** contentType; /* the Content-Type information IN and OUT */
12009 int n_contentType;
12010 char * headers; /* the extra headers */
12011 int n_headers;
12012 int ilen; /* input length */
12013 int n_ilen;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012014
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012015 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12016 for (n_method = 0;n_method < gen_nb_const_char_ptr;n_method++) {
12017 for (n_input = 0;n_input < gen_nb_const_char_ptr;n_input++) {
12018 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
12019 for (n_headers = 0;n_headers < gen_nb_const_char_ptr;n_headers++) {
12020 for (n_ilen = 0;n_ilen < gen_nb_int;n_ilen++) {
12021 mem_base = xmlMemBlocks();
12022 URL = gen_filepath(n_URL, 0);
12023 method = gen_const_char_ptr(n_method, 1);
12024 input = gen_const_char_ptr(n_input, 2);
12025 contentType = gen_char_ptr_ptr(n_contentType, 3);
12026 headers = gen_const_char_ptr(n_headers, 4);
12027 ilen = gen_int(n_ilen, 5);
12028
William M. Brackf13f77f2004-11-12 16:03:48 +000012029 ret_val = xmlNanoHTTPMethod(URL, (const char *)method, (const char *)input, contentType, (const char *)headers, ilen);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012030 desret_void_ptr(ret_val);
12031 call_tests++;
12032 des_filepath(n_URL, URL, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000012033 des_const_char_ptr(n_method, (const char *)method, 1);
12034 des_const_char_ptr(n_input, (const char *)input, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012035 des_char_ptr_ptr(n_contentType, contentType, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000012036 des_const_char_ptr(n_headers, (const char *)headers, 4);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012037 des_int(n_ilen, ilen, 5);
12038 xmlResetLastError();
12039 if (mem_base != xmlMemBlocks()) {
12040 printf("Leak of %d blocks found in xmlNanoHTTPMethod",
12041 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012042 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012043 printf(" %d", n_URL);
12044 printf(" %d", n_method);
12045 printf(" %d", n_input);
12046 printf(" %d", n_contentType);
12047 printf(" %d", n_headers);
12048 printf(" %d", n_ilen);
12049 printf("\n");
12050 }
12051 }
12052 }
12053 }
12054 }
12055 }
12056 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012057 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012058#endif
12059
Daniel Veillard42595322004-11-08 10:52:06 +000012060 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012061}
12062
12063
12064static int
12065test_xmlNanoHTTPMethodRedir(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012066 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012067
William M. Brack21e4ef22005-01-02 09:53:13 +000012068#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012069 int mem_base;
12070 void * ret_val;
12071 const char * URL; /* The URL to load */
12072 int n_URL;
12073 char * method; /* the HTTP method to use */
12074 int n_method;
12075 char * input; /* the input string if any */
12076 int n_input;
12077 char ** contentType; /* the Content-Type information IN and OUT */
12078 int n_contentType;
12079 char ** redir; /* the redirected URL OUT */
12080 int n_redir;
12081 char * headers; /* the extra headers */
12082 int n_headers;
12083 int ilen; /* input length */
12084 int n_ilen;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012085
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012086 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12087 for (n_method = 0;n_method < gen_nb_const_char_ptr;n_method++) {
12088 for (n_input = 0;n_input < gen_nb_const_char_ptr;n_input++) {
12089 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
12090 for (n_redir = 0;n_redir < gen_nb_char_ptr_ptr;n_redir++) {
12091 for (n_headers = 0;n_headers < gen_nb_const_char_ptr;n_headers++) {
12092 for (n_ilen = 0;n_ilen < gen_nb_int;n_ilen++) {
12093 mem_base = xmlMemBlocks();
12094 URL = gen_filepath(n_URL, 0);
12095 method = gen_const_char_ptr(n_method, 1);
12096 input = gen_const_char_ptr(n_input, 2);
12097 contentType = gen_char_ptr_ptr(n_contentType, 3);
12098 redir = gen_char_ptr_ptr(n_redir, 4);
12099 headers = gen_const_char_ptr(n_headers, 5);
12100 ilen = gen_int(n_ilen, 6);
12101
William M. Brackf13f77f2004-11-12 16:03:48 +000012102 ret_val = xmlNanoHTTPMethodRedir(URL, (const char *)method, (const char *)input, contentType, redir, (const char *)headers, ilen);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012103 desret_void_ptr(ret_val);
12104 call_tests++;
12105 des_filepath(n_URL, URL, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000012106 des_const_char_ptr(n_method, (const char *)method, 1);
12107 des_const_char_ptr(n_input, (const char *)input, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012108 des_char_ptr_ptr(n_contentType, contentType, 3);
12109 des_char_ptr_ptr(n_redir, redir, 4);
William M. Brackf13f77f2004-11-12 16:03:48 +000012110 des_const_char_ptr(n_headers, (const char *)headers, 5);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012111 des_int(n_ilen, ilen, 6);
12112 xmlResetLastError();
12113 if (mem_base != xmlMemBlocks()) {
12114 printf("Leak of %d blocks found in xmlNanoHTTPMethodRedir",
12115 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012116 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012117 printf(" %d", n_URL);
12118 printf(" %d", n_method);
12119 printf(" %d", n_input);
12120 printf(" %d", n_contentType);
12121 printf(" %d", n_redir);
12122 printf(" %d", n_headers);
12123 printf(" %d", n_ilen);
12124 printf("\n");
12125 }
12126 }
12127 }
12128 }
12129 }
12130 }
12131 }
12132 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012133 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012134#endif
12135
Daniel Veillard42595322004-11-08 10:52:06 +000012136 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012137}
12138
12139
12140static int
12141test_xmlNanoHTTPMimeType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012142 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012143
William M. Brack21e4ef22005-01-02 09:53:13 +000012144#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000012145 int mem_base;
12146 const char * ret_val;
12147 void * ctx; /* the HTTP context */
12148 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012149
Daniel Veillard27f20102004-11-05 11:50:11 +000012150 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
12151 mem_base = xmlMemBlocks();
12152 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
12153
12154 ret_val = xmlNanoHTTPMimeType(ctx);
12155 desret_const_char_ptr(ret_val);
12156 call_tests++;
12157 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
12158 xmlResetLastError();
12159 if (mem_base != xmlMemBlocks()) {
12160 printf("Leak of %d blocks found in xmlNanoHTTPMimeType",
12161 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012162 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012163 printf(" %d", n_ctx);
12164 printf("\n");
12165 }
12166 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012167 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012168#endif
12169
Daniel Veillard42595322004-11-08 10:52:06 +000012170 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012171}
12172
12173
12174static int
12175test_xmlNanoHTTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012176 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012177
William M. Brack21e4ef22005-01-02 09:53:13 +000012178#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012179 int mem_base;
12180 void * ret_val;
12181 const char * URL; /* The URL to load */
12182 int n_URL;
12183 char ** contentType; /* if available the Content-Type information will be returned at that location */
12184 int n_contentType;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012185
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012186 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12187 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
12188 mem_base = xmlMemBlocks();
12189 URL = gen_filepath(n_URL, 0);
12190 contentType = gen_char_ptr_ptr(n_contentType, 1);
12191
12192 ret_val = xmlNanoHTTPOpen(URL, contentType);
12193 desret_void_ptr(ret_val);
12194 call_tests++;
12195 des_filepath(n_URL, URL, 0);
12196 des_char_ptr_ptr(n_contentType, contentType, 1);
12197 xmlResetLastError();
12198 if (mem_base != xmlMemBlocks()) {
12199 printf("Leak of %d blocks found in xmlNanoHTTPOpen",
12200 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012201 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012202 printf(" %d", n_URL);
12203 printf(" %d", n_contentType);
12204 printf("\n");
12205 }
12206 }
12207 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012208 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012209#endif
12210
Daniel Veillard42595322004-11-08 10:52:06 +000012211 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012212}
12213
12214
12215static int
12216test_xmlNanoHTTPOpenRedir(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012217 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012218
William M. Brack21e4ef22005-01-02 09:53:13 +000012219#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012220 int mem_base;
12221 void * ret_val;
12222 const char * URL; /* The URL to load */
12223 int n_URL;
12224 char ** contentType; /* if available the Content-Type information will be returned at that location */
12225 int n_contentType;
12226 char ** redir; /* if available the redirected URL will be returned */
12227 int n_redir;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012228
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012229 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12230 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
12231 for (n_redir = 0;n_redir < gen_nb_char_ptr_ptr;n_redir++) {
12232 mem_base = xmlMemBlocks();
12233 URL = gen_filepath(n_URL, 0);
12234 contentType = gen_char_ptr_ptr(n_contentType, 1);
12235 redir = gen_char_ptr_ptr(n_redir, 2);
12236
12237 ret_val = xmlNanoHTTPOpenRedir(URL, contentType, redir);
12238 desret_void_ptr(ret_val);
12239 call_tests++;
12240 des_filepath(n_URL, URL, 0);
12241 des_char_ptr_ptr(n_contentType, contentType, 1);
12242 des_char_ptr_ptr(n_redir, redir, 2);
12243 xmlResetLastError();
12244 if (mem_base != xmlMemBlocks()) {
12245 printf("Leak of %d blocks found in xmlNanoHTTPOpenRedir",
12246 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012247 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012248 printf(" %d", n_URL);
12249 printf(" %d", n_contentType);
12250 printf(" %d", n_redir);
12251 printf("\n");
12252 }
12253 }
12254 }
12255 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012256 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012257#endif
12258
Daniel Veillard42595322004-11-08 10:52:06 +000012259 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012260}
12261
12262
12263static int
12264test_xmlNanoHTTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012265 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012266
William M. Brack21e4ef22005-01-02 09:53:13 +000012267#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000012268 int mem_base;
12269 int ret_val;
12270 void * ctx; /* the HTTP context */
12271 int n_ctx;
12272 void * dest; /* a buffer */
12273 int n_dest;
12274 int len; /* the buffer length */
12275 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012276
Daniel Veillard27f20102004-11-05 11:50:11 +000012277 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
12278 for (n_dest = 0;n_dest < gen_nb_void_ptr;n_dest++) {
12279 for (n_len = 0;n_len < gen_nb_int;n_len++) {
12280 mem_base = xmlMemBlocks();
12281 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
12282 dest = gen_void_ptr(n_dest, 1);
12283 len = gen_int(n_len, 2);
12284
12285 ret_val = xmlNanoHTTPRead(ctx, dest, len);
12286 desret_int(ret_val);
12287 call_tests++;
12288 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
12289 des_void_ptr(n_dest, dest, 1);
12290 des_int(n_len, len, 2);
12291 xmlResetLastError();
12292 if (mem_base != xmlMemBlocks()) {
12293 printf("Leak of %d blocks found in xmlNanoHTTPRead",
12294 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012295 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012296 printf(" %d", n_ctx);
12297 printf(" %d", n_dest);
12298 printf(" %d", n_len);
12299 printf("\n");
12300 }
12301 }
12302 }
12303 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012304 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012305#endif
12306
Daniel Veillard42595322004-11-08 10:52:06 +000012307 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012308}
12309
12310
12311static int
12312test_xmlNanoHTTPRedir(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012313 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012314
12315
12316 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000012317 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012318}
12319
12320
12321static int
12322test_xmlNanoHTTPReturnCode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012323 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012324
William M. Brack21e4ef22005-01-02 09:53:13 +000012325#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000012326 int mem_base;
12327 int ret_val;
12328 void * ctx; /* the HTTP context */
12329 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012330
Daniel Veillard27f20102004-11-05 11:50:11 +000012331 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
12332 mem_base = xmlMemBlocks();
12333 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
12334
12335 ret_val = xmlNanoHTTPReturnCode(ctx);
12336 desret_int(ret_val);
12337 call_tests++;
12338 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
12339 xmlResetLastError();
12340 if (mem_base != xmlMemBlocks()) {
12341 printf("Leak of %d blocks found in xmlNanoHTTPReturnCode",
12342 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012343 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012344 printf(" %d", n_ctx);
12345 printf("\n");
12346 }
12347 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012348 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012349#endif
12350
Daniel Veillard42595322004-11-08 10:52:06 +000012351 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012352}
12353
12354
12355static int
12356test_xmlNanoHTTPSave(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012357 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012358
William M. Brack21e4ef22005-01-02 09:53:13 +000012359#if defined(LIBXML_HTTP_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012360 int mem_base;
12361 int ret_val;
12362 void * ctxt; /* the HTTP context */
12363 int n_ctxt;
12364 const char * filename; /* the filename where the content should be saved */
12365 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012366
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012367 for (n_ctxt = 0;n_ctxt < gen_nb_void_ptr;n_ctxt++) {
12368 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
12369 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012370 ctxt = gen_void_ptr(n_ctxt, 0);
12371 filename = gen_fileoutput(n_filename, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012372
12373 ret_val = xmlNanoHTTPSave(ctxt, filename);
12374 desret_int(ret_val);
12375 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012376 des_void_ptr(n_ctxt, ctxt, 0);
12377 des_fileoutput(n_filename, filename, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012378 xmlResetLastError();
12379 if (mem_base != xmlMemBlocks()) {
12380 printf("Leak of %d blocks found in xmlNanoHTTPSave",
12381 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012382 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012383 printf(" %d", n_ctxt);
12384 printf(" %d", n_filename);
12385 printf("\n");
12386 }
12387 }
12388 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012389 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012390#endif
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012391
Daniel Veillard42595322004-11-08 10:52:06 +000012392 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012393}
12394
12395
12396static int
12397test_xmlNanoHTTPScanProxy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012398 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012399
William M. Brack21e4ef22005-01-02 09:53:13 +000012400#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000012401 const char * URL; /* The proxy URL used to initialize the proxy context */
12402 int n_URL;
12403
12404 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +000012405 URL = gen_filepath(n_URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012406
12407 xmlNanoHTTPScanProxy(URL);
12408 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012409 des_filepath(n_URL, URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012410 xmlResetLastError();
12411 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012412 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012413#endif
12414
Daniel Veillard42595322004-11-08 10:52:06 +000012415 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012416}
12417
12418static int
12419test_nanohttp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012420 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012421
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012422 if (quiet == 0) printf("Testing nanohttp : 16 of 17 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000012423 test_ret += test_xmlNanoHTTPAuthHeader();
12424 test_ret += test_xmlNanoHTTPCleanup();
12425 test_ret += test_xmlNanoHTTPClose();
12426 test_ret += test_xmlNanoHTTPContentLength();
12427 test_ret += test_xmlNanoHTTPEncoding();
12428 test_ret += test_xmlNanoHTTPFetch();
12429 test_ret += test_xmlNanoHTTPInit();
12430 test_ret += test_xmlNanoHTTPMethod();
12431 test_ret += test_xmlNanoHTTPMethodRedir();
12432 test_ret += test_xmlNanoHTTPMimeType();
12433 test_ret += test_xmlNanoHTTPOpen();
12434 test_ret += test_xmlNanoHTTPOpenRedir();
12435 test_ret += test_xmlNanoHTTPRead();
12436 test_ret += test_xmlNanoHTTPRedir();
12437 test_ret += test_xmlNanoHTTPReturnCode();
12438 test_ret += test_xmlNanoHTTPSave();
12439 test_ret += test_xmlNanoHTTPScanProxy();
Daniel Veillardd93f6252004-11-02 15:53:51 +000012440
Daniel Veillard42595322004-11-08 10:52:06 +000012441 if (test_ret != 0)
12442 printf("Module nanohttp: %d errors\n", test_ret);
12443 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012444}
12445
12446static int
12447test_xmlByteConsumed(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012448 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012449
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000012450 int mem_base;
12451 long ret_val;
12452 xmlParserCtxtPtr ctxt; /* an XML parser context */
12453 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012454
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000012455 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12456 mem_base = xmlMemBlocks();
12457 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12458
12459 ret_val = xmlByteConsumed(ctxt);
12460 desret_long(ret_val);
12461 call_tests++;
12462 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
12463 xmlResetLastError();
12464 if (mem_base != xmlMemBlocks()) {
12465 printf("Leak of %d blocks found in xmlByteConsumed",
12466 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012467 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000012468 printf(" %d", n_ctxt);
12469 printf("\n");
12470 }
12471 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000012472 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012473
Daniel Veillard42595322004-11-08 10:52:06 +000012474 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012475}
12476
12477
12478static int
12479test_xmlClearNodeInfoSeq(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012480 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012481
Daniel Veillardce682bc2004-11-05 17:22:25 +000012482 int mem_base;
12483 xmlParserNodeInfoSeqPtr seq; /* a node info sequence pointer */
12484 int n_seq;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012485
Daniel Veillardce682bc2004-11-05 17:22:25 +000012486 for (n_seq = 0;n_seq < gen_nb_xmlParserNodeInfoSeqPtr;n_seq++) {
12487 mem_base = xmlMemBlocks();
12488 seq = gen_xmlParserNodeInfoSeqPtr(n_seq, 0);
12489
12490 xmlClearNodeInfoSeq(seq);
12491 call_tests++;
12492 des_xmlParserNodeInfoSeqPtr(n_seq, seq, 0);
12493 xmlResetLastError();
12494 if (mem_base != xmlMemBlocks()) {
12495 printf("Leak of %d blocks found in xmlClearNodeInfoSeq",
12496 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012497 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012498 printf(" %d", n_seq);
12499 printf("\n");
12500 }
12501 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000012502 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012503
Daniel Veillard42595322004-11-08 10:52:06 +000012504 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012505}
12506
12507
12508static int
12509test_xmlClearParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012510 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012511
12512 int mem_base;
12513 xmlParserCtxtPtr ctxt; /* an XML parser context */
12514 int n_ctxt;
12515
12516 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12517 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012518 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012519
12520 xmlClearParserCtxt(ctxt);
12521 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012522 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012523 xmlResetLastError();
12524 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012525 printf("Leak of %d blocks found in xmlClearParserCtxt",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012526 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012527 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012528 printf(" %d", n_ctxt);
12529 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012530 }
12531 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012532 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012533
Daniel Veillard42595322004-11-08 10:52:06 +000012534 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012535}
12536
12537
12538static int
12539test_xmlCreateDocParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012540 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012541
Daniel Veillard34099b42004-11-04 17:34:35 +000012542 int mem_base;
12543 xmlParserCtxtPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012544 xmlChar * cur; /* a pointer to an array of xmlChar */
Daniel Veillard34099b42004-11-04 17:34:35 +000012545 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012546
Daniel Veillard34099b42004-11-04 17:34:35 +000012547 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
12548 mem_base = xmlMemBlocks();
12549 cur = gen_const_xmlChar_ptr(n_cur, 0);
12550
William M. Brackf13f77f2004-11-12 16:03:48 +000012551 ret_val = xmlCreateDocParserCtxt((const xmlChar *)cur);
Daniel Veillard34099b42004-11-04 17:34:35 +000012552 desret_xmlParserCtxtPtr(ret_val);
12553 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000012554 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard34099b42004-11-04 17:34:35 +000012555 xmlResetLastError();
12556 if (mem_base != xmlMemBlocks()) {
12557 printf("Leak of %d blocks found in xmlCreateDocParserCtxt",
12558 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012559 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000012560 printf(" %d", n_cur);
12561 printf("\n");
12562 }
12563 }
Daniel Veillard34099b42004-11-04 17:34:35 +000012564 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012565
Daniel Veillard42595322004-11-08 10:52:06 +000012566 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012567}
12568
12569
12570static int
12571test_xmlCreatePushParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012572 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012573
William M. Brack21e4ef22005-01-02 09:53:13 +000012574#if defined(LIBXML_PUSH_ENABLED)
Daniel Veillard34099b42004-11-04 17:34:35 +000012575 int mem_base;
12576 xmlParserCtxtPtr ret_val;
12577 xmlSAXHandlerPtr sax; /* a SAX handler */
12578 int n_sax;
12579 void * user_data; /* The user data returned on SAX callbacks */
12580 int n_user_data;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012581 char * chunk; /* a pointer to an array of chars */
Daniel Veillard34099b42004-11-04 17:34:35 +000012582 int n_chunk;
12583 int size; /* number of chars in the array */
12584 int n_size;
12585 const char * filename; /* an optional file name or URI */
12586 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012587
Daniel Veillard34099b42004-11-04 17:34:35 +000012588 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
12589 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
12590 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
12591 for (n_size = 0;n_size < gen_nb_int;n_size++) {
Daniel Veillard42595322004-11-08 10:52:06 +000012592 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
Daniel Veillard34099b42004-11-04 17:34:35 +000012593 mem_base = xmlMemBlocks();
12594 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
12595 user_data = gen_userdata(n_user_data, 1);
12596 chunk = gen_const_char_ptr(n_chunk, 2);
12597 size = gen_int(n_size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000012598 filename = gen_fileoutput(n_filename, 4);
Daniel Veillard34099b42004-11-04 17:34:35 +000012599
William M. Brackf13f77f2004-11-12 16:03:48 +000012600 ret_val = xmlCreatePushParserCtxt(sax, user_data, (const char *)chunk, size, filename);
Daniel Veillard34099b42004-11-04 17:34:35 +000012601 desret_xmlParserCtxtPtr(ret_val);
12602 call_tests++;
12603 des_xmlSAXHandlerPtr(n_sax, sax, 0);
12604 des_userdata(n_user_data, user_data, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000012605 des_const_char_ptr(n_chunk, (const char *)chunk, 2);
Daniel Veillard34099b42004-11-04 17:34:35 +000012606 des_int(n_size, size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000012607 des_fileoutput(n_filename, filename, 4);
Daniel Veillard34099b42004-11-04 17:34:35 +000012608 xmlResetLastError();
12609 if (mem_base != xmlMemBlocks()) {
12610 printf("Leak of %d blocks found in xmlCreatePushParserCtxt",
12611 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012612 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000012613 printf(" %d", n_sax);
12614 printf(" %d", n_user_data);
12615 printf(" %d", n_chunk);
12616 printf(" %d", n_size);
12617 printf(" %d", n_filename);
12618 printf("\n");
12619 }
12620 }
12621 }
12622 }
12623 }
12624 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012625 function_tests++;
Daniel Veillard34099b42004-11-04 17:34:35 +000012626#endif
12627
Daniel Veillard42595322004-11-08 10:52:06 +000012628 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012629}
12630
12631
12632static int
12633test_xmlCtxtReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012634 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012635
12636 int mem_base;
12637 xmlDocPtr ret_val;
12638 xmlParserCtxtPtr ctxt; /* an XML parser context */
12639 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012640 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012641 int n_cur;
12642 const char * URL; /* the base URL to use for the document */
12643 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012644 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012645 int n_encoding;
12646 int options; /* a combination of xmlParserOption */
12647 int n_options;
12648
12649 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12650 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
12651 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12652 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000012653 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000012654 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012655 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12656 cur = gen_const_xmlChar_ptr(n_cur, 1);
12657 URL = gen_filepath(n_URL, 2);
12658 encoding = gen_const_char_ptr(n_encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000012659 options = gen_parseroptions(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012660
William M. Brackf13f77f2004-11-12 16:03:48 +000012661 ret_val = xmlCtxtReadDoc(ctxt, (const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012662 desret_xmlDocPtr(ret_val);
12663 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012664 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000012665 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000012666 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000012667 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000012668 des_parseroptions(n_options, options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012669 xmlResetLastError();
12670 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012671 printf("Leak of %d blocks found in xmlCtxtReadDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012672 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012673 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012674 printf(" %d", n_ctxt);
12675 printf(" %d", n_cur);
12676 printf(" %d", n_URL);
12677 printf(" %d", n_encoding);
12678 printf(" %d", n_options);
12679 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012680 }
12681 }
12682 }
12683 }
12684 }
12685 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012686 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012687
Daniel Veillard42595322004-11-08 10:52:06 +000012688 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012689}
12690
12691
12692static int
12693test_xmlCtxtReadFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012694 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012695
12696 int mem_base;
12697 xmlDocPtr ret_val;
12698 xmlParserCtxtPtr ctxt; /* an XML parser context */
12699 int n_ctxt;
12700 const char * filename; /* a file or URL */
12701 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012702 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012703 int n_encoding;
12704 int options; /* a combination of xmlParserOption */
12705 int n_options;
12706
12707 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12708 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
12709 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000012710 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000012711 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012712 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12713 filename = gen_filepath(n_filename, 1);
12714 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000012715 options = gen_parseroptions(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012716
William M. Brackf13f77f2004-11-12 16:03:48 +000012717 ret_val = xmlCtxtReadFile(ctxt, filename, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012718 desret_xmlDocPtr(ret_val);
12719 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012720 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
12721 des_filepath(n_filename, filename, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000012722 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000012723 des_parseroptions(n_options, options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012724 xmlResetLastError();
12725 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012726 printf("Leak of %d blocks found in xmlCtxtReadFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012727 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012728 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012729 printf(" %d", n_ctxt);
12730 printf(" %d", n_filename);
12731 printf(" %d", n_encoding);
12732 printf(" %d", n_options);
12733 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012734 }
12735 }
12736 }
12737 }
12738 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012739 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012740
Daniel Veillard42595322004-11-08 10:52:06 +000012741 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012742}
12743
12744
12745static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000012746test_xmlCtxtReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012747 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012748
12749 int mem_base;
12750 xmlDocPtr ret_val;
12751 xmlParserCtxtPtr ctxt; /* an XML parser context */
12752 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012753 char * buffer; /* a pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012754 int n_buffer;
12755 int size; /* the size of the array */
12756 int n_size;
12757 const char * URL; /* the base URL to use for the document */
12758 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012759 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012760 int n_encoding;
12761 int options; /* a combination of xmlParserOption */
12762 int n_options;
12763
12764 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12765 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
12766 for (n_size = 0;n_size < gen_nb_int;n_size++) {
12767 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12768 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000012769 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000012770 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012771 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12772 buffer = gen_const_char_ptr(n_buffer, 1);
12773 size = gen_int(n_size, 2);
12774 URL = gen_filepath(n_URL, 3);
12775 encoding = gen_const_char_ptr(n_encoding, 4);
Daniel Veillard6128c012004-11-08 17:16:15 +000012776 options = gen_parseroptions(n_options, 5);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012777
William M. Brackf13f77f2004-11-12 16:03:48 +000012778 ret_val = xmlCtxtReadMemory(ctxt, (const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012779 desret_xmlDocPtr(ret_val);
12780 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012781 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000012782 des_const_char_ptr(n_buffer, (const char *)buffer, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000012783 des_int(n_size, size, 2);
12784 des_filepath(n_URL, URL, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000012785 des_const_char_ptr(n_encoding, (const char *)encoding, 4);
Daniel Veillard6128c012004-11-08 17:16:15 +000012786 des_parseroptions(n_options, options, 5);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012787 xmlResetLastError();
12788 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012789 printf("Leak of %d blocks found in xmlCtxtReadMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012790 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012791 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012792 printf(" %d", n_ctxt);
12793 printf(" %d", n_buffer);
12794 printf(" %d", n_size);
12795 printf(" %d", n_URL);
12796 printf(" %d", n_encoding);
12797 printf(" %d", n_options);
12798 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012799 }
12800 }
12801 }
12802 }
12803 }
12804 }
12805 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012806 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012807
Daniel Veillard42595322004-11-08 10:52:06 +000012808 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012809}
12810
12811
12812static int
12813test_xmlCtxtReset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012814 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012815
12816 int mem_base;
12817 xmlParserCtxtPtr ctxt; /* an XML parser context */
12818 int n_ctxt;
12819
12820 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12821 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012822 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012823
12824 xmlCtxtReset(ctxt);
12825 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012826 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012827 xmlResetLastError();
12828 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012829 printf("Leak of %d blocks found in xmlCtxtReset",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012830 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012831 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012832 printf(" %d", n_ctxt);
12833 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012834 }
12835 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012836 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012837
Daniel Veillard42595322004-11-08 10:52:06 +000012838 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012839}
12840
12841
12842static int
12843test_xmlCtxtResetPush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012844 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012845
12846 int mem_base;
12847 int ret_val;
12848 xmlParserCtxtPtr ctxt; /* an XML parser context */
12849 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012850 char * chunk; /* a pointer to an array of chars */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012851 int n_chunk;
12852 int size; /* number of chars in the array */
12853 int n_size;
12854 const char * filename; /* an optional file name or URI */
12855 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012856 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012857 int n_encoding;
12858
12859 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12860 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
12861 for (n_size = 0;n_size < gen_nb_int;n_size++) {
12862 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
12863 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
12864 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012865 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12866 chunk = gen_const_char_ptr(n_chunk, 1);
12867 size = gen_int(n_size, 2);
12868 filename = gen_filepath(n_filename, 3);
12869 encoding = gen_const_char_ptr(n_encoding, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012870
William M. Brackf13f77f2004-11-12 16:03:48 +000012871 ret_val = xmlCtxtResetPush(ctxt, (const char *)chunk, size, filename, (const char *)encoding);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012872 desret_int(ret_val);
12873 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012874 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000012875 des_const_char_ptr(n_chunk, (const char *)chunk, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000012876 des_int(n_size, size, 2);
12877 des_filepath(n_filename, filename, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000012878 des_const_char_ptr(n_encoding, (const char *)encoding, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012879 xmlResetLastError();
12880 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012881 printf("Leak of %d blocks found in xmlCtxtResetPush",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012882 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012883 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012884 printf(" %d", n_ctxt);
12885 printf(" %d", n_chunk);
12886 printf(" %d", n_size);
12887 printf(" %d", n_filename);
12888 printf(" %d", n_encoding);
12889 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012890 }
12891 }
12892 }
12893 }
12894 }
12895 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012896 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012897
Daniel Veillard42595322004-11-08 10:52:06 +000012898 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012899}
12900
12901
12902static int
12903test_xmlCtxtUseOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012904 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012905
12906 int mem_base;
12907 int ret_val;
12908 xmlParserCtxtPtr ctxt; /* an XML parser context */
12909 int n_ctxt;
12910 int options; /* a combination of xmlParserOption */
12911 int n_options;
12912
12913 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000012914 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000012915 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012916 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard6128c012004-11-08 17:16:15 +000012917 options = gen_parseroptions(n_options, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012918
12919 ret_val = xmlCtxtUseOptions(ctxt, options);
12920 desret_int(ret_val);
12921 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012922 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillard6128c012004-11-08 17:16:15 +000012923 des_parseroptions(n_options, options, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012924 xmlResetLastError();
12925 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012926 printf("Leak of %d blocks found in xmlCtxtUseOptions",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012927 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012928 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012929 printf(" %d", n_ctxt);
12930 printf(" %d", n_options);
12931 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012932 }
12933 }
12934 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012935 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012936
Daniel Veillard42595322004-11-08 10:52:06 +000012937 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012938}
12939
12940
12941static int
12942test_xmlGetExternalEntityLoader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012943 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012944
12945
12946 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000012947 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012948}
12949
12950
12951static int
12952test_xmlGetFeature(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012953 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012954
William M. Brack21e4ef22005-01-02 09:53:13 +000012955#if defined(LIBXML_LEGACY_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000012956#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012957 int mem_base;
12958 int ret_val;
12959 xmlParserCtxtPtr ctxt; /* an XML/HTML parser context */
12960 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012961 char * name; /* the feature name */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012962 int n_name;
12963 void * result; /* location to store the result */
12964 int n_result;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012965
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012966 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12967 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
12968 for (n_result = 0;n_result < gen_nb_void_ptr;n_result++) {
12969 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012970 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12971 name = gen_const_char_ptr(n_name, 1);
12972 result = gen_void_ptr(n_result, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012973
William M. Brackf13f77f2004-11-12 16:03:48 +000012974 ret_val = xmlGetFeature(ctxt, (const char *)name, result);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012975 desret_int(ret_val);
12976 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012977 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000012978 des_const_char_ptr(n_name, (const char *)name, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000012979 des_void_ptr(n_result, result, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012980 xmlResetLastError();
12981 if (mem_base != xmlMemBlocks()) {
12982 printf("Leak of %d blocks found in xmlGetFeature",
12983 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012984 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012985 printf(" %d", n_ctxt);
12986 printf(" %d", n_name);
12987 printf(" %d", n_result);
12988 printf("\n");
12989 }
12990 }
12991 }
12992 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012993 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000012994#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000012995#endif
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012996
Daniel Veillard42595322004-11-08 10:52:06 +000012997 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012998}
12999
13000
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013001#define gen_nb_const_char_ptr_ptr 1
13002static char ** gen_const_char_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13003 return(NULL);
13004}
13005static void des_const_char_ptr_ptr(int no ATTRIBUTE_UNUSED, const char ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13006}
13007
Daniel Veillardd93f6252004-11-02 15:53:51 +000013008static int
13009test_xmlGetFeaturesList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013010 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013011
William M. Brack21e4ef22005-01-02 09:53:13 +000013012#if defined(LIBXML_LEGACY_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013013#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013014 int mem_base;
13015 int ret_val;
13016 int * len; /* the length of the features name array (input/output) */
13017 int n_len;
13018 char ** result; /* an array of string to be filled with the features name. */
13019 int n_result;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013020
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013021 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
13022 for (n_result = 0;n_result < gen_nb_const_char_ptr_ptr;n_result++) {
13023 mem_base = xmlMemBlocks();
13024 len = gen_int_ptr(n_len, 0);
13025 result = gen_const_char_ptr_ptr(n_result, 1);
13026
William M. Brackf13f77f2004-11-12 16:03:48 +000013027 ret_val = xmlGetFeaturesList(len, (const char **)result);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013028 desret_int(ret_val);
13029 call_tests++;
13030 des_int_ptr(n_len, len, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000013031 des_const_char_ptr_ptr(n_result, (const char **)result, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013032 xmlResetLastError();
13033 if (mem_base != xmlMemBlocks()) {
13034 printf("Leak of %d blocks found in xmlGetFeaturesList",
13035 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013036 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013037 printf(" %d", n_len);
13038 printf(" %d", n_result);
13039 printf("\n");
13040 }
13041 }
13042 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013043 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013044#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013045#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013046
Daniel Veillard42595322004-11-08 10:52:06 +000013047 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013048}
13049
13050
13051static int
13052test_xmlIOParseDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013053 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013054
William M. Brack21e4ef22005-01-02 09:53:13 +000013055#if defined(LIBXML_VALID_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013056#ifdef LIBXML_VALID_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000013057 int mem_base;
13058 xmlDtdPtr ret_val;
13059 xmlSAXHandlerPtr sax; /* the SAX handler block or NULL */
13060 int n_sax;
13061 xmlParserInputBufferPtr input; /* an Input Buffer */
13062 int n_input;
13063 xmlCharEncoding enc; /* the charset encoding if known */
13064 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013065
Daniel Veillard34099b42004-11-04 17:34:35 +000013066 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
13067 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
13068 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
13069 mem_base = xmlMemBlocks();
13070 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
13071 input = gen_xmlParserInputBufferPtr(n_input, 1);
13072 enc = gen_xmlCharEncoding(n_enc, 2);
13073
13074 ret_val = xmlIOParseDTD(sax, input, enc);
13075 input = NULL;
13076 desret_xmlDtdPtr(ret_val);
13077 call_tests++;
13078 des_xmlSAXHandlerPtr(n_sax, sax, 0);
13079 des_xmlParserInputBufferPtr(n_input, input, 1);
13080 des_xmlCharEncoding(n_enc, enc, 2);
13081 xmlResetLastError();
13082 if (mem_base != xmlMemBlocks()) {
13083 printf("Leak of %d blocks found in xmlIOParseDTD",
13084 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013085 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000013086 printf(" %d", n_sax);
13087 printf(" %d", n_input);
13088 printf(" %d", n_enc);
13089 printf("\n");
13090 }
13091 }
13092 }
13093 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013094 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013095#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013096#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000013097
Daniel Veillard42595322004-11-08 10:52:06 +000013098 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013099}
13100
13101
13102static int
13103test_xmlInitNodeInfoSeq(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013104 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013105
Daniel Veillardce682bc2004-11-05 17:22:25 +000013106 int mem_base;
13107 xmlParserNodeInfoSeqPtr seq; /* a node info sequence pointer */
13108 int n_seq;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013109
Daniel Veillardce682bc2004-11-05 17:22:25 +000013110 for (n_seq = 0;n_seq < gen_nb_xmlParserNodeInfoSeqPtr;n_seq++) {
13111 mem_base = xmlMemBlocks();
13112 seq = gen_xmlParserNodeInfoSeqPtr(n_seq, 0);
13113
13114 xmlInitNodeInfoSeq(seq);
13115 call_tests++;
13116 des_xmlParserNodeInfoSeqPtr(n_seq, seq, 0);
13117 xmlResetLastError();
13118 if (mem_base != xmlMemBlocks()) {
13119 printf("Leak of %d blocks found in xmlInitNodeInfoSeq",
13120 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013121 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013122 printf(" %d", n_seq);
13123 printf("\n");
13124 }
13125 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000013126 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013127
Daniel Veillard42595322004-11-08 10:52:06 +000013128 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013129}
13130
13131
13132static int
13133test_xmlInitParser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013134 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013135
13136 int mem_base;
13137
13138 mem_base = xmlMemBlocks();
13139
13140 xmlInitParser();
13141 call_tests++;
13142 xmlResetLastError();
13143 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013144 printf("Leak of %d blocks found in xmlInitParser",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013145 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013146 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013147 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013148 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013149 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013150
Daniel Veillard42595322004-11-08 10:52:06 +000013151 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013152}
13153
13154
13155static int
13156test_xmlInitParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013157 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013158
13159 int mem_base;
13160 int ret_val;
13161 xmlParserCtxtPtr ctxt; /* an XML parser context */
13162 int n_ctxt;
13163
13164 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13165 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013166 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013167
13168 ret_val = xmlInitParserCtxt(ctxt);
13169 desret_int(ret_val);
13170 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013171 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013172 xmlResetLastError();
13173 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013174 printf("Leak of %d blocks found in xmlInitParserCtxt",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013175 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013176 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013177 printf(" %d", n_ctxt);
13178 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013179 }
13180 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013181 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013182
Daniel Veillard42595322004-11-08 10:52:06 +000013183 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013184}
13185
13186
13187static int
13188test_xmlKeepBlanksDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013189 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013190
13191 int mem_base;
13192 int ret_val;
13193 int val; /* int 0 or 1 */
13194 int n_val;
13195
13196 for (n_val = 0;n_val < gen_nb_int;n_val++) {
13197 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013198 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013199
13200 ret_val = xmlKeepBlanksDefault(val);
13201 desret_int(ret_val);
13202 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013203 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013204 xmlResetLastError();
13205 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013206 printf("Leak of %d blocks found in xmlKeepBlanksDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013207 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013208 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013209 printf(" %d", n_val);
13210 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013211 }
13212 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013213 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013214
Daniel Veillard42595322004-11-08 10:52:06 +000013215 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013216}
13217
13218
13219static int
13220test_xmlLineNumbersDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013221 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013222
13223 int mem_base;
13224 int ret_val;
13225 int val; /* int 0 or 1 */
13226 int n_val;
13227
13228 for (n_val = 0;n_val < gen_nb_int;n_val++) {
13229 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013230 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013231
13232 ret_val = xmlLineNumbersDefault(val);
13233 desret_int(ret_val);
13234 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013235 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013236 xmlResetLastError();
13237 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013238 printf("Leak of %d blocks found in xmlLineNumbersDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013239 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013240 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013241 printf(" %d", n_val);
13242 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013243 }
13244 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013245 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013246
Daniel Veillard42595322004-11-08 10:52:06 +000013247 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013248}
13249
13250
13251static int
13252test_xmlLoadExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013253 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013254
Daniel Veillard42595322004-11-08 10:52:06 +000013255 int mem_base;
13256 xmlParserInputPtr ret_val;
13257 const char * URL; /* the URL for the entity to load */
13258 int n_URL;
13259 char * ID; /* the Public ID for the entity to load */
13260 int n_ID;
13261 xmlParserCtxtPtr ctxt; /* the context in which the entity is called or NULL */
13262 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013263
Daniel Veillard42595322004-11-08 10:52:06 +000013264 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
13265 for (n_ID = 0;n_ID < gen_nb_const_char_ptr;n_ID++) {
13266 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13267 mem_base = xmlMemBlocks();
13268 URL = gen_filepath(n_URL, 0);
13269 ID = gen_const_char_ptr(n_ID, 1);
13270 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 2);
13271
William M. Brackf13f77f2004-11-12 16:03:48 +000013272 ret_val = xmlLoadExternalEntity(URL, (const char *)ID, ctxt);
Daniel Veillard42595322004-11-08 10:52:06 +000013273 desret_xmlParserInputPtr(ret_val);
13274 call_tests++;
13275 des_filepath(n_URL, URL, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000013276 des_const_char_ptr(n_ID, (const char *)ID, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000013277 des_xmlParserCtxtPtr(n_ctxt, ctxt, 2);
13278 xmlResetLastError();
13279 if (mem_base != xmlMemBlocks()) {
13280 printf("Leak of %d blocks found in xmlLoadExternalEntity",
13281 xmlMemBlocks() - mem_base);
13282 test_ret++;
13283 printf(" %d", n_URL);
13284 printf(" %d", n_ID);
13285 printf(" %d", n_ctxt);
13286 printf("\n");
13287 }
13288 }
13289 }
13290 }
Daniel Veillard42595322004-11-08 10:52:06 +000013291 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013292
Daniel Veillard42595322004-11-08 10:52:06 +000013293 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013294}
13295
13296
13297static int
13298test_xmlNewIOInputStream(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013299 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013300
Daniel Veillard42595322004-11-08 10:52:06 +000013301 int mem_base;
13302 xmlParserInputPtr ret_val;
13303 xmlParserCtxtPtr ctxt; /* an XML parser context */
13304 int n_ctxt;
13305 xmlParserInputBufferPtr input; /* an I/O Input */
13306 int n_input;
13307 xmlCharEncoding enc; /* the charset encoding if known */
13308 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013309
Daniel Veillard42595322004-11-08 10:52:06 +000013310 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13311 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
13312 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
13313 mem_base = xmlMemBlocks();
13314 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
13315 input = gen_xmlParserInputBufferPtr(n_input, 1);
13316 enc = gen_xmlCharEncoding(n_enc, 2);
13317
13318 ret_val = xmlNewIOInputStream(ctxt, input, enc);
13319 if (ret_val != NULL) input = NULL;
13320 desret_xmlParserInputPtr(ret_val);
13321 call_tests++;
13322 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
13323 des_xmlParserInputBufferPtr(n_input, input, 1);
13324 des_xmlCharEncoding(n_enc, enc, 2);
13325 xmlResetLastError();
13326 if (mem_base != xmlMemBlocks()) {
13327 printf("Leak of %d blocks found in xmlNewIOInputStream",
13328 xmlMemBlocks() - mem_base);
13329 test_ret++;
13330 printf(" %d", n_ctxt);
13331 printf(" %d", n_input);
13332 printf(" %d", n_enc);
13333 printf("\n");
13334 }
13335 }
13336 }
13337 }
Daniel Veillard42595322004-11-08 10:52:06 +000013338 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013339
Daniel Veillard42595322004-11-08 10:52:06 +000013340 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013341}
13342
13343
13344static int
13345test_xmlNewParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013346 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013347
Daniel Veillard34099b42004-11-04 17:34:35 +000013348 int mem_base;
13349 xmlParserCtxtPtr ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013350
Daniel Veillard34099b42004-11-04 17:34:35 +000013351 mem_base = xmlMemBlocks();
13352
13353 ret_val = xmlNewParserCtxt();
13354 desret_xmlParserCtxtPtr(ret_val);
13355 call_tests++;
13356 xmlResetLastError();
13357 if (mem_base != xmlMemBlocks()) {
13358 printf("Leak of %d blocks found in xmlNewParserCtxt",
13359 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013360 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000013361 printf("\n");
13362 }
Daniel Veillard34099b42004-11-04 17:34:35 +000013363 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013364
Daniel Veillard42595322004-11-08 10:52:06 +000013365 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013366}
13367
13368
Daniel Veillardce682bc2004-11-05 17:22:25 +000013369#define gen_nb_xmlNodePtr_ptr 1
13370static xmlNodePtr * gen_xmlNodePtr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13371 return(NULL);
13372}
13373static void des_xmlNodePtr_ptr(int no ATTRIBUTE_UNUSED, xmlNodePtr * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13374}
13375
Daniel Veillardd93f6252004-11-02 15:53:51 +000013376static int
13377test_xmlParseBalancedChunkMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013378 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013379
William M. Brack21e4ef22005-01-02 09:53:13 +000013380#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013381#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013382 int mem_base;
13383 int ret_val;
13384 xmlDocPtr doc; /* the document the chunk pertains to */
13385 int n_doc;
13386 xmlSAXHandlerPtr sax; /* the SAX handler bloc (possibly NULL) */
13387 int n_sax;
13388 void * user_data; /* The user data returned on SAX callbacks (possibly NULL) */
13389 int n_user_data;
13390 int depth; /* Used for loop detection, use 0 */
13391 int n_depth;
13392 xmlChar * string; /* the input string in UTF8 or ISO-Latin (zero terminated) */
13393 int n_string;
13394 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13395 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013396
Daniel Veillardce682bc2004-11-05 17:22:25 +000013397 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
13398 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
13399 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
13400 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
13401 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
13402 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13403 mem_base = xmlMemBlocks();
13404 doc = gen_xmlDocPtr(n_doc, 0);
13405 sax = gen_xmlSAXHandlerPtr(n_sax, 1);
13406 user_data = gen_userdata(n_user_data, 2);
13407 depth = gen_int(n_depth, 3);
13408 string = gen_const_xmlChar_ptr(n_string, 4);
13409 lst = gen_xmlNodePtr_ptr(n_lst, 5);
Daniel Veillarda521d282004-11-09 14:59:59 +000013410
13411#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013412 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
Daniel Veillarda521d282004-11-09 14:59:59 +000013413#endif
13414
Daniel Veillardce682bc2004-11-05 17:22:25 +000013415
William M. Brackf13f77f2004-11-12 16:03:48 +000013416 ret_val = xmlParseBalancedChunkMemory(doc, sax, user_data, depth, (const xmlChar *)string, lst);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013417 desret_int(ret_val);
13418 call_tests++;
13419 des_xmlDocPtr(n_doc, doc, 0);
13420 des_xmlSAXHandlerPtr(n_sax, sax, 1);
13421 des_userdata(n_user_data, user_data, 2);
13422 des_int(n_depth, depth, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000013423 des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 4);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013424 des_xmlNodePtr_ptr(n_lst, lst, 5);
13425 xmlResetLastError();
13426 if (mem_base != xmlMemBlocks()) {
13427 printf("Leak of %d blocks found in xmlParseBalancedChunkMemory",
13428 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013429 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013430 printf(" %d", n_doc);
13431 printf(" %d", n_sax);
13432 printf(" %d", n_user_data);
13433 printf(" %d", n_depth);
13434 printf(" %d", n_string);
13435 printf(" %d", n_lst);
13436 printf("\n");
13437 }
13438 }
13439 }
13440 }
13441 }
13442 }
13443 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013444 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013445#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013446#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000013447
Daniel Veillard42595322004-11-08 10:52:06 +000013448 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013449}
13450
13451
13452static int
13453test_xmlParseBalancedChunkMemoryRecover(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013454 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013455
William M. Brack21e4ef22005-01-02 09:53:13 +000013456#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013457#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013458 int mem_base;
13459 int ret_val;
13460 xmlDocPtr doc; /* the document the chunk pertains to */
13461 int n_doc;
13462 xmlSAXHandlerPtr sax; /* the SAX handler bloc (possibly NULL) */
13463 int n_sax;
13464 void * user_data; /* The user data returned on SAX callbacks (possibly NULL) */
13465 int n_user_data;
13466 int depth; /* Used for loop detection, use 0 */
13467 int n_depth;
13468 xmlChar * string; /* the input string in UTF8 or ISO-Latin (zero terminated) */
13469 int n_string;
13470 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13471 int n_lst;
13472 int recover; /* return nodes even if the data is broken (use 0) */
13473 int n_recover;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013474
Daniel Veillardce682bc2004-11-05 17:22:25 +000013475 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
13476 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
13477 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
13478 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
13479 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
13480 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13481 for (n_recover = 0;n_recover < gen_nb_int;n_recover++) {
13482 mem_base = xmlMemBlocks();
13483 doc = gen_xmlDocPtr(n_doc, 0);
13484 sax = gen_xmlSAXHandlerPtr(n_sax, 1);
13485 user_data = gen_userdata(n_user_data, 2);
13486 depth = gen_int(n_depth, 3);
13487 string = gen_const_xmlChar_ptr(n_string, 4);
13488 lst = gen_xmlNodePtr_ptr(n_lst, 5);
13489 recover = gen_int(n_recover, 6);
Daniel Veillarda521d282004-11-09 14:59:59 +000013490
13491#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013492 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
Daniel Veillarda521d282004-11-09 14:59:59 +000013493#endif
13494
Daniel Veillardce682bc2004-11-05 17:22:25 +000013495
William M. Brackf13f77f2004-11-12 16:03:48 +000013496 ret_val = xmlParseBalancedChunkMemoryRecover(doc, sax, user_data, depth, (const xmlChar *)string, lst, recover);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013497 desret_int(ret_val);
13498 call_tests++;
13499 des_xmlDocPtr(n_doc, doc, 0);
13500 des_xmlSAXHandlerPtr(n_sax, sax, 1);
13501 des_userdata(n_user_data, user_data, 2);
13502 des_int(n_depth, depth, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000013503 des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 4);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013504 des_xmlNodePtr_ptr(n_lst, lst, 5);
13505 des_int(n_recover, recover, 6);
13506 xmlResetLastError();
13507 if (mem_base != xmlMemBlocks()) {
13508 printf("Leak of %d blocks found in xmlParseBalancedChunkMemoryRecover",
13509 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013510 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013511 printf(" %d", n_doc);
13512 printf(" %d", n_sax);
13513 printf(" %d", n_user_data);
13514 printf(" %d", n_depth);
13515 printf(" %d", n_string);
13516 printf(" %d", n_lst);
13517 printf(" %d", n_recover);
13518 printf("\n");
13519 }
13520 }
13521 }
13522 }
13523 }
13524 }
13525 }
13526 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013527 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013528#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013529#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000013530
Daniel Veillard42595322004-11-08 10:52:06 +000013531 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013532}
13533
13534
13535static int
13536test_xmlParseChunk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013537 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013538
William M. Brack21e4ef22005-01-02 09:53:13 +000013539#if defined(LIBXML_PUSH_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000013540 int mem_base;
13541 int ret_val;
13542 xmlParserCtxtPtr ctxt; /* an XML parser context */
13543 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013544 char * chunk; /* an char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000013545 int n_chunk;
13546 int size; /* the size in byte of the chunk */
13547 int n_size;
13548 int terminate; /* last chunk indicator */
13549 int n_terminate;
13550
13551 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13552 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
13553 for (n_size = 0;n_size < gen_nb_int;n_size++) {
13554 for (n_terminate = 0;n_terminate < gen_nb_int;n_terminate++) {
13555 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013556 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
13557 chunk = gen_const_char_ptr(n_chunk, 1);
13558 size = gen_int(n_size, 2);
13559 terminate = gen_int(n_terminate, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013560
William M. Brackf13f77f2004-11-12 16:03:48 +000013561 ret_val = xmlParseChunk(ctxt, (const char *)chunk, size, terminate);
Daniel Veillarda521d282004-11-09 14:59:59 +000013562 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillardd93f6252004-11-02 15:53:51 +000013563 desret_int(ret_val);
13564 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013565 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000013566 des_const_char_ptr(n_chunk, (const char *)chunk, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000013567 des_int(n_size, size, 2);
13568 des_int(n_terminate, terminate, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013569 xmlResetLastError();
13570 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013571 printf("Leak of %d blocks found in xmlParseChunk",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013572 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013573 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013574 printf(" %d", n_ctxt);
13575 printf(" %d", n_chunk);
13576 printf(" %d", n_size);
13577 printf(" %d", n_terminate);
13578 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013579 }
13580 }
13581 }
13582 }
13583 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013584 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013585#endif
13586
Daniel Veillard42595322004-11-08 10:52:06 +000013587 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013588}
13589
13590
13591static int
13592test_xmlParseCtxtExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013593 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013594
Daniel Veillardce682bc2004-11-05 17:22:25 +000013595 int mem_base;
13596 int ret_val;
13597 xmlParserCtxtPtr ctx; /* the existing parsing context */
13598 int n_ctx;
13599 xmlChar * URL; /* the URL for the entity to load */
13600 int n_URL;
13601 xmlChar * ID; /* the System ID for the entity to load */
13602 int n_ID;
13603 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13604 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013605
Daniel Veillardce682bc2004-11-05 17:22:25 +000013606 for (n_ctx = 0;n_ctx < gen_nb_xmlParserCtxtPtr;n_ctx++) {
13607 for (n_URL = 0;n_URL < gen_nb_const_xmlChar_ptr;n_URL++) {
13608 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
13609 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13610 mem_base = xmlMemBlocks();
13611 ctx = gen_xmlParserCtxtPtr(n_ctx, 0);
13612 URL = gen_const_xmlChar_ptr(n_URL, 1);
13613 ID = gen_const_xmlChar_ptr(n_ID, 2);
13614 lst = gen_xmlNodePtr_ptr(n_lst, 3);
13615
William M. Brackf13f77f2004-11-12 16:03:48 +000013616 ret_val = xmlParseCtxtExternalEntity(ctx, (const xmlChar *)URL, (const xmlChar *)ID, lst);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013617 desret_int(ret_val);
13618 call_tests++;
13619 des_xmlParserCtxtPtr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000013620 des_const_xmlChar_ptr(n_URL, (const xmlChar *)URL, 1);
13621 des_const_xmlChar_ptr(n_ID, (const xmlChar *)ID, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013622 des_xmlNodePtr_ptr(n_lst, lst, 3);
13623 xmlResetLastError();
13624 if (mem_base != xmlMemBlocks()) {
13625 printf("Leak of %d blocks found in xmlParseCtxtExternalEntity",
13626 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013627 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013628 printf(" %d", n_ctx);
13629 printf(" %d", n_URL);
13630 printf(" %d", n_ID);
13631 printf(" %d", n_lst);
13632 printf("\n");
13633 }
13634 }
13635 }
13636 }
13637 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000013638 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013639
Daniel Veillard42595322004-11-08 10:52:06 +000013640 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013641}
13642
13643
13644static int
13645test_xmlParseDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013646 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013647
William M. Brack21e4ef22005-01-02 09:53:13 +000013648#if defined(LIBXML_VALID_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013649#ifdef LIBXML_VALID_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000013650 int mem_base;
13651 xmlDtdPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013652 xmlChar * ExternalID; /* a NAME* containing the External ID of the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000013653 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013654 xmlChar * SystemID; /* a NAME* containing the URL to the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000013655 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013656
Daniel Veillard34099b42004-11-04 17:34:35 +000013657 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
13658 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
13659 mem_base = xmlMemBlocks();
13660 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 0);
13661 SystemID = gen_const_xmlChar_ptr(n_SystemID, 1);
13662
William M. Brackf13f77f2004-11-12 16:03:48 +000013663 ret_val = xmlParseDTD((const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard34099b42004-11-04 17:34:35 +000013664 desret_xmlDtdPtr(ret_val);
13665 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000013666 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 0);
13667 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 1);
Daniel Veillard34099b42004-11-04 17:34:35 +000013668 xmlResetLastError();
13669 if (mem_base != xmlMemBlocks()) {
13670 printf("Leak of %d blocks found in xmlParseDTD",
13671 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013672 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000013673 printf(" %d", n_ExternalID);
13674 printf(" %d", n_SystemID);
13675 printf("\n");
13676 }
13677 }
13678 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013679 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013680#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013681#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000013682
Daniel Veillard42595322004-11-08 10:52:06 +000013683 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013684}
13685
13686
13687static int
13688test_xmlParseDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013689 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013690
William M. Brack21e4ef22005-01-02 09:53:13 +000013691#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013692#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013693 int mem_base;
13694 xmlDocPtr ret_val;
13695 xmlChar * cur; /* a pointer to an array of xmlChar */
13696 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013697
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013698 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
13699 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013700 cur = gen_xmlChar_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013701
13702 ret_val = xmlParseDoc(cur);
13703 desret_xmlDocPtr(ret_val);
13704 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013705 des_xmlChar_ptr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013706 xmlResetLastError();
13707 if (mem_base != xmlMemBlocks()) {
13708 printf("Leak of %d blocks found in xmlParseDoc",
13709 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013710 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013711 printf(" %d", n_cur);
13712 printf("\n");
13713 }
13714 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013715 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013716#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013717#endif
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013718
Daniel Veillard42595322004-11-08 10:52:06 +000013719 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013720}
13721
13722
13723static int
13724test_xmlParseDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013725 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013726
13727 int mem_base;
13728 int ret_val;
13729 xmlParserCtxtPtr ctxt; /* an XML parser context */
13730 int n_ctxt;
13731
13732 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13733 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013734 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013735
13736 ret_val = xmlParseDocument(ctxt);
Daniel Veillarda521d282004-11-09 14:59:59 +000013737 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillardd93f6252004-11-02 15:53:51 +000013738 desret_int(ret_val);
13739 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013740 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013741 xmlResetLastError();
13742 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013743 printf("Leak of %d blocks found in xmlParseDocument",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013744 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013745 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013746 printf(" %d", n_ctxt);
13747 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013748 }
13749 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013750 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013751
Daniel Veillard42595322004-11-08 10:52:06 +000013752 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013753}
13754
13755
13756static int
13757test_xmlParseEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013758 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013759
William M. Brack21e4ef22005-01-02 09:53:13 +000013760#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013761#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000013762 int mem_base;
13763 xmlDocPtr ret_val;
13764 const char * filename; /* the filename */
13765 int n_filename;
13766
13767 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
13768 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013769 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013770
13771 ret_val = xmlParseEntity(filename);
13772 desret_xmlDocPtr(ret_val);
13773 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013774 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013775 xmlResetLastError();
13776 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013777 printf("Leak of %d blocks found in xmlParseEntity",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013778 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013779 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013780 printf(" %d", n_filename);
13781 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013782 }
13783 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013784 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013785#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013786#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000013787
Daniel Veillard42595322004-11-08 10:52:06 +000013788 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013789}
13790
13791
13792static int
13793test_xmlParseExtParsedEnt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013794 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013795
13796 int mem_base;
13797 int ret_val;
13798 xmlParserCtxtPtr ctxt; /* an XML parser context */
13799 int n_ctxt;
13800
13801 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13802 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013803 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013804
13805 ret_val = xmlParseExtParsedEnt(ctxt);
Daniel Veillarda521d282004-11-09 14:59:59 +000013806 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillardd93f6252004-11-02 15:53:51 +000013807 desret_int(ret_val);
13808 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013809 des_xmlParserCtxtPtr(n_ctxt, ctxt, 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 xmlParseExtParsedEnt",
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_ctxt);
13816 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013817 }
13818 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013819 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013820
Daniel Veillard42595322004-11-08 10:52:06 +000013821 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013822}
13823
13824
13825static int
13826test_xmlParseExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013827 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013828
William M. Brack21e4ef22005-01-02 09:53:13 +000013829#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013830#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013831 int mem_base;
13832 int ret_val;
13833 xmlDocPtr doc; /* the document the chunk pertains to */
13834 int n_doc;
13835 xmlSAXHandlerPtr sax; /* the SAX handler bloc (possibly NULL) */
13836 int n_sax;
13837 void * user_data; /* The user data returned on SAX callbacks (possibly NULL) */
13838 int n_user_data;
13839 int depth; /* Used for loop detection, use 0 */
13840 int n_depth;
13841 xmlChar * URL; /* the URL for the entity to load */
13842 int n_URL;
13843 xmlChar * ID; /* the System ID for the entity to load */
13844 int n_ID;
13845 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13846 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013847
Daniel Veillardce682bc2004-11-05 17:22:25 +000013848 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
13849 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
13850 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
13851 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
13852 for (n_URL = 0;n_URL < gen_nb_const_xmlChar_ptr;n_URL++) {
13853 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
13854 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13855 mem_base = xmlMemBlocks();
13856 doc = gen_xmlDocPtr(n_doc, 0);
13857 sax = gen_xmlSAXHandlerPtr(n_sax, 1);
13858 user_data = gen_userdata(n_user_data, 2);
13859 depth = gen_int(n_depth, 3);
13860 URL = gen_const_xmlChar_ptr(n_URL, 4);
13861 ID = gen_const_xmlChar_ptr(n_ID, 5);
13862 lst = gen_xmlNodePtr_ptr(n_lst, 6);
13863
William M. Brackf13f77f2004-11-12 16:03:48 +000013864 ret_val = xmlParseExternalEntity(doc, sax, user_data, depth, (const xmlChar *)URL, (const xmlChar *)ID, lst);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013865 desret_int(ret_val);
13866 call_tests++;
13867 des_xmlDocPtr(n_doc, doc, 0);
13868 des_xmlSAXHandlerPtr(n_sax, sax, 1);
13869 des_userdata(n_user_data, user_data, 2);
13870 des_int(n_depth, depth, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000013871 des_const_xmlChar_ptr(n_URL, (const xmlChar *)URL, 4);
13872 des_const_xmlChar_ptr(n_ID, (const xmlChar *)ID, 5);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013873 des_xmlNodePtr_ptr(n_lst, lst, 6);
13874 xmlResetLastError();
13875 if (mem_base != xmlMemBlocks()) {
13876 printf("Leak of %d blocks found in xmlParseExternalEntity",
13877 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013878 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013879 printf(" %d", n_doc);
13880 printf(" %d", n_sax);
13881 printf(" %d", n_user_data);
13882 printf(" %d", n_depth);
13883 printf(" %d", n_URL);
13884 printf(" %d", n_ID);
13885 printf(" %d", n_lst);
13886 printf("\n");
13887 }
13888 }
13889 }
13890 }
13891 }
13892 }
13893 }
13894 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013895 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013896#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013897#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000013898
Daniel Veillard42595322004-11-08 10:52:06 +000013899 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013900}
13901
13902
13903static int
13904test_xmlParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013905 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013906
William M. Brack21e4ef22005-01-02 09:53:13 +000013907#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013908#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000013909 int mem_base;
13910 xmlDocPtr ret_val;
13911 const char * filename; /* the filename */
13912 int n_filename;
13913
13914 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
13915 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013916 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013917
13918 ret_val = xmlParseFile(filename);
13919 desret_xmlDocPtr(ret_val);
13920 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013921 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013922 xmlResetLastError();
13923 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013924 printf("Leak of %d blocks found in xmlParseFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013925 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013926 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013927 printf(" %d", n_filename);
13928 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013929 }
13930 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013931 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013932#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013933#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000013934
Daniel Veillard42595322004-11-08 10:52:06 +000013935 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013936}
13937
13938
13939static int
13940test_xmlParseInNodeContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013941 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013942
Daniel Veillard57b25162004-11-06 14:50:18 +000013943 int mem_base;
13944 xmlParserErrors ret_val;
13945 xmlNodePtr node; /* the context node */
13946 int n_node;
13947 char * data; /* the input string */
13948 int n_data;
13949 int datalen; /* the input string length in bytes */
13950 int n_datalen;
13951 int options; /* a combination of xmlParserOption */
13952 int n_options;
13953 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13954 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013955
Daniel Veillard57b25162004-11-06 14:50:18 +000013956 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
13957 for (n_data = 0;n_data < gen_nb_const_char_ptr;n_data++) {
13958 for (n_datalen = 0;n_datalen < gen_nb_int;n_datalen++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000013959 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillard57b25162004-11-06 14:50:18 +000013960 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13961 mem_base = xmlMemBlocks();
13962 node = gen_xmlNodePtr(n_node, 0);
13963 data = gen_const_char_ptr(n_data, 1);
13964 datalen = gen_int(n_datalen, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000013965 options = gen_parseroptions(n_options, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000013966 lst = gen_xmlNodePtr_ptr(n_lst, 4);
13967
William M. Brackf13f77f2004-11-12 16:03:48 +000013968 ret_val = xmlParseInNodeContext(node, (const char *)data, datalen, options, lst);
Daniel Veillard57b25162004-11-06 14:50:18 +000013969 desret_xmlParserErrors(ret_val);
13970 call_tests++;
13971 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000013972 des_const_char_ptr(n_data, (const char *)data, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +000013973 des_int(n_datalen, datalen, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000013974 des_parseroptions(n_options, options, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000013975 des_xmlNodePtr_ptr(n_lst, lst, 4);
13976 xmlResetLastError();
13977 if (mem_base != xmlMemBlocks()) {
13978 printf("Leak of %d blocks found in xmlParseInNodeContext",
13979 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013980 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000013981 printf(" %d", n_node);
13982 printf(" %d", n_data);
13983 printf(" %d", n_datalen);
13984 printf(" %d", n_options);
13985 printf(" %d", n_lst);
13986 printf("\n");
13987 }
13988 }
13989 }
13990 }
13991 }
13992 }
Daniel Veillard57b25162004-11-06 14:50:18 +000013993 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013994
Daniel Veillard42595322004-11-08 10:52:06 +000013995 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013996}
13997
13998
13999static int
14000test_xmlParseMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014001 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014002
William M. Brack21e4ef22005-01-02 09:53:13 +000014003#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014004#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000014005 int mem_base;
14006 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014007 char * buffer; /* an pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014008 int n_buffer;
14009 int size; /* the size of the array */
14010 int n_size;
14011
14012 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14013 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14014 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014015 buffer = gen_const_char_ptr(n_buffer, 0);
14016 size = gen_int(n_size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014017
William M. Brackf13f77f2004-11-12 16:03:48 +000014018 ret_val = xmlParseMemory((const char *)buffer, size);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014019 desret_xmlDocPtr(ret_val);
14020 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000014021 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000014022 des_int(n_size, size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014023 xmlResetLastError();
14024 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014025 printf("Leak of %d blocks found in xmlParseMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014026 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014027 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014028 printf(" %d", n_buffer);
14029 printf(" %d", n_size);
14030 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014031 }
14032 }
14033 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014034 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014035#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014036#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000014037
Daniel Veillard42595322004-11-08 10:52:06 +000014038 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014039}
14040
14041
Daniel Veillardce682bc2004-11-05 17:22:25 +000014042#define gen_nb_const_xmlParserNodeInfoPtr 1
14043static xmlParserNodeInfoPtr gen_const_xmlParserNodeInfoPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14044 return(NULL);
14045}
14046static void des_const_xmlParserNodeInfoPtr(int no ATTRIBUTE_UNUSED, const xmlParserNodeInfoPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14047}
14048
Daniel Veillardd93f6252004-11-02 15:53:51 +000014049static int
14050test_xmlParserAddNodeInfo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014051 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014052
Daniel Veillardce682bc2004-11-05 17:22:25 +000014053 int mem_base;
14054 xmlParserCtxtPtr ctxt; /* an XML parser context */
14055 int n_ctxt;
14056 xmlParserNodeInfoPtr info; /* a node info sequence pointer */
14057 int n_info;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014058
Daniel Veillardce682bc2004-11-05 17:22:25 +000014059 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
14060 for (n_info = 0;n_info < gen_nb_const_xmlParserNodeInfoPtr;n_info++) {
14061 mem_base = xmlMemBlocks();
14062 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
14063 info = gen_const_xmlParserNodeInfoPtr(n_info, 1);
14064
William M. Brackf13f77f2004-11-12 16:03:48 +000014065 xmlParserAddNodeInfo(ctxt, (const xmlParserNodeInfoPtr)info);
Daniel Veillardce682bc2004-11-05 17:22:25 +000014066 call_tests++;
14067 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000014068 des_const_xmlParserNodeInfoPtr(n_info, (const xmlParserNodeInfoPtr)info, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000014069 xmlResetLastError();
14070 if (mem_base != xmlMemBlocks()) {
14071 printf("Leak of %d blocks found in xmlParserAddNodeInfo",
14072 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014073 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014074 printf(" %d", n_ctxt);
14075 printf(" %d", n_info);
14076 printf("\n");
14077 }
14078 }
14079 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000014080 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014081
Daniel Veillard42595322004-11-08 10:52:06 +000014082 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014083}
14084
14085
Daniel Veillardce682bc2004-11-05 17:22:25 +000014086#define gen_nb_const_xmlParserCtxtPtr 1
14087static xmlParserCtxtPtr gen_const_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14088 return(NULL);
14089}
14090static void des_const_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, const xmlParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14091}
14092
Daniel Veillarda521d282004-11-09 14:59:59 +000014093#define gen_nb_const_xmlNodePtr 1
14094static xmlNodePtr gen_const_xmlNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14095 return(NULL);
14096}
14097static void des_const_xmlNodePtr(int no ATTRIBUTE_UNUSED, const xmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14098}
14099
Daniel Veillardd93f6252004-11-02 15:53:51 +000014100static int
14101test_xmlParserFindNodeInfo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014102 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014103
William M. Brack094dd862004-11-14 14:28:34 +000014104 int mem_base;
14105 const xmlParserNodeInfo * ret_val;
14106 xmlParserCtxtPtr ctx; /* an XML parser context */
14107 int n_ctx;
14108 xmlNodePtr node; /* an XML node within the tree */
14109 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014110
William M. Brack094dd862004-11-14 14:28:34 +000014111 for (n_ctx = 0;n_ctx < gen_nb_const_xmlParserCtxtPtr;n_ctx++) {
14112 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
14113 mem_base = xmlMemBlocks();
14114 ctx = gen_const_xmlParserCtxtPtr(n_ctx, 0);
14115 node = gen_const_xmlNodePtr(n_node, 1);
14116
14117 ret_val = xmlParserFindNodeInfo((const xmlParserCtxtPtr)ctx, (const xmlNodePtr)node);
14118 desret_const_xmlParserNodeInfo_ptr(ret_val);
14119 call_tests++;
14120 des_const_xmlParserCtxtPtr(n_ctx, (const xmlParserCtxtPtr)ctx, 0);
14121 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 1);
14122 xmlResetLastError();
14123 if (mem_base != xmlMemBlocks()) {
14124 printf("Leak of %d blocks found in xmlParserFindNodeInfo",
14125 xmlMemBlocks() - mem_base);
14126 test_ret++;
14127 printf(" %d", n_ctx);
14128 printf(" %d", n_node);
14129 printf("\n");
14130 }
14131 }
14132 }
14133 function_tests++;
14134
Daniel Veillard42595322004-11-08 10:52:06 +000014135 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014136}
14137
14138
Daniel Veillardce682bc2004-11-05 17:22:25 +000014139#define gen_nb_const_xmlParserNodeInfoSeqPtr 1
14140static xmlParserNodeInfoSeqPtr gen_const_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14141 return(NULL);
14142}
14143static void des_const_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, const xmlParserNodeInfoSeqPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14144}
14145
Daniel Veillardd93f6252004-11-02 15:53:51 +000014146static int
14147test_xmlParserFindNodeInfoIndex(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014148 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014149
William M. Brack094dd862004-11-14 14:28:34 +000014150 int mem_base;
14151 unsigned long ret_val;
14152 xmlParserNodeInfoSeqPtr seq; /* a node info sequence pointer */
14153 int n_seq;
14154 xmlNodePtr node; /* an XML node pointer */
14155 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014156
William M. Brack094dd862004-11-14 14:28:34 +000014157 for (n_seq = 0;n_seq < gen_nb_const_xmlParserNodeInfoSeqPtr;n_seq++) {
14158 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
14159 mem_base = xmlMemBlocks();
14160 seq = gen_const_xmlParserNodeInfoSeqPtr(n_seq, 0);
14161 node = gen_const_xmlNodePtr(n_node, 1);
14162
14163 ret_val = xmlParserFindNodeInfoIndex((const xmlParserNodeInfoSeqPtr)seq, (const xmlNodePtr)node);
14164 desret_unsigned_long(ret_val);
14165 call_tests++;
14166 des_const_xmlParserNodeInfoSeqPtr(n_seq, (const xmlParserNodeInfoSeqPtr)seq, 0);
14167 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 1);
14168 xmlResetLastError();
14169 if (mem_base != xmlMemBlocks()) {
14170 printf("Leak of %d blocks found in xmlParserFindNodeInfoIndex",
14171 xmlMemBlocks() - mem_base);
14172 test_ret++;
14173 printf(" %d", n_seq);
14174 printf(" %d", n_node);
14175 printf("\n");
14176 }
14177 }
14178 }
14179 function_tests++;
14180
Daniel Veillard42595322004-11-08 10:52:06 +000014181 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014182}
14183
14184
Daniel Veillardce682bc2004-11-05 17:22:25 +000014185#define gen_nb_xmlParserInputPtr 1
14186static xmlParserInputPtr gen_xmlParserInputPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14187 return(NULL);
14188}
14189static void des_xmlParserInputPtr(int no ATTRIBUTE_UNUSED, xmlParserInputPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14190}
14191
Daniel Veillardd93f6252004-11-02 15:53:51 +000014192static int
14193test_xmlParserInputGrow(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014194 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014195
Daniel Veillardce682bc2004-11-05 17:22:25 +000014196 int mem_base;
14197 int ret_val;
14198 xmlParserInputPtr in; /* an XML parser input */
14199 int n_in;
14200 int len; /* an indicative size for the lookahead */
14201 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014202
Daniel Veillardce682bc2004-11-05 17:22:25 +000014203 for (n_in = 0;n_in < gen_nb_xmlParserInputPtr;n_in++) {
14204 for (n_len = 0;n_len < gen_nb_int;n_len++) {
14205 mem_base = xmlMemBlocks();
14206 in = gen_xmlParserInputPtr(n_in, 0);
14207 len = gen_int(n_len, 1);
14208
14209 ret_val = xmlParserInputGrow(in, len);
14210 desret_int(ret_val);
14211 call_tests++;
14212 des_xmlParserInputPtr(n_in, in, 0);
14213 des_int(n_len, len, 1);
14214 xmlResetLastError();
14215 if (mem_base != xmlMemBlocks()) {
14216 printf("Leak of %d blocks found in xmlParserInputGrow",
14217 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014218 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014219 printf(" %d", n_in);
14220 printf(" %d", n_len);
14221 printf("\n");
14222 }
14223 }
14224 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000014225 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014226
Daniel Veillard42595322004-11-08 10:52:06 +000014227 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014228}
14229
14230
14231static int
14232test_xmlParserInputRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014233 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014234
Daniel Veillardce682bc2004-11-05 17:22:25 +000014235 int mem_base;
14236 int ret_val;
14237 xmlParserInputPtr in; /* an XML parser input */
14238 int n_in;
14239 int len; /* an indicative size for the lookahead */
14240 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014241
Daniel Veillardce682bc2004-11-05 17:22:25 +000014242 for (n_in = 0;n_in < gen_nb_xmlParserInputPtr;n_in++) {
14243 for (n_len = 0;n_len < gen_nb_int;n_len++) {
14244 mem_base = xmlMemBlocks();
14245 in = gen_xmlParserInputPtr(n_in, 0);
14246 len = gen_int(n_len, 1);
14247
14248 ret_val = xmlParserInputRead(in, len);
14249 desret_int(ret_val);
14250 call_tests++;
14251 des_xmlParserInputPtr(n_in, in, 0);
14252 des_int(n_len, len, 1);
14253 xmlResetLastError();
14254 if (mem_base != xmlMemBlocks()) {
14255 printf("Leak of %d blocks found in xmlParserInputRead",
14256 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014257 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014258 printf(" %d", n_in);
14259 printf(" %d", n_len);
14260 printf("\n");
14261 }
14262 }
14263 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000014264 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014265
Daniel Veillard42595322004-11-08 10:52:06 +000014266 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014267}
14268
14269
14270static int
14271test_xmlPedanticParserDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014272 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014273
14274 int mem_base;
14275 int ret_val;
14276 int val; /* int 0 or 1 */
14277 int n_val;
14278
14279 for (n_val = 0;n_val < gen_nb_int;n_val++) {
14280 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014281 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014282
14283 ret_val = xmlPedanticParserDefault(val);
14284 desret_int(ret_val);
14285 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014286 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014287 xmlResetLastError();
14288 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014289 printf("Leak of %d blocks found in xmlPedanticParserDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014290 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014291 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014292 printf(" %d", n_val);
14293 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014294 }
14295 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000014296 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014297
Daniel Veillard42595322004-11-08 10:52:06 +000014298 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014299}
14300
14301
14302static int
14303test_xmlReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014304 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014305
14306 int mem_base;
14307 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014308 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014309 int n_cur;
14310 const char * URL; /* the base URL to use for the document */
14311 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014312 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014313 int n_encoding;
14314 int options; /* a combination of xmlParserOption */
14315 int n_options;
14316
14317 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
14318 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
14319 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000014320 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000014321 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014322 cur = gen_const_xmlChar_ptr(n_cur, 0);
14323 URL = gen_filepath(n_URL, 1);
14324 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000014325 options = gen_parseroptions(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014326
William M. Brackf13f77f2004-11-12 16:03:48 +000014327 ret_val = xmlReadDoc((const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014328 desret_xmlDocPtr(ret_val);
14329 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000014330 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000014331 des_filepath(n_URL, URL, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000014332 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000014333 des_parseroptions(n_options, options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014334 xmlResetLastError();
14335 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014336 printf("Leak of %d blocks found in xmlReadDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014337 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014338 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014339 printf(" %d", n_cur);
14340 printf(" %d", n_URL);
14341 printf(" %d", n_encoding);
14342 printf(" %d", n_options);
14343 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014344 }
14345 }
14346 }
14347 }
14348 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000014349 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014350
Daniel Veillard42595322004-11-08 10:52:06 +000014351 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014352}
14353
14354
14355static int
14356test_xmlReadFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014357 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014358
14359 int mem_base;
14360 xmlDocPtr ret_val;
14361 const char * filename; /* a file or URL */
14362 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014363 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014364 int n_encoding;
14365 int options; /* a combination of xmlParserOption */
14366 int n_options;
14367
14368 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14369 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000014370 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000014371 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014372 filename = gen_filepath(n_filename, 0);
14373 encoding = gen_const_char_ptr(n_encoding, 1);
Daniel Veillard6128c012004-11-08 17:16:15 +000014374 options = gen_parseroptions(n_options, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014375
William M. Brackf13f77f2004-11-12 16:03:48 +000014376 ret_val = xmlReadFile(filename, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014377 desret_xmlDocPtr(ret_val);
14378 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014379 des_filepath(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000014380 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillard6128c012004-11-08 17:16:15 +000014381 des_parseroptions(n_options, options, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014382 xmlResetLastError();
14383 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014384 printf("Leak of %d blocks found in xmlReadFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014385 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014386 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014387 printf(" %d", n_filename);
14388 printf(" %d", n_encoding);
14389 printf(" %d", n_options);
14390 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014391 }
14392 }
14393 }
14394 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000014395 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014396
Daniel Veillard42595322004-11-08 10:52:06 +000014397 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014398}
14399
14400
14401static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000014402test_xmlReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014403 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014404
14405 int mem_base;
14406 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014407 char * buffer; /* a pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014408 int n_buffer;
14409 int size; /* the size of the array */
14410 int n_size;
14411 const char * URL; /* the base URL to use for the document */
14412 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014413 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014414 int n_encoding;
14415 int options; /* a combination of xmlParserOption */
14416 int n_options;
14417
14418 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14419 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14420 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
14421 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000014422 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000014423 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014424 buffer = gen_const_char_ptr(n_buffer, 0);
14425 size = gen_int(n_size, 1);
14426 URL = gen_filepath(n_URL, 2);
14427 encoding = gen_const_char_ptr(n_encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000014428 options = gen_parseroptions(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014429
William M. Brackf13f77f2004-11-12 16:03:48 +000014430 ret_val = xmlReadMemory((const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014431 desret_xmlDocPtr(ret_val);
14432 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000014433 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000014434 des_int(n_size, size, 1);
14435 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000014436 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000014437 des_parseroptions(n_options, options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014438 xmlResetLastError();
14439 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014440 printf("Leak of %d blocks found in xmlReadMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014441 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014442 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014443 printf(" %d", n_buffer);
14444 printf(" %d", n_size);
14445 printf(" %d", n_URL);
14446 printf(" %d", n_encoding);
14447 printf(" %d", n_options);
14448 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014449 }
14450 }
14451 }
14452 }
14453 }
14454 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000014455 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014456
Daniel Veillard42595322004-11-08 10:52:06 +000014457 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014458}
14459
14460
14461static int
14462test_xmlRecoverDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014463 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014464
William M. Brack21e4ef22005-01-02 09:53:13 +000014465#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014466#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014467 int mem_base;
14468 xmlDocPtr ret_val;
14469 xmlChar * cur; /* a pointer to an array of xmlChar */
14470 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014471
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014472 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
14473 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014474 cur = gen_xmlChar_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014475
14476 ret_val = xmlRecoverDoc(cur);
14477 desret_xmlDocPtr(ret_val);
14478 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014479 des_xmlChar_ptr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014480 xmlResetLastError();
14481 if (mem_base != xmlMemBlocks()) {
14482 printf("Leak of %d blocks found in xmlRecoverDoc",
14483 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014484 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014485 printf(" %d", n_cur);
14486 printf("\n");
14487 }
14488 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014489 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014490#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014491#endif
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014492
Daniel Veillard42595322004-11-08 10:52:06 +000014493 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014494}
14495
14496
14497static int
14498test_xmlRecoverFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014499 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014500
William M. Brack21e4ef22005-01-02 09:53:13 +000014501#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014502#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000014503 int mem_base;
14504 xmlDocPtr ret_val;
14505 const char * filename; /* the filename */
14506 int n_filename;
14507
14508 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14509 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014510 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014511
14512 ret_val = xmlRecoverFile(filename);
14513 desret_xmlDocPtr(ret_val);
14514 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014515 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014516 xmlResetLastError();
14517 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014518 printf("Leak of %d blocks found in xmlRecoverFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014519 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014520 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014521 printf(" %d", n_filename);
14522 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014523 }
14524 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014525 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014526#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014527#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000014528
Daniel Veillard42595322004-11-08 10:52:06 +000014529 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014530}
14531
14532
14533static int
14534test_xmlRecoverMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014535 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014536
William M. Brack21e4ef22005-01-02 09:53:13 +000014537#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014538#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000014539 int mem_base;
14540 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014541 char * buffer; /* an pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014542 int n_buffer;
14543 int size; /* the size of the array */
14544 int n_size;
14545
14546 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14547 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14548 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014549 buffer = gen_const_char_ptr(n_buffer, 0);
14550 size = gen_int(n_size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014551
William M. Brackf13f77f2004-11-12 16:03:48 +000014552 ret_val = xmlRecoverMemory((const char *)buffer, size);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014553 desret_xmlDocPtr(ret_val);
14554 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000014555 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000014556 des_int(n_size, size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014557 xmlResetLastError();
14558 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014559 printf("Leak of %d blocks found in xmlRecoverMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014560 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014561 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014562 printf(" %d", n_buffer);
14563 printf(" %d", n_size);
14564 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014565 }
14566 }
14567 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014568 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014569#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014570#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000014571
Daniel Veillard42595322004-11-08 10:52:06 +000014572 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014573}
14574
14575
14576static int
14577test_xmlSAXParseDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014578 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014579
William M. Brack21e4ef22005-01-02 09:53:13 +000014580#if defined(LIBXML_VALID_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014581#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014582 int mem_base;
14583 xmlDtdPtr ret_val;
14584 xmlSAXHandlerPtr sax; /* the SAX handler block */
14585 int n_sax;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014586 xmlChar * ExternalID; /* a NAME* containing the External ID of the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000014587 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014588 xmlChar * SystemID; /* a NAME* containing the URL to the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000014589 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014590
Daniel Veillard34099b42004-11-04 17:34:35 +000014591 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14592 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
14593 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
14594 mem_base = xmlMemBlocks();
14595 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14596 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1);
14597 SystemID = gen_const_xmlChar_ptr(n_SystemID, 2);
14598
William M. Brackf13f77f2004-11-12 16:03:48 +000014599 ret_val = xmlSAXParseDTD(sax, (const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard34099b42004-11-04 17:34:35 +000014600 desret_xmlDtdPtr(ret_val);
14601 call_tests++;
14602 des_xmlSAXHandlerPtr(n_sax, sax, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000014603 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 1);
14604 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 2);
Daniel Veillard34099b42004-11-04 17:34:35 +000014605 xmlResetLastError();
14606 if (mem_base != xmlMemBlocks()) {
14607 printf("Leak of %d blocks found in xmlSAXParseDTD",
14608 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014609 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014610 printf(" %d", n_sax);
14611 printf(" %d", n_ExternalID);
14612 printf(" %d", n_SystemID);
14613 printf("\n");
14614 }
14615 }
14616 }
14617 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014618 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014619#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014620#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014621
Daniel Veillard42595322004-11-08 10:52:06 +000014622 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014623}
14624
14625
14626static int
14627test_xmlSAXParseDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014628 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014629
William M. Brack21e4ef22005-01-02 09:53:13 +000014630#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014631#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014632 int mem_base;
14633 xmlDocPtr ret_val;
14634 xmlSAXHandlerPtr sax; /* the SAX handler block */
14635 int n_sax;
14636 xmlChar * cur; /* a pointer to an array of xmlChar */
14637 int n_cur;
14638 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
14639 int n_recovery;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014640
Daniel Veillard34099b42004-11-04 17:34:35 +000014641 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14642 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
14643 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14644 mem_base = xmlMemBlocks();
14645 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14646 cur = gen_xmlChar_ptr(n_cur, 1);
14647 recovery = gen_int(n_recovery, 2);
14648
14649 ret_val = xmlSAXParseDoc(sax, cur, recovery);
14650 desret_xmlDocPtr(ret_val);
14651 call_tests++;
14652 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14653 des_xmlChar_ptr(n_cur, cur, 1);
14654 des_int(n_recovery, recovery, 2);
14655 xmlResetLastError();
14656 if (mem_base != xmlMemBlocks()) {
14657 printf("Leak of %d blocks found in xmlSAXParseDoc",
14658 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014659 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014660 printf(" %d", n_sax);
14661 printf(" %d", n_cur);
14662 printf(" %d", n_recovery);
14663 printf("\n");
14664 }
14665 }
14666 }
14667 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014668 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014669#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014670#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014671
Daniel Veillard42595322004-11-08 10:52:06 +000014672 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014673}
14674
14675
14676static int
14677test_xmlSAXParseEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014678 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014679
William M. Brack21e4ef22005-01-02 09:53:13 +000014680#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014681#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014682 int mem_base;
14683 xmlDocPtr ret_val;
14684 xmlSAXHandlerPtr sax; /* the SAX handler block */
14685 int n_sax;
14686 const char * filename; /* the filename */
14687 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014688
Daniel Veillard34099b42004-11-04 17:34:35 +000014689 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14690 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14691 mem_base = xmlMemBlocks();
14692 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14693 filename = gen_filepath(n_filename, 1);
14694
14695 ret_val = xmlSAXParseEntity(sax, filename);
14696 desret_xmlDocPtr(ret_val);
14697 call_tests++;
14698 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14699 des_filepath(n_filename, filename, 1);
14700 xmlResetLastError();
14701 if (mem_base != xmlMemBlocks()) {
14702 printf("Leak of %d blocks found in xmlSAXParseEntity",
14703 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014704 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014705 printf(" %d", n_sax);
14706 printf(" %d", n_filename);
14707 printf("\n");
14708 }
14709 }
14710 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014711 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014712#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014713#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014714
Daniel Veillard42595322004-11-08 10:52:06 +000014715 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014716}
14717
14718
14719static int
14720test_xmlSAXParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014721 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014722
William M. Brack21e4ef22005-01-02 09:53:13 +000014723#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014724#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014725 int mem_base;
14726 xmlDocPtr ret_val;
14727 xmlSAXHandlerPtr sax; /* the SAX handler block */
14728 int n_sax;
14729 const char * filename; /* the filename */
14730 int n_filename;
14731 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
14732 int n_recovery;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014733
Daniel Veillard34099b42004-11-04 17:34:35 +000014734 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14735 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14736 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14737 mem_base = xmlMemBlocks();
14738 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14739 filename = gen_filepath(n_filename, 1);
14740 recovery = gen_int(n_recovery, 2);
14741
14742 ret_val = xmlSAXParseFile(sax, filename, recovery);
14743 desret_xmlDocPtr(ret_val);
14744 call_tests++;
14745 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14746 des_filepath(n_filename, filename, 1);
14747 des_int(n_recovery, recovery, 2);
14748 xmlResetLastError();
14749 if (mem_base != xmlMemBlocks()) {
14750 printf("Leak of %d blocks found in xmlSAXParseFile",
14751 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014752 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014753 printf(" %d", n_sax);
14754 printf(" %d", n_filename);
14755 printf(" %d", n_recovery);
14756 printf("\n");
14757 }
14758 }
14759 }
14760 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014761 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014762#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014763#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014764
Daniel Veillard42595322004-11-08 10:52:06 +000014765 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014766}
14767
14768
14769static int
14770test_xmlSAXParseFileWithData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014771 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014772
William M. Brack21e4ef22005-01-02 09:53:13 +000014773#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014774#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014775 int mem_base;
14776 xmlDocPtr ret_val;
14777 xmlSAXHandlerPtr sax; /* the SAX handler block */
14778 int n_sax;
14779 const char * filename; /* the filename */
14780 int n_filename;
14781 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
14782 int n_recovery;
14783 void * data; /* the userdata */
14784 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014785
Daniel Veillard34099b42004-11-04 17:34:35 +000014786 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14787 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14788 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14789 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
14790 mem_base = xmlMemBlocks();
14791 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14792 filename = gen_filepath(n_filename, 1);
14793 recovery = gen_int(n_recovery, 2);
14794 data = gen_userdata(n_data, 3);
14795
14796 ret_val = xmlSAXParseFileWithData(sax, filename, recovery, data);
14797 desret_xmlDocPtr(ret_val);
14798 call_tests++;
14799 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14800 des_filepath(n_filename, filename, 1);
14801 des_int(n_recovery, recovery, 2);
14802 des_userdata(n_data, data, 3);
14803 xmlResetLastError();
14804 if (mem_base != xmlMemBlocks()) {
14805 printf("Leak of %d blocks found in xmlSAXParseFileWithData",
14806 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014807 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014808 printf(" %d", n_sax);
14809 printf(" %d", n_filename);
14810 printf(" %d", n_recovery);
14811 printf(" %d", n_data);
14812 printf("\n");
14813 }
14814 }
14815 }
14816 }
14817 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014818 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014819#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014820#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014821
Daniel Veillard42595322004-11-08 10:52:06 +000014822 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014823}
14824
14825
14826static int
14827test_xmlSAXParseMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014828 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014829
William M. Brack21e4ef22005-01-02 09:53:13 +000014830#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014831#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014832 int mem_base;
14833 xmlDocPtr ret_val;
14834 xmlSAXHandlerPtr sax; /* the SAX handler block */
14835 int n_sax;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014836 char * buffer; /* an pointer to a char array */
Daniel Veillard34099b42004-11-04 17:34:35 +000014837 int n_buffer;
14838 int size; /* the size of the array */
14839 int n_size;
14840 int recovery; /* work in recovery mode, i.e. tries to read not Well Formed documents */
14841 int n_recovery;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014842
Daniel Veillard34099b42004-11-04 17:34:35 +000014843 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14844 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14845 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14846 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14847 mem_base = xmlMemBlocks();
14848 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14849 buffer = gen_const_char_ptr(n_buffer, 1);
14850 size = gen_int(n_size, 2);
14851 recovery = gen_int(n_recovery, 3);
14852
William M. Brackf13f77f2004-11-12 16:03:48 +000014853 ret_val = xmlSAXParseMemory(sax, (const char *)buffer, size, recovery);
Daniel Veillard34099b42004-11-04 17:34:35 +000014854 desret_xmlDocPtr(ret_val);
14855 call_tests++;
14856 des_xmlSAXHandlerPtr(n_sax, sax, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000014857 des_const_char_ptr(n_buffer, (const char *)buffer, 1);
Daniel Veillard34099b42004-11-04 17:34:35 +000014858 des_int(n_size, size, 2);
14859 des_int(n_recovery, recovery, 3);
14860 xmlResetLastError();
14861 if (mem_base != xmlMemBlocks()) {
14862 printf("Leak of %d blocks found in xmlSAXParseMemory",
14863 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014864 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014865 printf(" %d", n_sax);
14866 printf(" %d", n_buffer);
14867 printf(" %d", n_size);
14868 printf(" %d", n_recovery);
14869 printf("\n");
14870 }
14871 }
14872 }
14873 }
14874 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014875 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014876#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014877#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014878
Daniel Veillard42595322004-11-08 10:52:06 +000014879 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014880}
14881
14882
14883static int
14884test_xmlSAXParseMemoryWithData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014885 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014886
William M. Brack21e4ef22005-01-02 09:53:13 +000014887#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014888#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014889 int mem_base;
14890 xmlDocPtr ret_val;
14891 xmlSAXHandlerPtr sax; /* the SAX handler block */
14892 int n_sax;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014893 char * buffer; /* an pointer to a char array */
Daniel Veillard34099b42004-11-04 17:34:35 +000014894 int n_buffer;
14895 int size; /* the size of the array */
14896 int n_size;
14897 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
14898 int n_recovery;
14899 void * data; /* the userdata */
14900 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014901
Daniel Veillard34099b42004-11-04 17:34:35 +000014902 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14903 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14904 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14905 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14906 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
14907 mem_base = xmlMemBlocks();
14908 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14909 buffer = gen_const_char_ptr(n_buffer, 1);
14910 size = gen_int(n_size, 2);
14911 recovery = gen_int(n_recovery, 3);
14912 data = gen_userdata(n_data, 4);
14913
William M. Brackf13f77f2004-11-12 16:03:48 +000014914 ret_val = xmlSAXParseMemoryWithData(sax, (const char *)buffer, size, recovery, data);
Daniel Veillard34099b42004-11-04 17:34:35 +000014915 desret_xmlDocPtr(ret_val);
14916 call_tests++;
14917 des_xmlSAXHandlerPtr(n_sax, sax, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000014918 des_const_char_ptr(n_buffer, (const char *)buffer, 1);
Daniel Veillard34099b42004-11-04 17:34:35 +000014919 des_int(n_size, size, 2);
14920 des_int(n_recovery, recovery, 3);
14921 des_userdata(n_data, data, 4);
14922 xmlResetLastError();
14923 if (mem_base != xmlMemBlocks()) {
14924 printf("Leak of %d blocks found in xmlSAXParseMemoryWithData",
14925 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014926 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014927 printf(" %d", n_sax);
14928 printf(" %d", n_buffer);
14929 printf(" %d", n_size);
14930 printf(" %d", n_recovery);
14931 printf(" %d", n_data);
14932 printf("\n");
14933 }
14934 }
14935 }
14936 }
14937 }
14938 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014939 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014940#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014941#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014942
Daniel Veillard42595322004-11-08 10:52:06 +000014943 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014944}
14945
14946
14947static int
14948test_xmlSAXUserParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014949 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014950
William M. Brack21e4ef22005-01-02 09:53:13 +000014951#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014952#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014953 int mem_base;
14954 int ret_val;
14955 xmlSAXHandlerPtr sax; /* a SAX handler */
14956 int n_sax;
14957 void * user_data; /* The user data returned on SAX callbacks */
14958 int n_user_data;
14959 const char * filename; /* a file name */
14960 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014961
Daniel Veillard34099b42004-11-04 17:34:35 +000014962 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14963 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
14964 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14965 mem_base = xmlMemBlocks();
14966 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14967 user_data = gen_userdata(n_user_data, 1);
14968 filename = gen_filepath(n_filename, 2);
Daniel Veillarda521d282004-11-09 14:59:59 +000014969
14970#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce244ad2004-11-05 10:03:46 +000014971 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
Daniel Veillarda521d282004-11-09 14:59:59 +000014972#endif
14973
Daniel Veillard34099b42004-11-04 17:34:35 +000014974
14975 ret_val = xmlSAXUserParseFile(sax, user_data, filename);
14976 desret_int(ret_val);
14977 call_tests++;
14978 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14979 des_userdata(n_user_data, user_data, 1);
14980 des_filepath(n_filename, filename, 2);
14981 xmlResetLastError();
14982 if (mem_base != xmlMemBlocks()) {
14983 printf("Leak of %d blocks found in xmlSAXUserParseFile",
14984 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014985 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014986 printf(" %d", n_sax);
14987 printf(" %d", n_user_data);
14988 printf(" %d", n_filename);
14989 printf("\n");
14990 }
14991 }
14992 }
14993 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014994 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014995#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014996#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014997
Daniel Veillard42595322004-11-08 10:52:06 +000014998 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014999}
15000
15001
15002static int
15003test_xmlSAXUserParseMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015004 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015005
William M. Brack21e4ef22005-01-02 09:53:13 +000015006#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000015007#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000015008 int mem_base;
15009 int ret_val;
15010 xmlSAXHandlerPtr sax; /* a SAX handler */
15011 int n_sax;
15012 void * user_data; /* The user data returned on SAX callbacks */
15013 int n_user_data;
Daniel Veillardce682bc2004-11-05 17:22:25 +000015014 char * buffer; /* an in-memory XML document input */
Daniel Veillard34099b42004-11-04 17:34:35 +000015015 int n_buffer;
15016 int size; /* the length of the XML document in bytes */
15017 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015018
Daniel Veillard34099b42004-11-04 17:34:35 +000015019 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
15020 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
15021 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
15022 for (n_size = 0;n_size < gen_nb_int;n_size++) {
15023 mem_base = xmlMemBlocks();
15024 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
15025 user_data = gen_userdata(n_user_data, 1);
15026 buffer = gen_const_char_ptr(n_buffer, 2);
15027 size = gen_int(n_size, 3);
Daniel Veillarda521d282004-11-09 14:59:59 +000015028
15029#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce244ad2004-11-05 10:03:46 +000015030 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
Daniel Veillarda521d282004-11-09 14:59:59 +000015031#endif
15032
Daniel Veillard34099b42004-11-04 17:34:35 +000015033
William M. Brackf13f77f2004-11-12 16:03:48 +000015034 ret_val = xmlSAXUserParseMemory(sax, user_data, (const char *)buffer, size);
Daniel Veillard34099b42004-11-04 17:34:35 +000015035 desret_int(ret_val);
15036 call_tests++;
15037 des_xmlSAXHandlerPtr(n_sax, sax, 0);
15038 des_userdata(n_user_data, user_data, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000015039 des_const_char_ptr(n_buffer, (const char *)buffer, 2);
Daniel Veillard34099b42004-11-04 17:34:35 +000015040 des_int(n_size, size, 3);
15041 xmlResetLastError();
15042 if (mem_base != xmlMemBlocks()) {
15043 printf("Leak of %d blocks found in xmlSAXUserParseMemory",
15044 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015045 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000015046 printf(" %d", n_sax);
15047 printf(" %d", n_user_data);
15048 printf(" %d", n_buffer);
15049 printf(" %d", n_size);
15050 printf("\n");
15051 }
15052 }
15053 }
15054 }
15055 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015056 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000015057#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000015058#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000015059
Daniel Veillard42595322004-11-08 10:52:06 +000015060 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015061}
15062
15063
15064static int
15065test_xmlSetExternalEntityLoader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015066 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015067
15068
15069 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000015070 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015071}
15072
15073
15074static int
15075test_xmlSetFeature(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015076 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015077
William M. Brack21e4ef22005-01-02 09:53:13 +000015078#if defined(LIBXML_LEGACY_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000015079#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015080 int mem_base;
15081 int ret_val;
15082 xmlParserCtxtPtr ctxt; /* an XML/HTML parser context */
15083 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000015084 char * name; /* the feature name */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015085 int n_name;
15086 void * value; /* pointer to the location of the new value */
15087 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015088
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015089 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15090 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
15091 for (n_value = 0;n_value < gen_nb_void_ptr;n_value++) {
15092 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015093 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15094 name = gen_const_char_ptr(n_name, 1);
15095 value = gen_void_ptr(n_value, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015096
William M. Brackf13f77f2004-11-12 16:03:48 +000015097 ret_val = xmlSetFeature(ctxt, (const char *)name, value);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015098 desret_int(ret_val);
15099 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015100 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000015101 des_const_char_ptr(n_name, (const char *)name, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000015102 des_void_ptr(n_value, value, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015103 xmlResetLastError();
15104 if (mem_base != xmlMemBlocks()) {
15105 printf("Leak of %d blocks found in xmlSetFeature",
15106 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015107 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015108 printf(" %d", n_ctxt);
15109 printf(" %d", n_name);
15110 printf(" %d", n_value);
15111 printf("\n");
15112 }
15113 }
15114 }
15115 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015116 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000015117#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000015118#endif
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015119
Daniel Veillard42595322004-11-08 10:52:06 +000015120 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015121}
15122
15123
15124static int
15125test_xmlSetupParserForBuffer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015126 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015127
William M. Brack21e4ef22005-01-02 09:53:13 +000015128#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000015129#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000015130 int mem_base;
15131 xmlParserCtxtPtr ctxt; /* an XML parser context */
15132 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000015133 xmlChar * buffer; /* a xmlChar * buffer */
Daniel Veillardd93f6252004-11-02 15:53:51 +000015134 int n_buffer;
15135 const char * filename; /* a file name */
15136 int n_filename;
15137
15138 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15139 for (n_buffer = 0;n_buffer < gen_nb_const_xmlChar_ptr;n_buffer++) {
15140 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
15141 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015142 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15143 buffer = gen_const_xmlChar_ptr(n_buffer, 1);
15144 filename = gen_filepath(n_filename, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015145
William M. Brackf13f77f2004-11-12 16:03:48 +000015146 xmlSetupParserForBuffer(ctxt, (const xmlChar *)buffer, filename);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015147 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015148 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000015149 des_const_xmlChar_ptr(n_buffer, (const xmlChar *)buffer, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000015150 des_filepath(n_filename, filename, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015151 xmlResetLastError();
15152 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000015153 printf("Leak of %d blocks found in xmlSetupParserForBuffer",
Daniel Veillardd93f6252004-11-02 15:53:51 +000015154 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015155 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000015156 printf(" %d", n_ctxt);
15157 printf(" %d", n_buffer);
15158 printf(" %d", n_filename);
15159 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000015160 }
15161 }
15162 }
15163 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015164 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000015165#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000015166#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000015167
Daniel Veillard42595322004-11-08 10:52:06 +000015168 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015169}
15170
15171
15172static int
15173test_xmlStopParser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015174 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015175
William M. Brack21e4ef22005-01-02 09:53:13 +000015176#if defined(LIBXML_PUSH_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000015177#ifdef LIBXML_PUSH_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000015178 int mem_base;
15179 xmlParserCtxtPtr ctxt; /* an XML parser context */
15180 int n_ctxt;
15181
15182 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15183 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015184 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015185
15186 xmlStopParser(ctxt);
15187 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015188 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015189 xmlResetLastError();
15190 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000015191 printf("Leak of %d blocks found in xmlStopParser",
Daniel Veillardd93f6252004-11-02 15:53:51 +000015192 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015193 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000015194 printf(" %d", n_ctxt);
15195 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000015196 }
15197 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015198 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000015199#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000015200#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000015201
Daniel Veillard42595322004-11-08 10:52:06 +000015202 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015203}
15204
15205
15206static int
15207test_xmlSubstituteEntitiesDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015208 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015209
15210 int mem_base;
15211 int ret_val;
15212 int val; /* int 0 or 1 */
15213 int n_val;
15214
15215 for (n_val = 0;n_val < gen_nb_int;n_val++) {
15216 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015217 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015218
15219 ret_val = xmlSubstituteEntitiesDefault(val);
15220 desret_int(ret_val);
15221 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015222 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015223 xmlResetLastError();
15224 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000015225 printf("Leak of %d blocks found in xmlSubstituteEntitiesDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000015226 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015227 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000015228 printf(" %d", n_val);
15229 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000015230 }
15231 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000015232 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015233
Daniel Veillard42595322004-11-08 10:52:06 +000015234 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015235}
15236
15237static int
15238test_parser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015239 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015240
William M. Brack094dd862004-11-14 14:28:34 +000015241 if (quiet == 0) printf("Testing parser : 60 of 69 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000015242 test_ret += test_xmlByteConsumed();
15243 test_ret += test_xmlClearNodeInfoSeq();
15244 test_ret += test_xmlClearParserCtxt();
15245 test_ret += test_xmlCreateDocParserCtxt();
15246 test_ret += test_xmlCreatePushParserCtxt();
15247 test_ret += test_xmlCtxtReadDoc();
15248 test_ret += test_xmlCtxtReadFile();
15249 test_ret += test_xmlCtxtReadMemory();
15250 test_ret += test_xmlCtxtReset();
15251 test_ret += test_xmlCtxtResetPush();
15252 test_ret += test_xmlCtxtUseOptions();
15253 test_ret += test_xmlGetExternalEntityLoader();
15254 test_ret += test_xmlGetFeature();
15255 test_ret += test_xmlGetFeaturesList();
15256 test_ret += test_xmlIOParseDTD();
15257 test_ret += test_xmlInitNodeInfoSeq();
15258 test_ret += test_xmlInitParser();
15259 test_ret += test_xmlInitParserCtxt();
15260 test_ret += test_xmlKeepBlanksDefault();
15261 test_ret += test_xmlLineNumbersDefault();
15262 test_ret += test_xmlLoadExternalEntity();
15263 test_ret += test_xmlNewIOInputStream();
15264 test_ret += test_xmlNewParserCtxt();
15265 test_ret += test_xmlParseBalancedChunkMemory();
15266 test_ret += test_xmlParseBalancedChunkMemoryRecover();
15267 test_ret += test_xmlParseChunk();
15268 test_ret += test_xmlParseCtxtExternalEntity();
15269 test_ret += test_xmlParseDTD();
15270 test_ret += test_xmlParseDoc();
15271 test_ret += test_xmlParseDocument();
15272 test_ret += test_xmlParseEntity();
15273 test_ret += test_xmlParseExtParsedEnt();
15274 test_ret += test_xmlParseExternalEntity();
15275 test_ret += test_xmlParseFile();
15276 test_ret += test_xmlParseInNodeContext();
15277 test_ret += test_xmlParseMemory();
15278 test_ret += test_xmlParserAddNodeInfo();
15279 test_ret += test_xmlParserFindNodeInfo();
15280 test_ret += test_xmlParserFindNodeInfoIndex();
15281 test_ret += test_xmlParserInputGrow();
15282 test_ret += test_xmlParserInputRead();
15283 test_ret += test_xmlPedanticParserDefault();
15284 test_ret += test_xmlReadDoc();
15285 test_ret += test_xmlReadFile();
15286 test_ret += test_xmlReadMemory();
15287 test_ret += test_xmlRecoverDoc();
15288 test_ret += test_xmlRecoverFile();
15289 test_ret += test_xmlRecoverMemory();
15290 test_ret += test_xmlSAXParseDTD();
15291 test_ret += test_xmlSAXParseDoc();
15292 test_ret += test_xmlSAXParseEntity();
15293 test_ret += test_xmlSAXParseFile();
15294 test_ret += test_xmlSAXParseFileWithData();
15295 test_ret += test_xmlSAXParseMemory();
15296 test_ret += test_xmlSAXParseMemoryWithData();
15297 test_ret += test_xmlSAXUserParseFile();
15298 test_ret += test_xmlSAXUserParseMemory();
15299 test_ret += test_xmlSetExternalEntityLoader();
15300 test_ret += test_xmlSetFeature();
15301 test_ret += test_xmlSetupParserForBuffer();
15302 test_ret += test_xmlStopParser();
15303 test_ret += test_xmlSubstituteEntitiesDefault();
Daniel Veillardd93f6252004-11-02 15:53:51 +000015304
Daniel Veillard42595322004-11-08 10:52:06 +000015305 if (test_ret != 0)
15306 printf("Module parser: %d errors\n", test_ret);
15307 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015308}
15309
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015310static int
15311test_htmlCreateFileParserCtxt(void) {
15312 int test_ret = 0;
15313
William M. Brack21e4ef22005-01-02 09:53:13 +000015314#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015315 int mem_base;
15316 htmlParserCtxtPtr ret_val;
15317 const char * filename; /* the filename */
15318 int n_filename;
15319 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
15320 int n_encoding;
15321
15322 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
15323 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
15324 mem_base = xmlMemBlocks();
15325 filename = gen_fileoutput(n_filename, 0);
15326 encoding = gen_const_char_ptr(n_encoding, 1);
15327
William M. Brackf13f77f2004-11-12 16:03:48 +000015328 ret_val = htmlCreateFileParserCtxt(filename, (const char *)encoding);
Daniel Veillarda521d282004-11-09 14:59:59 +000015329 desret_htmlParserCtxtPtr(ret_val);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015330 call_tests++;
15331 des_fileoutput(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000015332 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015333 xmlResetLastError();
15334 if (mem_base != xmlMemBlocks()) {
15335 printf("Leak of %d blocks found in htmlCreateFileParserCtxt",
15336 xmlMemBlocks() - mem_base);
15337 test_ret++;
15338 printf(" %d", n_filename);
15339 printf(" %d", n_encoding);
15340 printf("\n");
15341 }
15342 }
15343 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015344 function_tests++;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015345#endif
15346
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015347 return(test_ret);
15348}
15349
15350
15351static int
15352test_htmlInitAutoClose(void) {
15353 int test_ret = 0;
15354
William M. Brack21e4ef22005-01-02 09:53:13 +000015355#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015356 int mem_base;
15357
15358 mem_base = xmlMemBlocks();
15359
15360 htmlInitAutoClose();
15361 call_tests++;
15362 xmlResetLastError();
15363 if (mem_base != xmlMemBlocks()) {
15364 printf("Leak of %d blocks found in htmlInitAutoClose",
15365 xmlMemBlocks() - mem_base);
15366 test_ret++;
15367 printf("\n");
15368 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015369 function_tests++;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015370#endif
15371
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015372 return(test_ret);
15373}
15374
15375
15376static int
15377test_inputPop(void) {
15378 int test_ret = 0;
15379
15380 int mem_base;
15381 xmlParserInputPtr ret_val;
15382 xmlParserCtxtPtr ctxt; /* an XML parser context */
15383 int n_ctxt;
15384
15385 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15386 mem_base = xmlMemBlocks();
15387 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15388
15389 ret_val = inputPop(ctxt);
15390 desret_xmlParserInputPtr(ret_val);
15391 call_tests++;
15392 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15393 xmlResetLastError();
15394 if (mem_base != xmlMemBlocks()) {
15395 printf("Leak of %d blocks found in inputPop",
15396 xmlMemBlocks() - mem_base);
15397 test_ret++;
15398 printf(" %d", n_ctxt);
15399 printf("\n");
15400 }
15401 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015402 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015403
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015404 return(test_ret);
15405}
15406
15407
15408static int
15409test_inputPush(void) {
15410 int test_ret = 0;
15411
15412 int mem_base;
15413 int ret_val;
15414 xmlParserCtxtPtr ctxt; /* an XML parser context */
15415 int n_ctxt;
15416 xmlParserInputPtr value; /* the parser input */
15417 int n_value;
15418
15419 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15420 for (n_value = 0;n_value < gen_nb_xmlParserInputPtr;n_value++) {
15421 mem_base = xmlMemBlocks();
15422 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15423 value = gen_xmlParserInputPtr(n_value, 1);
15424
15425 ret_val = inputPush(ctxt, value);
15426 desret_int(ret_val);
15427 call_tests++;
15428 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15429 des_xmlParserInputPtr(n_value, value, 1);
15430 xmlResetLastError();
15431 if (mem_base != xmlMemBlocks()) {
15432 printf("Leak of %d blocks found in inputPush",
15433 xmlMemBlocks() - mem_base);
15434 test_ret++;
15435 printf(" %d", n_ctxt);
15436 printf(" %d", n_value);
15437 printf("\n");
15438 }
15439 }
15440 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015441 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015442
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015443 return(test_ret);
15444}
15445
15446
15447static int
15448test_namePop(void) {
15449 int test_ret = 0;
15450
15451 int mem_base;
15452 const xmlChar * ret_val;
15453 xmlParserCtxtPtr ctxt; /* an XML parser context */
15454 int n_ctxt;
15455
15456 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15457 mem_base = xmlMemBlocks();
15458 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15459
15460 ret_val = namePop(ctxt);
15461 desret_const_xmlChar_ptr(ret_val);
15462 call_tests++;
15463 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15464 xmlResetLastError();
15465 if (mem_base != xmlMemBlocks()) {
15466 printf("Leak of %d blocks found in namePop",
15467 xmlMemBlocks() - mem_base);
15468 test_ret++;
15469 printf(" %d", n_ctxt);
15470 printf("\n");
15471 }
15472 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015473 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015474
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015475 return(test_ret);
15476}
15477
15478
15479static int
15480test_namePush(void) {
15481 int test_ret = 0;
15482
15483 int mem_base;
15484 int ret_val;
15485 xmlParserCtxtPtr ctxt; /* an XML parser context */
15486 int n_ctxt;
15487 xmlChar * value; /* the element name */
15488 int n_value;
15489
15490 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15491 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
15492 mem_base = xmlMemBlocks();
15493 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15494 value = gen_const_xmlChar_ptr(n_value, 1);
15495
William M. Brackf13f77f2004-11-12 16:03:48 +000015496 ret_val = namePush(ctxt, (const xmlChar *)value);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015497 desret_int(ret_val);
15498 call_tests++;
15499 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000015500 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015501 xmlResetLastError();
15502 if (mem_base != xmlMemBlocks()) {
15503 printf("Leak of %d blocks found in namePush",
15504 xmlMemBlocks() - mem_base);
15505 test_ret++;
15506 printf(" %d", n_ctxt);
15507 printf(" %d", n_value);
15508 printf("\n");
15509 }
15510 }
15511 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015512 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015513
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015514 return(test_ret);
15515}
15516
15517
15518static int
15519test_nodePop(void) {
15520 int test_ret = 0;
15521
15522 int mem_base;
15523 xmlNodePtr ret_val;
15524 xmlParserCtxtPtr ctxt; /* an XML parser context */
15525 int n_ctxt;
15526
15527 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15528 mem_base = xmlMemBlocks();
15529 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15530
15531 ret_val = nodePop(ctxt);
15532 desret_xmlNodePtr(ret_val);
15533 call_tests++;
15534 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15535 xmlResetLastError();
15536 if (mem_base != xmlMemBlocks()) {
15537 printf("Leak of %d blocks found in nodePop",
15538 xmlMemBlocks() - mem_base);
15539 test_ret++;
15540 printf(" %d", n_ctxt);
15541 printf("\n");
15542 }
15543 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015544 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015545
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015546 return(test_ret);
15547}
15548
15549
15550static int
15551test_nodePush(void) {
15552 int test_ret = 0;
15553
15554 int mem_base;
15555 int ret_val;
15556 xmlParserCtxtPtr ctxt; /* an XML parser context */
15557 int n_ctxt;
15558 xmlNodePtr value; /* the element node */
15559 int n_value;
15560
15561 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15562 for (n_value = 0;n_value < gen_nb_xmlNodePtr;n_value++) {
15563 mem_base = xmlMemBlocks();
15564 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15565 value = gen_xmlNodePtr(n_value, 1);
15566
15567 ret_val = nodePush(ctxt, value);
15568 desret_int(ret_val);
15569 call_tests++;
15570 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15571 des_xmlNodePtr(n_value, value, 1);
15572 xmlResetLastError();
15573 if (mem_base != xmlMemBlocks()) {
15574 printf("Leak of %d blocks found in nodePush",
15575 xmlMemBlocks() - mem_base);
15576 test_ret++;
15577 printf(" %d", n_ctxt);
15578 printf(" %d", n_value);
15579 printf("\n");
15580 }
15581 }
15582 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015583 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015584
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015585 return(test_ret);
15586}
15587
15588
15589static int
15590test_xmlCheckLanguageID(void) {
15591 int test_ret = 0;
15592
15593 int mem_base;
15594 int ret_val;
15595 xmlChar * lang; /* pointer to the string value */
15596 int n_lang;
15597
15598 for (n_lang = 0;n_lang < gen_nb_const_xmlChar_ptr;n_lang++) {
15599 mem_base = xmlMemBlocks();
15600 lang = gen_const_xmlChar_ptr(n_lang, 0);
15601
William M. Brackf13f77f2004-11-12 16:03:48 +000015602 ret_val = xmlCheckLanguageID((const xmlChar *)lang);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015603 desret_int(ret_val);
15604 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000015605 des_const_xmlChar_ptr(n_lang, (const xmlChar *)lang, 0);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015606 xmlResetLastError();
15607 if (mem_base != xmlMemBlocks()) {
15608 printf("Leak of %d blocks found in xmlCheckLanguageID",
15609 xmlMemBlocks() - mem_base);
15610 test_ret++;
15611 printf(" %d", n_lang);
15612 printf("\n");
15613 }
15614 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015615 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015616
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015617 return(test_ret);
15618}
15619
15620
15621static int
15622test_xmlCopyChar(void) {
15623 int test_ret = 0;
15624
15625 int mem_base;
15626 int ret_val;
15627 int len; /* Ignored, compatibility */
15628 int n_len;
15629 xmlChar * out; /* pointer to an array of xmlChar */
15630 int n_out;
15631 int val; /* the char value */
15632 int n_val;
15633
15634 for (n_len = 0;n_len < gen_nb_int;n_len++) {
15635 for (n_out = 0;n_out < gen_nb_xmlChar_ptr;n_out++) {
15636 for (n_val = 0;n_val < gen_nb_int;n_val++) {
15637 mem_base = xmlMemBlocks();
15638 len = gen_int(n_len, 0);
15639 out = gen_xmlChar_ptr(n_out, 1);
15640 val = gen_int(n_val, 2);
15641
15642 ret_val = xmlCopyChar(len, out, val);
15643 desret_int(ret_val);
15644 call_tests++;
15645 des_int(n_len, len, 0);
15646 des_xmlChar_ptr(n_out, out, 1);
15647 des_int(n_val, val, 2);
15648 xmlResetLastError();
15649 if (mem_base != xmlMemBlocks()) {
15650 printf("Leak of %d blocks found in xmlCopyChar",
15651 xmlMemBlocks() - mem_base);
15652 test_ret++;
15653 printf(" %d", n_len);
15654 printf(" %d", n_out);
15655 printf(" %d", n_val);
15656 printf("\n");
15657 }
15658 }
15659 }
15660 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015661 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015662
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015663 return(test_ret);
15664}
15665
15666
15667static int
15668test_xmlCopyCharMultiByte(void) {
15669 int test_ret = 0;
15670
15671 int mem_base;
15672 int ret_val;
15673 xmlChar * out; /* pointer to an array of xmlChar */
15674 int n_out;
15675 int val; /* the char value */
15676 int n_val;
15677
15678 for (n_out = 0;n_out < gen_nb_xmlChar_ptr;n_out++) {
15679 for (n_val = 0;n_val < gen_nb_int;n_val++) {
15680 mem_base = xmlMemBlocks();
15681 out = gen_xmlChar_ptr(n_out, 0);
15682 val = gen_int(n_val, 1);
15683
15684 ret_val = xmlCopyCharMultiByte(out, val);
15685 desret_int(ret_val);
15686 call_tests++;
15687 des_xmlChar_ptr(n_out, out, 0);
15688 des_int(n_val, val, 1);
15689 xmlResetLastError();
15690 if (mem_base != xmlMemBlocks()) {
15691 printf("Leak of %d blocks found in xmlCopyCharMultiByte",
15692 xmlMemBlocks() - mem_base);
15693 test_ret++;
15694 printf(" %d", n_out);
15695 printf(" %d", n_val);
15696 printf("\n");
15697 }
15698 }
15699 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015700 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015701
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015702 return(test_ret);
15703}
15704
15705
15706static int
15707test_xmlCreateEntityParserCtxt(void) {
15708 int test_ret = 0;
15709
15710 int mem_base;
15711 xmlParserCtxtPtr ret_val;
15712 xmlChar * URL; /* the entity URL */
15713 int n_URL;
15714 xmlChar * ID; /* the entity PUBLIC ID */
15715 int n_ID;
15716 xmlChar * base; /* a possible base for the target URI */
15717 int n_base;
15718
15719 for (n_URL = 0;n_URL < gen_nb_const_xmlChar_ptr;n_URL++) {
15720 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
15721 for (n_base = 0;n_base < gen_nb_const_xmlChar_ptr;n_base++) {
15722 mem_base = xmlMemBlocks();
15723 URL = gen_const_xmlChar_ptr(n_URL, 0);
15724 ID = gen_const_xmlChar_ptr(n_ID, 1);
15725 base = gen_const_xmlChar_ptr(n_base, 2);
15726
William M. Brackf13f77f2004-11-12 16:03:48 +000015727 ret_val = xmlCreateEntityParserCtxt((const xmlChar *)URL, (const xmlChar *)ID, (const xmlChar *)base);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015728 desret_xmlParserCtxtPtr(ret_val);
15729 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000015730 des_const_xmlChar_ptr(n_URL, (const xmlChar *)URL, 0);
15731 des_const_xmlChar_ptr(n_ID, (const xmlChar *)ID, 1);
15732 des_const_xmlChar_ptr(n_base, (const xmlChar *)base, 2);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015733 xmlResetLastError();
15734 if (mem_base != xmlMemBlocks()) {
15735 printf("Leak of %d blocks found in xmlCreateEntityParserCtxt",
15736 xmlMemBlocks() - mem_base);
15737 test_ret++;
15738 printf(" %d", n_URL);
15739 printf(" %d", n_ID);
15740 printf(" %d", n_base);
15741 printf("\n");
15742 }
15743 }
15744 }
15745 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015746 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015747
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015748 return(test_ret);
15749}
15750
15751
15752static int
15753test_xmlCreateFileParserCtxt(void) {
15754 int test_ret = 0;
15755
15756 int mem_base;
15757 xmlParserCtxtPtr ret_val;
15758 const char * filename; /* the filename */
15759 int n_filename;
15760
15761 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
15762 mem_base = xmlMemBlocks();
15763 filename = gen_fileoutput(n_filename, 0);
15764
15765 ret_val = xmlCreateFileParserCtxt(filename);
15766 desret_xmlParserCtxtPtr(ret_val);
15767 call_tests++;
15768 des_fileoutput(n_filename, filename, 0);
15769 xmlResetLastError();
15770 if (mem_base != xmlMemBlocks()) {
15771 printf("Leak of %d blocks found in xmlCreateFileParserCtxt",
15772 xmlMemBlocks() - mem_base);
15773 test_ret++;
15774 printf(" %d", n_filename);
15775 printf("\n");
15776 }
15777 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015778 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015779
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015780 return(test_ret);
15781}
15782
15783
15784static int
15785test_xmlCreateMemoryParserCtxt(void) {
15786 int test_ret = 0;
15787
15788 int mem_base;
15789 xmlParserCtxtPtr ret_val;
15790 char * buffer; /* a pointer to a char array */
15791 int n_buffer;
15792 int size; /* the size of the array */
15793 int n_size;
15794
15795 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
15796 for (n_size = 0;n_size < gen_nb_int;n_size++) {
15797 mem_base = xmlMemBlocks();
15798 buffer = gen_const_char_ptr(n_buffer, 0);
15799 size = gen_int(n_size, 1);
15800
William M. Brackf13f77f2004-11-12 16:03:48 +000015801 ret_val = xmlCreateMemoryParserCtxt((const char *)buffer, size);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015802 desret_xmlParserCtxtPtr(ret_val);
15803 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000015804 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015805 des_int(n_size, size, 1);
15806 xmlResetLastError();
15807 if (mem_base != xmlMemBlocks()) {
15808 printf("Leak of %d blocks found in xmlCreateMemoryParserCtxt",
15809 xmlMemBlocks() - mem_base);
15810 test_ret++;
15811 printf(" %d", n_buffer);
15812 printf(" %d", n_size);
15813 printf("\n");
15814 }
15815 }
15816 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015817 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015818
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015819 return(test_ret);
15820}
15821
15822
15823static int
15824test_xmlCreateURLParserCtxt(void) {
15825 int test_ret = 0;
15826
15827 int mem_base;
15828 xmlParserCtxtPtr ret_val;
15829 const char * filename; /* the filename or URL */
15830 int n_filename;
15831 int options; /* a combination of xmlParserOption */
15832 int n_options;
15833
15834 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
15835 for (n_options = 0;n_options < gen_nb_int;n_options++) {
15836 mem_base = xmlMemBlocks();
15837 filename = gen_fileoutput(n_filename, 0);
15838 options = gen_int(n_options, 1);
15839
15840 ret_val = xmlCreateURLParserCtxt(filename, options);
15841 desret_xmlParserCtxtPtr(ret_val);
15842 call_tests++;
15843 des_fileoutput(n_filename, filename, 0);
15844 des_int(n_options, options, 1);
15845 xmlResetLastError();
15846 if (mem_base != xmlMemBlocks()) {
15847 printf("Leak of %d blocks found in xmlCreateURLParserCtxt",
15848 xmlMemBlocks() - mem_base);
15849 test_ret++;
15850 printf(" %d", n_filename);
15851 printf(" %d", n_options);
15852 printf("\n");
15853 }
15854 }
15855 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015856 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015857
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015858 return(test_ret);
15859}
15860
15861
15862static int
15863test_xmlCurrentChar(void) {
15864 int test_ret = 0;
15865
15866 int mem_base;
15867 int ret_val;
15868 xmlParserCtxtPtr ctxt; /* the XML parser context */
15869 int n_ctxt;
15870 int * len; /* pointer to the length of the char read */
15871 int n_len;
15872
15873 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15874 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
15875 mem_base = xmlMemBlocks();
15876 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15877 len = gen_int_ptr(n_len, 1);
15878
15879 ret_val = xmlCurrentChar(ctxt, len);
15880 desret_int(ret_val);
15881 call_tests++;
15882 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15883 des_int_ptr(n_len, len, 1);
15884 xmlResetLastError();
15885 if (mem_base != xmlMemBlocks()) {
15886 printf("Leak of %d blocks found in xmlCurrentChar",
15887 xmlMemBlocks() - mem_base);
15888 test_ret++;
15889 printf(" %d", n_ctxt);
15890 printf(" %d", n_len);
15891 printf("\n");
15892 }
15893 }
15894 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015895 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015896
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015897 return(test_ret);
15898}
15899
15900
15901static int
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015902test_xmlErrMemory(void) {
15903 int test_ret = 0;
15904
15905 int mem_base;
15906 xmlParserCtxtPtr ctxt; /* an XML parser context */
15907 int n_ctxt;
15908 char * extra; /* extra informations */
15909 int n_extra;
15910
15911 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15912 for (n_extra = 0;n_extra < gen_nb_const_char_ptr;n_extra++) {
15913 mem_base = xmlMemBlocks();
15914 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15915 extra = gen_const_char_ptr(n_extra, 1);
15916
William M. Brackf13f77f2004-11-12 16:03:48 +000015917 xmlErrMemory(ctxt, (const char *)extra);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015918 call_tests++;
15919 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000015920 des_const_char_ptr(n_extra, (const char *)extra, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015921 xmlResetLastError();
15922 if (mem_base != xmlMemBlocks()) {
15923 printf("Leak of %d blocks found in xmlErrMemory",
15924 xmlMemBlocks() - mem_base);
15925 test_ret++;
15926 printf(" %d", n_ctxt);
15927 printf(" %d", n_extra);
15928 printf("\n");
15929 }
15930 }
15931 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015932 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015933
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015934 return(test_ret);
15935}
15936
15937
15938static int
15939test_xmlIsLetter(void) {
15940 int test_ret = 0;
15941
15942 int mem_base;
15943 int ret_val;
15944 int c; /* an unicode character (int) */
15945 int n_c;
15946
15947 for (n_c = 0;n_c < gen_nb_int;n_c++) {
15948 mem_base = xmlMemBlocks();
15949 c = gen_int(n_c, 0);
15950
15951 ret_val = xmlIsLetter(c);
15952 desret_int(ret_val);
15953 call_tests++;
15954 des_int(n_c, c, 0);
15955 xmlResetLastError();
15956 if (mem_base != xmlMemBlocks()) {
15957 printf("Leak of %d blocks found in xmlIsLetter",
15958 xmlMemBlocks() - mem_base);
15959 test_ret++;
15960 printf(" %d", n_c);
15961 printf("\n");
15962 }
15963 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015964 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015965
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015966 return(test_ret);
15967}
15968
15969
15970static int
15971test_xmlNewEntityInputStream(void) {
15972 int test_ret = 0;
15973
15974 int mem_base;
15975 xmlParserInputPtr ret_val;
15976 xmlParserCtxtPtr ctxt; /* an XML parser context */
15977 int n_ctxt;
15978 xmlEntityPtr entity; /* an Entity pointer */
15979 int n_entity;
15980
15981 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15982 for (n_entity = 0;n_entity < gen_nb_xmlEntityPtr;n_entity++) {
15983 mem_base = xmlMemBlocks();
15984 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15985 entity = gen_xmlEntityPtr(n_entity, 1);
15986
15987 ret_val = xmlNewEntityInputStream(ctxt, entity);
15988 desret_xmlParserInputPtr(ret_val);
15989 call_tests++;
15990 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15991 des_xmlEntityPtr(n_entity, entity, 1);
15992 xmlResetLastError();
15993 if (mem_base != xmlMemBlocks()) {
15994 printf("Leak of %d blocks found in xmlNewEntityInputStream",
15995 xmlMemBlocks() - mem_base);
15996 test_ret++;
15997 printf(" %d", n_ctxt);
15998 printf(" %d", n_entity);
15999 printf("\n");
16000 }
16001 }
16002 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016003 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016004
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016005 return(test_ret);
16006}
16007
16008
16009static int
16010test_xmlNewInputFromFile(void) {
16011 int test_ret = 0;
16012
16013 int mem_base;
16014 xmlParserInputPtr ret_val;
16015 xmlParserCtxtPtr ctxt; /* an XML parser context */
16016 int n_ctxt;
16017 const char * filename; /* the filename to use as entity */
16018 int n_filename;
16019
16020 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16021 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
16022 mem_base = xmlMemBlocks();
16023 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16024 filename = gen_filepath(n_filename, 1);
16025
16026 ret_val = xmlNewInputFromFile(ctxt, filename);
16027 desret_xmlParserInputPtr(ret_val);
16028 call_tests++;
16029 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16030 des_filepath(n_filename, filename, 1);
16031 xmlResetLastError();
16032 if (mem_base != xmlMemBlocks()) {
16033 printf("Leak of %d blocks found in xmlNewInputFromFile",
16034 xmlMemBlocks() - mem_base);
16035 test_ret++;
16036 printf(" %d", n_ctxt);
16037 printf(" %d", n_filename);
16038 printf("\n");
16039 }
16040 }
16041 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016042 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016043
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016044 return(test_ret);
16045}
16046
16047
16048static int
16049test_xmlNewInputStream(void) {
16050 int test_ret = 0;
16051
16052 int mem_base;
16053 xmlParserInputPtr ret_val;
16054 xmlParserCtxtPtr ctxt; /* an XML parser context */
16055 int n_ctxt;
16056
16057 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16058 mem_base = xmlMemBlocks();
16059 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16060
16061 ret_val = xmlNewInputStream(ctxt);
16062 desret_xmlParserInputPtr(ret_val);
16063 call_tests++;
16064 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16065 xmlResetLastError();
16066 if (mem_base != xmlMemBlocks()) {
16067 printf("Leak of %d blocks found in xmlNewInputStream",
16068 xmlMemBlocks() - mem_base);
16069 test_ret++;
16070 printf(" %d", n_ctxt);
16071 printf("\n");
16072 }
16073 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016074 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016075
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016076 return(test_ret);
16077}
16078
16079
16080static int
16081test_xmlNewStringInputStream(void) {
16082 int test_ret = 0;
16083
16084 int mem_base;
16085 xmlParserInputPtr ret_val;
16086 xmlParserCtxtPtr ctxt; /* an XML parser context */
16087 int n_ctxt;
16088 xmlChar * buffer; /* an memory buffer */
16089 int n_buffer;
16090
16091 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16092 for (n_buffer = 0;n_buffer < gen_nb_const_xmlChar_ptr;n_buffer++) {
16093 mem_base = xmlMemBlocks();
16094 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16095 buffer = gen_const_xmlChar_ptr(n_buffer, 1);
16096
William M. Brackf13f77f2004-11-12 16:03:48 +000016097 ret_val = xmlNewStringInputStream(ctxt, (const xmlChar *)buffer);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016098 desret_xmlParserInputPtr(ret_val);
16099 call_tests++;
16100 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000016101 des_const_xmlChar_ptr(n_buffer, (const xmlChar *)buffer, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016102 xmlResetLastError();
16103 if (mem_base != xmlMemBlocks()) {
16104 printf("Leak of %d blocks found in xmlNewStringInputStream",
16105 xmlMemBlocks() - mem_base);
16106 test_ret++;
16107 printf(" %d", n_ctxt);
16108 printf(" %d", n_buffer);
16109 printf("\n");
16110 }
16111 }
16112 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016113 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016114
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016115 return(test_ret);
16116}
16117
16118
16119static int
16120test_xmlNextChar(void) {
16121 int test_ret = 0;
16122
16123 int mem_base;
16124 xmlParserCtxtPtr ctxt; /* the XML parser context */
16125 int n_ctxt;
16126
16127 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16128 mem_base = xmlMemBlocks();
16129 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16130
16131 xmlNextChar(ctxt);
16132 call_tests++;
16133 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16134 xmlResetLastError();
16135 if (mem_base != xmlMemBlocks()) {
16136 printf("Leak of %d blocks found in xmlNextChar",
16137 xmlMemBlocks() - mem_base);
16138 test_ret++;
16139 printf(" %d", n_ctxt);
16140 printf("\n");
16141 }
16142 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016143 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016144
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016145 return(test_ret);
16146}
16147
16148
16149static int
16150test_xmlParserInputShrink(void) {
16151 int test_ret = 0;
16152
16153 int mem_base;
16154 xmlParserInputPtr in; /* an XML parser input */
16155 int n_in;
16156
16157 for (n_in = 0;n_in < gen_nb_xmlParserInputPtr;n_in++) {
16158 mem_base = xmlMemBlocks();
16159 in = gen_xmlParserInputPtr(n_in, 0);
16160
16161 xmlParserInputShrink(in);
16162 call_tests++;
16163 des_xmlParserInputPtr(n_in, in, 0);
16164 xmlResetLastError();
16165 if (mem_base != xmlMemBlocks()) {
16166 printf("Leak of %d blocks found in xmlParserInputShrink",
16167 xmlMemBlocks() - mem_base);
16168 test_ret++;
16169 printf(" %d", n_in);
16170 printf("\n");
16171 }
16172 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016173 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016174
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016175 return(test_ret);
16176}
16177
16178
16179static int
16180test_xmlPopInput(void) {
16181 int test_ret = 0;
16182
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016183 int mem_base;
16184 xmlChar ret_val;
16185 xmlParserCtxtPtr ctxt; /* an XML parser context */
16186 int n_ctxt;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016187
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016188 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16189 mem_base = xmlMemBlocks();
16190 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16191
16192 ret_val = xmlPopInput(ctxt);
16193 desret_xmlChar(ret_val);
16194 call_tests++;
16195 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16196 xmlResetLastError();
16197 if (mem_base != xmlMemBlocks()) {
16198 printf("Leak of %d blocks found in xmlPopInput",
16199 xmlMemBlocks() - mem_base);
16200 test_ret++;
16201 printf(" %d", n_ctxt);
16202 printf("\n");
16203 }
16204 }
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016205 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016206
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016207 return(test_ret);
16208}
16209
16210
16211static int
16212test_xmlPushInput(void) {
16213 int test_ret = 0;
16214
16215 int mem_base;
16216 xmlParserCtxtPtr ctxt; /* an XML parser context */
16217 int n_ctxt;
16218 xmlParserInputPtr input; /* an XML parser input fragment (entity, XML fragment ...). */
16219 int n_input;
16220
16221 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16222 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
16223 mem_base = xmlMemBlocks();
16224 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16225 input = gen_xmlParserInputPtr(n_input, 1);
16226
16227 xmlPushInput(ctxt, input);
16228 call_tests++;
16229 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16230 des_xmlParserInputPtr(n_input, input, 1);
16231 xmlResetLastError();
16232 if (mem_base != xmlMemBlocks()) {
16233 printf("Leak of %d blocks found in xmlPushInput",
16234 xmlMemBlocks() - mem_base);
16235 test_ret++;
16236 printf(" %d", n_ctxt);
16237 printf(" %d", n_input);
16238 printf("\n");
16239 }
16240 }
16241 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016242 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016243
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016244 return(test_ret);
16245}
16246
16247
16248static int
16249test_xmlSetEntityReferenceFunc(void) {
16250 int test_ret = 0;
16251
16252
16253 /* missing type support */
16254 return(test_ret);
16255}
16256
16257
16258static int
16259test_xmlSplitQName(void) {
16260 int test_ret = 0;
16261
16262 int mem_base;
16263 xmlChar * ret_val;
16264 xmlParserCtxtPtr ctxt; /* an XML parser context */
16265 int n_ctxt;
16266 xmlChar * name; /* an XML parser context */
16267 int n_name;
16268 xmlChar ** prefix; /* a xmlChar ** */
16269 int n_prefix;
16270
16271 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16272 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
16273 for (n_prefix = 0;n_prefix < gen_nb_xmlChar_ptr_ptr;n_prefix++) {
16274 mem_base = xmlMemBlocks();
16275 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16276 name = gen_const_xmlChar_ptr(n_name, 1);
16277 prefix = gen_xmlChar_ptr_ptr(n_prefix, 2);
16278
William M. Brackf13f77f2004-11-12 16:03:48 +000016279 ret_val = xmlSplitQName(ctxt, (const xmlChar *)name, prefix);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016280 desret_xmlChar_ptr(ret_val);
16281 call_tests++;
16282 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000016283 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016284 des_xmlChar_ptr_ptr(n_prefix, prefix, 2);
16285 xmlResetLastError();
16286 if (mem_base != xmlMemBlocks()) {
16287 printf("Leak of %d blocks found in xmlSplitQName",
16288 xmlMemBlocks() - mem_base);
16289 test_ret++;
16290 printf(" %d", n_ctxt);
16291 printf(" %d", n_name);
16292 printf(" %d", n_prefix);
16293 printf("\n");
16294 }
16295 }
16296 }
16297 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016298 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016299
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016300 return(test_ret);
16301}
16302
16303
16304static int
16305test_xmlStringCurrentChar(void) {
16306 int test_ret = 0;
16307
16308 int mem_base;
16309 int ret_val;
16310 xmlParserCtxtPtr ctxt; /* the XML parser context */
16311 int n_ctxt;
16312 xmlChar * cur; /* pointer to the beginning of the char */
16313 int n_cur;
16314 int * len; /* pointer to the length of the char read */
16315 int n_len;
16316
16317 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16318 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
16319 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
16320 mem_base = xmlMemBlocks();
16321 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16322 cur = gen_const_xmlChar_ptr(n_cur, 1);
16323 len = gen_int_ptr(n_len, 2);
16324
William M. Brackf13f77f2004-11-12 16:03:48 +000016325 ret_val = xmlStringCurrentChar(ctxt, (const xmlChar *)cur, len);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016326 desret_int(ret_val);
16327 call_tests++;
16328 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000016329 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016330 des_int_ptr(n_len, len, 2);
16331 xmlResetLastError();
16332 if (mem_base != xmlMemBlocks()) {
16333 printf("Leak of %d blocks found in xmlStringCurrentChar",
16334 xmlMemBlocks() - mem_base);
16335 test_ret++;
16336 printf(" %d", n_ctxt);
16337 printf(" %d", n_cur);
16338 printf(" %d", n_len);
16339 printf("\n");
16340 }
16341 }
16342 }
16343 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016344 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016345
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016346 return(test_ret);
16347}
16348
16349
16350static int
16351test_xmlStringDecodeEntities(void) {
16352 int test_ret = 0;
16353
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016354 int mem_base;
16355 xmlChar * ret_val;
16356 xmlParserCtxtPtr ctxt; /* the parser context */
16357 int n_ctxt;
16358 xmlChar * str; /* the input string */
16359 int n_str;
16360 int what; /* combination of XML_SUBSTITUTE_REF and XML_SUBSTITUTE_PEREF */
16361 int n_what;
16362 xmlChar end; /* an end marker xmlChar, 0 if none */
16363 int n_end;
16364 xmlChar end2; /* an end marker xmlChar, 0 if none */
16365 int n_end2;
16366 xmlChar end3; /* an end marker xmlChar, 0 if none */
16367 int n_end3;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016368
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016369 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16370 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
16371 for (n_what = 0;n_what < gen_nb_int;n_what++) {
16372 for (n_end = 0;n_end < gen_nb_xmlChar;n_end++) {
16373 for (n_end2 = 0;n_end2 < gen_nb_xmlChar;n_end2++) {
16374 for (n_end3 = 0;n_end3 < gen_nb_xmlChar;n_end3++) {
16375 mem_base = xmlMemBlocks();
16376 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16377 str = gen_const_xmlChar_ptr(n_str, 1);
16378 what = gen_int(n_what, 2);
16379 end = gen_xmlChar(n_end, 3);
16380 end2 = gen_xmlChar(n_end2, 4);
16381 end3 = gen_xmlChar(n_end3, 5);
16382
William M. Brackf13f77f2004-11-12 16:03:48 +000016383 ret_val = xmlStringDecodeEntities(ctxt, (const xmlChar *)str, what, end, end2, end3);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016384 desret_xmlChar_ptr(ret_val);
16385 call_tests++;
16386 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000016387 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016388 des_int(n_what, what, 2);
16389 des_xmlChar(n_end, end, 3);
16390 des_xmlChar(n_end2, end2, 4);
16391 des_xmlChar(n_end3, end3, 5);
16392 xmlResetLastError();
16393 if (mem_base != xmlMemBlocks()) {
16394 printf("Leak of %d blocks found in xmlStringDecodeEntities",
16395 xmlMemBlocks() - mem_base);
16396 test_ret++;
16397 printf(" %d", n_ctxt);
16398 printf(" %d", n_str);
16399 printf(" %d", n_what);
16400 printf(" %d", n_end);
16401 printf(" %d", n_end2);
16402 printf(" %d", n_end3);
16403 printf("\n");
16404 }
16405 }
16406 }
16407 }
16408 }
16409 }
16410 }
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016411 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016412
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016413 return(test_ret);
16414}
16415
16416
16417static int
16418test_xmlStringLenDecodeEntities(void) {
16419 int test_ret = 0;
16420
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016421 int mem_base;
16422 xmlChar * ret_val;
16423 xmlParserCtxtPtr ctxt; /* the parser context */
16424 int n_ctxt;
16425 xmlChar * str; /* the input string */
16426 int n_str;
16427 int len; /* the string length */
16428 int n_len;
16429 int what; /* combination of XML_SUBSTITUTE_REF and XML_SUBSTITUTE_PEREF */
16430 int n_what;
16431 xmlChar end; /* an end marker xmlChar, 0 if none */
16432 int n_end;
16433 xmlChar end2; /* an end marker xmlChar, 0 if none */
16434 int n_end2;
16435 xmlChar end3; /* an end marker xmlChar, 0 if none */
16436 int n_end3;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016437
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016438 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16439 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
16440 for (n_len = 0;n_len < gen_nb_int;n_len++) {
16441 for (n_what = 0;n_what < gen_nb_int;n_what++) {
16442 for (n_end = 0;n_end < gen_nb_xmlChar;n_end++) {
16443 for (n_end2 = 0;n_end2 < gen_nb_xmlChar;n_end2++) {
16444 for (n_end3 = 0;n_end3 < gen_nb_xmlChar;n_end3++) {
16445 mem_base = xmlMemBlocks();
16446 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16447 str = gen_const_xmlChar_ptr(n_str, 1);
16448 len = gen_int(n_len, 2);
16449 what = gen_int(n_what, 3);
16450 end = gen_xmlChar(n_end, 4);
16451 end2 = gen_xmlChar(n_end2, 5);
16452 end3 = gen_xmlChar(n_end3, 6);
16453
William M. Brackf13f77f2004-11-12 16:03:48 +000016454 ret_val = xmlStringLenDecodeEntities(ctxt, (const xmlChar *)str, len, what, end, end2, end3);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016455 desret_xmlChar_ptr(ret_val);
16456 call_tests++;
16457 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000016458 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016459 des_int(n_len, len, 2);
16460 des_int(n_what, what, 3);
16461 des_xmlChar(n_end, end, 4);
16462 des_xmlChar(n_end2, end2, 5);
16463 des_xmlChar(n_end3, end3, 6);
16464 xmlResetLastError();
16465 if (mem_base != xmlMemBlocks()) {
16466 printf("Leak of %d blocks found in xmlStringLenDecodeEntities",
16467 xmlMemBlocks() - mem_base);
16468 test_ret++;
16469 printf(" %d", n_ctxt);
16470 printf(" %d", n_str);
16471 printf(" %d", n_len);
16472 printf(" %d", n_what);
16473 printf(" %d", n_end);
16474 printf(" %d", n_end2);
16475 printf(" %d", n_end3);
16476 printf("\n");
16477 }
16478 }
16479 }
16480 }
16481 }
16482 }
16483 }
16484 }
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016485 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016486
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016487 return(test_ret);
16488}
16489
16490
16491static int
16492test_xmlSwitchEncoding(void) {
16493 int test_ret = 0;
16494
16495 int mem_base;
16496 int ret_val;
16497 xmlParserCtxtPtr ctxt; /* the parser context */
16498 int n_ctxt;
16499 xmlCharEncoding enc; /* the encoding value (number) */
16500 int n_enc;
16501
16502 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16503 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
16504 mem_base = xmlMemBlocks();
16505 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16506 enc = gen_xmlCharEncoding(n_enc, 1);
16507
16508 ret_val = xmlSwitchEncoding(ctxt, enc);
16509 desret_int(ret_val);
16510 call_tests++;
16511 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16512 des_xmlCharEncoding(n_enc, enc, 1);
16513 xmlResetLastError();
16514 if (mem_base != xmlMemBlocks()) {
16515 printf("Leak of %d blocks found in xmlSwitchEncoding",
16516 xmlMemBlocks() - mem_base);
16517 test_ret++;
16518 printf(" %d", n_ctxt);
16519 printf(" %d", n_enc);
16520 printf("\n");
16521 }
16522 }
16523 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016524 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016525
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016526 return(test_ret);
16527}
16528
16529
16530static int
16531test_xmlSwitchInputEncoding(void) {
16532 int test_ret = 0;
16533
16534 int mem_base;
16535 int ret_val;
16536 xmlParserCtxtPtr ctxt; /* the parser context */
16537 int n_ctxt;
16538 xmlParserInputPtr input; /* the input stream */
16539 int n_input;
16540 xmlCharEncodingHandlerPtr handler; /* the encoding handler */
16541 int n_handler;
16542
16543 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16544 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
16545 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandlerPtr;n_handler++) {
16546 mem_base = xmlMemBlocks();
16547 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16548 input = gen_xmlParserInputPtr(n_input, 1);
16549 handler = gen_xmlCharEncodingHandlerPtr(n_handler, 2);
16550
16551 ret_val = xmlSwitchInputEncoding(ctxt, input, handler);
16552 desret_int(ret_val);
16553 call_tests++;
16554 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16555 des_xmlParserInputPtr(n_input, input, 1);
16556 des_xmlCharEncodingHandlerPtr(n_handler, handler, 2);
16557 xmlResetLastError();
16558 if (mem_base != xmlMemBlocks()) {
16559 printf("Leak of %d blocks found in xmlSwitchInputEncoding",
16560 xmlMemBlocks() - mem_base);
16561 test_ret++;
16562 printf(" %d", n_ctxt);
16563 printf(" %d", n_input);
16564 printf(" %d", n_handler);
16565 printf("\n");
16566 }
16567 }
16568 }
16569 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016570 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016571
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016572 return(test_ret);
16573}
16574
16575
16576static int
16577test_xmlSwitchToEncoding(void) {
16578 int test_ret = 0;
16579
16580 int mem_base;
16581 int ret_val;
16582 xmlParserCtxtPtr ctxt; /* the parser context */
16583 int n_ctxt;
16584 xmlCharEncodingHandlerPtr handler; /* the encoding handler */
16585 int n_handler;
16586
16587 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16588 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandlerPtr;n_handler++) {
16589 mem_base = xmlMemBlocks();
16590 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16591 handler = gen_xmlCharEncodingHandlerPtr(n_handler, 1);
16592
16593 ret_val = xmlSwitchToEncoding(ctxt, handler);
16594 desret_int(ret_val);
16595 call_tests++;
16596 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16597 des_xmlCharEncodingHandlerPtr(n_handler, handler, 1);
16598 xmlResetLastError();
16599 if (mem_base != xmlMemBlocks()) {
16600 printf("Leak of %d blocks found in xmlSwitchToEncoding",
16601 xmlMemBlocks() - mem_base);
16602 test_ret++;
16603 printf(" %d", n_ctxt);
16604 printf(" %d", n_handler);
16605 printf("\n");
16606 }
16607 }
16608 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016609 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016610
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016611 return(test_ret);
16612}
16613
16614static int
16615test_parserInternals(void) {
16616 int test_ret = 0;
16617
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016618 if (quiet == 0) printf("Testing parserInternals : 33 of 90 functions ...\n");
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016619 test_ret += test_htmlCreateFileParserCtxt();
16620 test_ret += test_htmlInitAutoClose();
16621 test_ret += test_inputPop();
16622 test_ret += test_inputPush();
16623 test_ret += test_namePop();
16624 test_ret += test_namePush();
16625 test_ret += test_nodePop();
16626 test_ret += test_nodePush();
16627 test_ret += test_xmlCheckLanguageID();
16628 test_ret += test_xmlCopyChar();
16629 test_ret += test_xmlCopyCharMultiByte();
16630 test_ret += test_xmlCreateEntityParserCtxt();
16631 test_ret += test_xmlCreateFileParserCtxt();
16632 test_ret += test_xmlCreateMemoryParserCtxt();
16633 test_ret += test_xmlCreateURLParserCtxt();
16634 test_ret += test_xmlCurrentChar();
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016635 test_ret += test_xmlErrMemory();
16636 test_ret += test_xmlIsLetter();
16637 test_ret += test_xmlNewEntityInputStream();
16638 test_ret += test_xmlNewInputFromFile();
16639 test_ret += test_xmlNewInputStream();
16640 test_ret += test_xmlNewStringInputStream();
16641 test_ret += test_xmlNextChar();
16642 test_ret += test_xmlParserInputShrink();
16643 test_ret += test_xmlPopInput();
16644 test_ret += test_xmlPushInput();
16645 test_ret += test_xmlSetEntityReferenceFunc();
16646 test_ret += test_xmlSplitQName();
16647 test_ret += test_xmlStringCurrentChar();
16648 test_ret += test_xmlStringDecodeEntities();
16649 test_ret += test_xmlStringLenDecodeEntities();
16650 test_ret += test_xmlSwitchEncoding();
16651 test_ret += test_xmlSwitchInputEncoding();
16652 test_ret += test_xmlSwitchToEncoding();
16653
16654 if (test_ret != 0)
16655 printf("Module parserInternals: %d errors\n", test_ret);
16656 return(test_ret);
16657}
16658
Daniel Veillardd93f6252004-11-02 15:53:51 +000016659static int
16660test_xmlPatternMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016661 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016662
William M. Brack21e4ef22005-01-02 09:53:13 +000016663#if defined(LIBXML_PATTERN_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000016664 int mem_base;
16665 int ret_val;
16666 xmlPatternPtr comp; /* the precompiled pattern */
16667 int n_comp;
16668 xmlNodePtr node; /* a node */
16669 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016670
Daniel Veillardce682bc2004-11-05 17:22:25 +000016671 for (n_comp = 0;n_comp < gen_nb_xmlPatternPtr;n_comp++) {
16672 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
16673 mem_base = xmlMemBlocks();
16674 comp = gen_xmlPatternPtr(n_comp, 0);
16675 node = gen_xmlNodePtr(n_node, 1);
16676
16677 ret_val = xmlPatternMatch(comp, node);
16678 desret_int(ret_val);
16679 call_tests++;
16680 des_xmlPatternPtr(n_comp, comp, 0);
16681 des_xmlNodePtr(n_node, node, 1);
16682 xmlResetLastError();
16683 if (mem_base != xmlMemBlocks()) {
16684 printf("Leak of %d blocks found in xmlPatternMatch",
16685 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016686 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016687 printf(" %d", n_comp);
16688 printf(" %d", n_node);
16689 printf("\n");
16690 }
16691 }
16692 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016693 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016694#endif
16695
Daniel Veillard42595322004-11-08 10:52:06 +000016696 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016697}
16698
16699
16700static int
16701test_xmlPatterncompile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016702 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016703
16704
16705 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000016706 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016707}
16708
16709static int
16710test_pattern(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016711 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016712
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016713 if (quiet == 0) printf("Testing pattern : 1 of 4 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000016714 test_ret += test_xmlPatternMatch();
16715 test_ret += test_xmlPatterncompile();
Daniel Veillardd93f6252004-11-02 15:53:51 +000016716
Daniel Veillard42595322004-11-08 10:52:06 +000016717 if (test_ret != 0)
16718 printf("Module pattern: %d errors\n", test_ret);
16719 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016720}
Daniel Veillarda521d282004-11-09 14:59:59 +000016721#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000016722
Daniel Veillardce682bc2004-11-05 17:22:25 +000016723#define gen_nb_xmlRelaxNGPtr 1
16724static xmlRelaxNGPtr gen_xmlRelaxNGPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16725 return(NULL);
16726}
16727static void des_xmlRelaxNGPtr(int no ATTRIBUTE_UNUSED, xmlRelaxNGPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16728}
Daniel Veillarda521d282004-11-09 14:59:59 +000016729#endif
16730
Daniel Veillardce682bc2004-11-05 17:22:25 +000016731
Daniel Veillardd93f6252004-11-02 15:53:51 +000016732static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000016733test_xmlRelaxNGDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016734 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016735
William M. Brack21e4ef22005-01-02 09:53:13 +000016736#if defined(LIBXML_SCHEMAS_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000016737 int mem_base;
16738 FILE * output; /* the file output */
16739 int n_output;
16740 xmlRelaxNGPtr schema; /* a schema structure */
16741 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016742
Daniel Veillardce682bc2004-11-05 17:22:25 +000016743 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
16744 for (n_schema = 0;n_schema < gen_nb_xmlRelaxNGPtr;n_schema++) {
16745 mem_base = xmlMemBlocks();
16746 output = gen_FILE_ptr(n_output, 0);
16747 schema = gen_xmlRelaxNGPtr(n_schema, 1);
16748
16749 xmlRelaxNGDump(output, schema);
16750 call_tests++;
16751 des_FILE_ptr(n_output, output, 0);
16752 des_xmlRelaxNGPtr(n_schema, schema, 1);
16753 xmlResetLastError();
16754 if (mem_base != xmlMemBlocks()) {
16755 printf("Leak of %d blocks found in xmlRelaxNGDump",
16756 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016757 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016758 printf(" %d", n_output);
16759 printf(" %d", n_schema);
16760 printf("\n");
16761 }
16762 }
16763 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016764 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016765#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000016766
Daniel Veillard42595322004-11-08 10:52:06 +000016767 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016768}
16769
16770
16771static int
16772test_xmlRelaxNGDumpTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016773 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016774
William M. Brack21e4ef22005-01-02 09:53:13 +000016775#if defined(LIBXML_SCHEMAS_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000016776 int mem_base;
16777 FILE * output; /* the file output */
16778 int n_output;
16779 xmlRelaxNGPtr schema; /* a schema structure */
16780 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016781
Daniel Veillardce682bc2004-11-05 17:22:25 +000016782 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
16783 for (n_schema = 0;n_schema < gen_nb_xmlRelaxNGPtr;n_schema++) {
16784 mem_base = xmlMemBlocks();
16785 output = gen_FILE_ptr(n_output, 0);
16786 schema = gen_xmlRelaxNGPtr(n_schema, 1);
16787
16788 xmlRelaxNGDumpTree(output, schema);
16789 call_tests++;
16790 des_FILE_ptr(n_output, output, 0);
16791 des_xmlRelaxNGPtr(n_schema, schema, 1);
16792 xmlResetLastError();
16793 if (mem_base != xmlMemBlocks()) {
16794 printf("Leak of %d blocks found in xmlRelaxNGDumpTree",
16795 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016796 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016797 printf(" %d", n_output);
16798 printf(" %d", n_schema);
16799 printf("\n");
16800 }
16801 }
16802 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016803 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016804#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000016805
Daniel Veillard42595322004-11-08 10:52:06 +000016806 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016807}
16808
Daniel Veillarda521d282004-11-09 14:59:59 +000016809#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000016810
Daniel Veillardce682bc2004-11-05 17:22:25 +000016811#define gen_nb_xmlRelaxNGParserCtxtPtr 1
16812static xmlRelaxNGParserCtxtPtr gen_xmlRelaxNGParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16813 return(NULL);
16814}
16815static void des_xmlRelaxNGParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlRelaxNGParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16816}
Daniel Veillarda521d282004-11-09 14:59:59 +000016817#endif
16818
16819#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000016820
16821#define gen_nb_xmlRelaxNGValidityErrorFunc_ptr 1
16822static xmlRelaxNGValidityErrorFunc * gen_xmlRelaxNGValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16823 return(NULL);
16824}
16825static void des_xmlRelaxNGValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidityErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16826}
Daniel Veillarda521d282004-11-09 14:59:59 +000016827#endif
16828
16829#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000016830
16831#define gen_nb_xmlRelaxNGValidityWarningFunc_ptr 1
16832static xmlRelaxNGValidityWarningFunc * gen_xmlRelaxNGValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16833 return(NULL);
16834}
16835static void des_xmlRelaxNGValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidityWarningFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16836}
Daniel Veillarda521d282004-11-09 14:59:59 +000016837#endif
16838
16839#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000016840
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016841#define gen_nb_void_ptr_ptr 1
16842static void ** gen_void_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16843 return(NULL);
16844}
16845static void des_void_ptr_ptr(int no ATTRIBUTE_UNUSED, void ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16846}
Daniel Veillarda521d282004-11-09 14:59:59 +000016847#endif
16848
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016849
Daniel Veillardd93f6252004-11-02 15:53:51 +000016850static int
16851test_xmlRelaxNGGetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016852 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016853
William M. Brack21e4ef22005-01-02 09:53:13 +000016854#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016855 int mem_base;
16856 int ret_val;
16857 xmlRelaxNGParserCtxtPtr ctxt; /* a Relax-NG validation context */
16858 int n_ctxt;
16859 xmlRelaxNGValidityErrorFunc * err; /* the error callback result */
16860 int n_err;
16861 xmlRelaxNGValidityWarningFunc * warn; /* the warning callback result */
16862 int n_warn;
16863 void ** ctx; /* contextual data for the callbacks result */
16864 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016865
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016866 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGParserCtxtPtr;n_ctxt++) {
16867 for (n_err = 0;n_err < gen_nb_xmlRelaxNGValidityErrorFunc_ptr;n_err++) {
16868 for (n_warn = 0;n_warn < gen_nb_xmlRelaxNGValidityWarningFunc_ptr;n_warn++) {
16869 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
16870 mem_base = xmlMemBlocks();
16871 ctxt = gen_xmlRelaxNGParserCtxtPtr(n_ctxt, 0);
16872 err = gen_xmlRelaxNGValidityErrorFunc_ptr(n_err, 1);
16873 warn = gen_xmlRelaxNGValidityWarningFunc_ptr(n_warn, 2);
16874 ctx = gen_void_ptr_ptr(n_ctx, 3);
16875
16876 ret_val = xmlRelaxNGGetParserErrors(ctxt, err, warn, ctx);
16877 desret_int(ret_val);
16878 call_tests++;
16879 des_xmlRelaxNGParserCtxtPtr(n_ctxt, ctxt, 0);
16880 des_xmlRelaxNGValidityErrorFunc_ptr(n_err, err, 1);
16881 des_xmlRelaxNGValidityWarningFunc_ptr(n_warn, warn, 2);
16882 des_void_ptr_ptr(n_ctx, ctx, 3);
16883 xmlResetLastError();
16884 if (mem_base != xmlMemBlocks()) {
16885 printf("Leak of %d blocks found in xmlRelaxNGGetParserErrors",
16886 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016887 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016888 printf(" %d", n_ctxt);
16889 printf(" %d", n_err);
16890 printf(" %d", n_warn);
16891 printf(" %d", n_ctx);
16892 printf("\n");
16893 }
16894 }
16895 }
16896 }
16897 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016898 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016899#endif
16900
Daniel Veillard42595322004-11-08 10:52:06 +000016901 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016902}
16903
Daniel Veillarda521d282004-11-09 14:59:59 +000016904#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000016905
Daniel Veillardce682bc2004-11-05 17:22:25 +000016906#define gen_nb_xmlRelaxNGValidCtxtPtr 1
16907static xmlRelaxNGValidCtxtPtr gen_xmlRelaxNGValidCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16908 return(NULL);
16909}
16910static void des_xmlRelaxNGValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16911}
Daniel Veillarda521d282004-11-09 14:59:59 +000016912#endif
16913
Daniel Veillardce682bc2004-11-05 17:22:25 +000016914
Daniel Veillardd93f6252004-11-02 15:53:51 +000016915static int
16916test_xmlRelaxNGGetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016917 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016918
William M. Brack21e4ef22005-01-02 09:53:13 +000016919#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016920 int mem_base;
16921 int ret_val;
16922 xmlRelaxNGValidCtxtPtr ctxt; /* a Relax-NG validation context */
16923 int n_ctxt;
16924 xmlRelaxNGValidityErrorFunc * err; /* the error function result */
16925 int n_err;
16926 xmlRelaxNGValidityWarningFunc * warn; /* the warning function result */
16927 int n_warn;
16928 void ** ctx; /* the functions context result */
16929 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016930
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016931 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
16932 for (n_err = 0;n_err < gen_nb_xmlRelaxNGValidityErrorFunc_ptr;n_err++) {
16933 for (n_warn = 0;n_warn < gen_nb_xmlRelaxNGValidityWarningFunc_ptr;n_warn++) {
16934 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
16935 mem_base = xmlMemBlocks();
16936 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
16937 err = gen_xmlRelaxNGValidityErrorFunc_ptr(n_err, 1);
16938 warn = gen_xmlRelaxNGValidityWarningFunc_ptr(n_warn, 2);
16939 ctx = gen_void_ptr_ptr(n_ctx, 3);
16940
16941 ret_val = xmlRelaxNGGetValidErrors(ctxt, err, warn, ctx);
16942 desret_int(ret_val);
16943 call_tests++;
16944 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
16945 des_xmlRelaxNGValidityErrorFunc_ptr(n_err, err, 1);
16946 des_xmlRelaxNGValidityWarningFunc_ptr(n_warn, warn, 2);
16947 des_void_ptr_ptr(n_ctx, ctx, 3);
16948 xmlResetLastError();
16949 if (mem_base != xmlMemBlocks()) {
16950 printf("Leak of %d blocks found in xmlRelaxNGGetValidErrors",
16951 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016952 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016953 printf(" %d", n_ctxt);
16954 printf(" %d", n_err);
16955 printf(" %d", n_warn);
16956 printf(" %d", n_ctx);
16957 printf("\n");
16958 }
16959 }
16960 }
16961 }
16962 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016963 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016964#endif
16965
Daniel Veillard42595322004-11-08 10:52:06 +000016966 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016967}
16968
16969
16970static int
Daniel Veillard34099b42004-11-04 17:34:35 +000016971test_xmlRelaxNGInitTypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016972 int test_ret = 0;
Daniel Veillard34099b42004-11-04 17:34:35 +000016973
William M. Brack21e4ef22005-01-02 09:53:13 +000016974#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard34099b42004-11-04 17:34:35 +000016975 int mem_base;
16976 int ret_val;
16977
16978 mem_base = xmlMemBlocks();
16979
16980 ret_val = xmlRelaxNGInitTypes();
16981 desret_int(ret_val);
16982 call_tests++;
16983 xmlResetLastError();
16984 if (mem_base != xmlMemBlocks()) {
16985 printf("Leak of %d blocks found in xmlRelaxNGInitTypes",
16986 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016987 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000016988 printf("\n");
16989 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016990 function_tests++;
Daniel Veillard34099b42004-11-04 17:34:35 +000016991#endif
16992
Daniel Veillard42595322004-11-08 10:52:06 +000016993 return(test_ret);
Daniel Veillard34099b42004-11-04 17:34:35 +000016994}
16995
16996
16997static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000016998test_xmlRelaxNGNewDocParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016999 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017000
William M. Brack21e4ef22005-01-02 09:53:13 +000017001#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000017002 int mem_base;
17003 xmlRelaxNGParserCtxtPtr ret_val;
17004 xmlDocPtr doc; /* a preparsed document tree */
17005 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017006
Daniel Veillard42595322004-11-08 10:52:06 +000017007 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17008 mem_base = xmlMemBlocks();
17009 doc = gen_xmlDocPtr(n_doc, 0);
17010
17011 ret_val = xmlRelaxNGNewDocParserCtxt(doc);
17012 desret_xmlRelaxNGParserCtxtPtr(ret_val);
17013 call_tests++;
17014 des_xmlDocPtr(n_doc, doc, 0);
17015 xmlResetLastError();
17016 if (mem_base != xmlMemBlocks()) {
17017 printf("Leak of %d blocks found in xmlRelaxNGNewDocParserCtxt",
17018 xmlMemBlocks() - mem_base);
17019 test_ret++;
17020 printf(" %d", n_doc);
17021 printf("\n");
17022 }
17023 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017024 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017025#endif
17026
Daniel Veillard42595322004-11-08 10:52:06 +000017027 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017028}
17029
17030
17031static int
17032test_xmlRelaxNGNewMemParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017033 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017034
William M. Brack21e4ef22005-01-02 09:53:13 +000017035#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000017036 int mem_base;
17037 xmlRelaxNGParserCtxtPtr ret_val;
17038 char * buffer; /* a pointer to a char array containing the schemas */
17039 int n_buffer;
17040 int size; /* the size of the array */
17041 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017042
Daniel Veillard42595322004-11-08 10:52:06 +000017043 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
17044 for (n_size = 0;n_size < gen_nb_int;n_size++) {
17045 mem_base = xmlMemBlocks();
17046 buffer = gen_const_char_ptr(n_buffer, 0);
17047 size = gen_int(n_size, 1);
17048
William M. Brackf13f77f2004-11-12 16:03:48 +000017049 ret_val = xmlRelaxNGNewMemParserCtxt((const char *)buffer, size);
Daniel Veillard42595322004-11-08 10:52:06 +000017050 desret_xmlRelaxNGParserCtxtPtr(ret_val);
17051 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000017052 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard42595322004-11-08 10:52:06 +000017053 des_int(n_size, size, 1);
17054 xmlResetLastError();
17055 if (mem_base != xmlMemBlocks()) {
17056 printf("Leak of %d blocks found in xmlRelaxNGNewMemParserCtxt",
17057 xmlMemBlocks() - mem_base);
17058 test_ret++;
17059 printf(" %d", n_buffer);
17060 printf(" %d", n_size);
17061 printf("\n");
17062 }
17063 }
17064 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017065 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017066#endif
17067
Daniel Veillard42595322004-11-08 10:52:06 +000017068 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017069}
17070
17071
17072static int
17073test_xmlRelaxNGNewParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017074 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017075
William M. Brack21e4ef22005-01-02 09:53:13 +000017076#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000017077 int mem_base;
17078 xmlRelaxNGParserCtxtPtr ret_val;
17079 char * URL; /* the location of the schema */
17080 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017081
Daniel Veillard42595322004-11-08 10:52:06 +000017082 for (n_URL = 0;n_URL < gen_nb_const_char_ptr;n_URL++) {
17083 mem_base = xmlMemBlocks();
17084 URL = gen_const_char_ptr(n_URL, 0);
17085
William M. Brackf13f77f2004-11-12 16:03:48 +000017086 ret_val = xmlRelaxNGNewParserCtxt((const char *)URL);
Daniel Veillard42595322004-11-08 10:52:06 +000017087 desret_xmlRelaxNGParserCtxtPtr(ret_val);
17088 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000017089 des_const_char_ptr(n_URL, (const char *)URL, 0);
Daniel Veillard42595322004-11-08 10:52:06 +000017090 xmlResetLastError();
17091 if (mem_base != xmlMemBlocks()) {
17092 printf("Leak of %d blocks found in xmlRelaxNGNewParserCtxt",
17093 xmlMemBlocks() - mem_base);
17094 test_ret++;
17095 printf(" %d", n_URL);
17096 printf("\n");
17097 }
17098 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017099 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017100#endif
17101
Daniel Veillard42595322004-11-08 10:52:06 +000017102 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017103}
17104
17105
17106static int
17107test_xmlRelaxNGNewValidCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017108 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017109
17110
17111 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017112 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017113}
17114
17115
17116static int
17117test_xmlRelaxNGParse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017118 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017119
17120
17121 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017122 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017123}
17124
17125
17126static int
17127test_xmlRelaxNGSetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017128 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017129
17130
17131 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017132 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017133}
17134
17135
17136static int
17137test_xmlRelaxNGSetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017138 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017139
17140
17141 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017142 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017143}
17144
17145
17146static int
17147test_xmlRelaxNGValidateDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017148 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017149
William M. Brack21e4ef22005-01-02 09:53:13 +000017150#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000017151 int mem_base;
17152 int ret_val;
17153 xmlRelaxNGValidCtxtPtr ctxt; /* a Relax-NG validation context */
17154 int n_ctxt;
17155 xmlDocPtr doc; /* a parsed document tree */
17156 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017157
Daniel Veillardce682bc2004-11-05 17:22:25 +000017158 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17159 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17160 mem_base = xmlMemBlocks();
17161 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17162 doc = gen_xmlDocPtr(n_doc, 1);
17163
17164 ret_val = xmlRelaxNGValidateDoc(ctxt, doc);
17165 desret_int(ret_val);
17166 call_tests++;
17167 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17168 des_xmlDocPtr(n_doc, doc, 1);
17169 xmlResetLastError();
17170 if (mem_base != xmlMemBlocks()) {
17171 printf("Leak of %d blocks found in xmlRelaxNGValidateDoc",
17172 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017173 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017174 printf(" %d", n_ctxt);
17175 printf(" %d", n_doc);
17176 printf("\n");
17177 }
17178 }
17179 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017180 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017181#endif
17182
Daniel Veillard42595322004-11-08 10:52:06 +000017183 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017184}
17185
17186
17187static int
17188test_xmlRelaxNGValidateFullElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017189 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017190
William M. Brack21e4ef22005-01-02 09:53:13 +000017191#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000017192 int mem_base;
17193 int ret_val;
17194 xmlRelaxNGValidCtxtPtr ctxt; /* the validation context */
17195 int n_ctxt;
17196 xmlDocPtr doc; /* a document instance */
17197 int n_doc;
17198 xmlNodePtr elem; /* an element instance */
17199 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017200
Daniel Veillardce682bc2004-11-05 17:22:25 +000017201 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17202 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17203 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
17204 mem_base = xmlMemBlocks();
17205 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17206 doc = gen_xmlDocPtr(n_doc, 1);
17207 elem = gen_xmlNodePtr(n_elem, 2);
17208
17209 ret_val = xmlRelaxNGValidateFullElement(ctxt, doc, elem);
17210 desret_int(ret_val);
17211 call_tests++;
17212 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17213 des_xmlDocPtr(n_doc, doc, 1);
17214 des_xmlNodePtr(n_elem, elem, 2);
17215 xmlResetLastError();
17216 if (mem_base != xmlMemBlocks()) {
17217 printf("Leak of %d blocks found in xmlRelaxNGValidateFullElement",
17218 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017219 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017220 printf(" %d", n_ctxt);
17221 printf(" %d", n_doc);
17222 printf(" %d", n_elem);
17223 printf("\n");
17224 }
17225 }
17226 }
17227 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017228 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017229#endif
17230
Daniel Veillard42595322004-11-08 10:52:06 +000017231 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017232}
17233
17234
17235static int
17236test_xmlRelaxNGValidatePopElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017237 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017238
William M. Brack21e4ef22005-01-02 09:53:13 +000017239#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000017240 int mem_base;
17241 int ret_val;
17242 xmlRelaxNGValidCtxtPtr ctxt; /* the RelaxNG validation context */
17243 int n_ctxt;
17244 xmlDocPtr doc; /* a document instance */
17245 int n_doc;
17246 xmlNodePtr elem; /* an element instance */
17247 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017248
Daniel Veillardce682bc2004-11-05 17:22:25 +000017249 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17250 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17251 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
17252 mem_base = xmlMemBlocks();
17253 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17254 doc = gen_xmlDocPtr(n_doc, 1);
17255 elem = gen_xmlNodePtr(n_elem, 2);
17256
17257 ret_val = xmlRelaxNGValidatePopElement(ctxt, doc, elem);
17258 desret_int(ret_val);
17259 call_tests++;
17260 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17261 des_xmlDocPtr(n_doc, doc, 1);
17262 des_xmlNodePtr(n_elem, elem, 2);
17263 xmlResetLastError();
17264 if (mem_base != xmlMemBlocks()) {
17265 printf("Leak of %d blocks found in xmlRelaxNGValidatePopElement",
17266 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017267 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017268 printf(" %d", n_ctxt);
17269 printf(" %d", n_doc);
17270 printf(" %d", n_elem);
17271 printf("\n");
17272 }
17273 }
17274 }
17275 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017276 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017277#endif
17278
Daniel Veillard42595322004-11-08 10:52:06 +000017279 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017280}
17281
17282
17283static int
17284test_xmlRelaxNGValidatePushCData(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; /* the RelaxNG validation context */
17291 int n_ctxt;
17292 xmlChar * data; /* some character data read */
17293 int n_data;
17294 int len; /* the lenght of the data */
17295 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017296
Daniel Veillardce682bc2004-11-05 17:22:25 +000017297 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17298 for (n_data = 0;n_data < gen_nb_const_xmlChar_ptr;n_data++) {
17299 for (n_len = 0;n_len < gen_nb_int;n_len++) {
17300 mem_base = xmlMemBlocks();
17301 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17302 data = gen_const_xmlChar_ptr(n_data, 1);
17303 len = gen_int(n_len, 2);
17304
William M. Brackf13f77f2004-11-12 16:03:48 +000017305 ret_val = xmlRelaxNGValidatePushCData(ctxt, (const xmlChar *)data, len);
Daniel Veillardce682bc2004-11-05 17:22:25 +000017306 desret_int(ret_val);
17307 call_tests++;
17308 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000017309 des_const_xmlChar_ptr(n_data, (const xmlChar *)data, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000017310 des_int(n_len, len, 2);
17311 xmlResetLastError();
17312 if (mem_base != xmlMemBlocks()) {
17313 printf("Leak of %d blocks found in xmlRelaxNGValidatePushCData",
17314 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017315 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017316 printf(" %d", n_ctxt);
17317 printf(" %d", n_data);
17318 printf(" %d", n_len);
17319 printf("\n");
17320 }
17321 }
17322 }
17323 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017324 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017325#endif
17326
Daniel Veillard42595322004-11-08 10:52:06 +000017327 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017328}
17329
17330
17331static int
17332test_xmlRelaxNGValidatePushElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017333 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017334
William M. Brack21e4ef22005-01-02 09:53:13 +000017335#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000017336 int mem_base;
17337 int ret_val;
17338 xmlRelaxNGValidCtxtPtr ctxt; /* the validation context */
17339 int n_ctxt;
17340 xmlDocPtr doc; /* a document instance */
17341 int n_doc;
17342 xmlNodePtr elem; /* an element instance */
17343 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017344
Daniel Veillardce682bc2004-11-05 17:22:25 +000017345 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17346 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17347 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
17348 mem_base = xmlMemBlocks();
17349 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17350 doc = gen_xmlDocPtr(n_doc, 1);
17351 elem = gen_xmlNodePtr(n_elem, 2);
17352
17353 ret_val = xmlRelaxNGValidatePushElement(ctxt, doc, elem);
17354 desret_int(ret_val);
17355 call_tests++;
17356 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17357 des_xmlDocPtr(n_doc, doc, 1);
17358 des_xmlNodePtr(n_elem, elem, 2);
17359 xmlResetLastError();
17360 if (mem_base != xmlMemBlocks()) {
17361 printf("Leak of %d blocks found in xmlRelaxNGValidatePushElement",
17362 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017363 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017364 printf(" %d", n_ctxt);
17365 printf(" %d", n_doc);
17366 printf(" %d", n_elem);
17367 printf("\n");
17368 }
17369 }
17370 }
17371 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017372 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017373#endif
17374
Daniel Veillard42595322004-11-08 10:52:06 +000017375 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017376}
17377
17378
17379static int
17380test_xmlRelaxParserSetFlag(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017381 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017382
William M. Brack21e4ef22005-01-02 09:53:13 +000017383#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000017384 int mem_base;
17385 int ret_val;
17386 xmlRelaxNGParserCtxtPtr ctxt; /* a RelaxNG parser context */
17387 int n_ctxt;
17388 int flags; /* a set of flags values */
17389 int n_flags;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017390
Daniel Veillardce682bc2004-11-05 17:22:25 +000017391 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGParserCtxtPtr;n_ctxt++) {
17392 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
17393 mem_base = xmlMemBlocks();
17394 ctxt = gen_xmlRelaxNGParserCtxtPtr(n_ctxt, 0);
17395 flags = gen_int(n_flags, 1);
17396
17397 ret_val = xmlRelaxParserSetFlag(ctxt, flags);
17398 desret_int(ret_val);
17399 call_tests++;
17400 des_xmlRelaxNGParserCtxtPtr(n_ctxt, ctxt, 0);
17401 des_int(n_flags, flags, 1);
17402 xmlResetLastError();
17403 if (mem_base != xmlMemBlocks()) {
17404 printf("Leak of %d blocks found in xmlRelaxParserSetFlag",
17405 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017406 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017407 printf(" %d", n_ctxt);
17408 printf(" %d", n_flags);
17409 printf("\n");
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
17419static int
17420test_relaxng(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017421 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017422
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017423 if (quiet == 0) printf("Testing relaxng : 14 of 22 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000017424 test_ret += test_xmlRelaxNGDump();
17425 test_ret += test_xmlRelaxNGDumpTree();
17426 test_ret += test_xmlRelaxNGGetParserErrors();
17427 test_ret += test_xmlRelaxNGGetValidErrors();
17428 test_ret += test_xmlRelaxNGInitTypes();
17429 test_ret += test_xmlRelaxNGNewDocParserCtxt();
17430 test_ret += test_xmlRelaxNGNewMemParserCtxt();
17431 test_ret += test_xmlRelaxNGNewParserCtxt();
17432 test_ret += test_xmlRelaxNGNewValidCtxt();
17433 test_ret += test_xmlRelaxNGParse();
17434 test_ret += test_xmlRelaxNGSetParserErrors();
17435 test_ret += test_xmlRelaxNGSetValidErrors();
17436 test_ret += test_xmlRelaxNGValidateDoc();
17437 test_ret += test_xmlRelaxNGValidateFullElement();
17438 test_ret += test_xmlRelaxNGValidatePopElement();
17439 test_ret += test_xmlRelaxNGValidatePushCData();
17440 test_ret += test_xmlRelaxNGValidatePushElement();
17441 test_ret += test_xmlRelaxParserSetFlag();
Daniel Veillardd93f6252004-11-02 15:53:51 +000017442
Daniel Veillard42595322004-11-08 10:52:06 +000017443 if (test_ret != 0)
17444 printf("Module relaxng: %d errors\n", test_ret);
17445 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017446}
17447static int
17448test_schemasInternals(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017449 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017450
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017451 if (quiet == 0) printf("Testing schemasInternals : 0 of 2 functions ...\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017452
Daniel Veillard42595322004-11-08 10:52:06 +000017453 if (test_ret != 0)
17454 printf("Module schemasInternals: %d errors\n", test_ret);
17455 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017456}
17457
17458static int
17459test_xmlAddChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017460 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017461
17462 int mem_base;
17463 xmlNodePtr ret_val;
17464 xmlNodePtr parent; /* the parent node */
17465 int n_parent;
17466 xmlNodePtr cur; /* the child node */
17467 int n_cur;
17468
Daniel Veillarda03e3652004-11-02 18:45:30 +000017469 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017470 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) {
17471 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017472 parent = gen_xmlNodePtr(n_parent, 0);
17473 cur = gen_xmlNodePtr_in(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017474
17475 ret_val = xmlAddChild(parent, cur);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017476 if (ret_val == NULL) { xmlFreeNode(cur) ; cur = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017477 desret_xmlNodePtr(ret_val);
17478 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017479 des_xmlNodePtr(n_parent, parent, 0);
17480 des_xmlNodePtr_in(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017481 xmlResetLastError();
17482 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017483 printf("Leak of %d blocks found in xmlAddChild",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017484 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017485 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017486 printf(" %d", n_parent);
17487 printf(" %d", n_cur);
17488 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017489 }
17490 }
17491 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017492 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017493
Daniel Veillard42595322004-11-08 10:52:06 +000017494 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017495}
17496
17497
17498static int
17499test_xmlAddChildList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017500 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017501
17502 int mem_base;
17503 xmlNodePtr ret_val;
17504 xmlNodePtr parent; /* the parent node */
17505 int n_parent;
17506 xmlNodePtr cur; /* the first node in the list */
17507 int n_cur;
17508
Daniel Veillarda03e3652004-11-02 18:45:30 +000017509 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017510 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) {
17511 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017512 parent = gen_xmlNodePtr(n_parent, 0);
17513 cur = gen_xmlNodePtr_in(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017514
17515 ret_val = xmlAddChildList(parent, cur);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017516 if (ret_val == NULL) { xmlFreeNodeList(cur) ; cur = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017517 desret_xmlNodePtr(ret_val);
17518 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017519 des_xmlNodePtr(n_parent, parent, 0);
17520 des_xmlNodePtr_in(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017521 xmlResetLastError();
17522 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017523 printf("Leak of %d blocks found in xmlAddChildList",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017524 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017525 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017526 printf(" %d", n_parent);
17527 printf(" %d", n_cur);
17528 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017529 }
17530 }
17531 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017532 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017533
Daniel Veillard42595322004-11-08 10:52:06 +000017534 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017535}
17536
17537
17538static int
17539test_xmlAddNextSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017540 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017541
17542 int mem_base;
17543 xmlNodePtr ret_val;
17544 xmlNodePtr cur; /* the child node */
17545 int n_cur;
17546 xmlNodePtr elem; /* the new node */
17547 int n_elem;
17548
17549 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017550 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr_in;n_elem++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017551 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017552 cur = gen_xmlNodePtr(n_cur, 0);
17553 elem = gen_xmlNodePtr_in(n_elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017554
17555 ret_val = xmlAddNextSibling(cur, elem);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017556 if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017557 desret_xmlNodePtr(ret_val);
17558 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017559 des_xmlNodePtr(n_cur, cur, 0);
17560 des_xmlNodePtr_in(n_elem, elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017561 xmlResetLastError();
17562 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017563 printf("Leak of %d blocks found in xmlAddNextSibling",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017564 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017565 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017566 printf(" %d", n_cur);
17567 printf(" %d", n_elem);
17568 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017569 }
17570 }
17571 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017572 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017573
Daniel Veillard42595322004-11-08 10:52:06 +000017574 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017575}
17576
17577
17578static int
17579test_xmlAddPrevSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017580 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017581
William M. Brack21e4ef22005-01-02 09:53:13 +000017582#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000017583 int mem_base;
17584 xmlNodePtr ret_val;
17585 xmlNodePtr cur; /* the child node */
17586 int n_cur;
17587 xmlNodePtr elem; /* the new node */
17588 int n_elem;
17589
17590 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017591 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr_in;n_elem++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017592 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017593 cur = gen_xmlNodePtr(n_cur, 0);
17594 elem = gen_xmlNodePtr_in(n_elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017595
17596 ret_val = xmlAddPrevSibling(cur, elem);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017597 if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017598 desret_xmlNodePtr(ret_val);
17599 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017600 des_xmlNodePtr(n_cur, cur, 0);
17601 des_xmlNodePtr_in(n_elem, elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017602 xmlResetLastError();
17603 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017604 printf("Leak of %d blocks found in xmlAddPrevSibling",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017605 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017606 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017607 printf(" %d", n_cur);
17608 printf(" %d", n_elem);
17609 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017610 }
17611 }
17612 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017613 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017614#endif
17615
Daniel Veillard42595322004-11-08 10:52:06 +000017616 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017617}
17618
17619
17620static int
17621test_xmlAddSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017622 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017623
17624 int mem_base;
17625 xmlNodePtr ret_val;
17626 xmlNodePtr cur; /* the child node */
17627 int n_cur;
17628 xmlNodePtr elem; /* the new node */
17629 int n_elem;
17630
17631 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017632 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr_in;n_elem++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017633 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017634 cur = gen_xmlNodePtr(n_cur, 0);
17635 elem = gen_xmlNodePtr_in(n_elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017636
17637 ret_val = xmlAddSibling(cur, elem);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017638 if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017639 desret_xmlNodePtr(ret_val);
17640 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017641 des_xmlNodePtr(n_cur, cur, 0);
17642 des_xmlNodePtr_in(n_elem, elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017643 xmlResetLastError();
17644 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017645 printf("Leak of %d blocks found in xmlAddSibling",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017646 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017647 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017648 printf(" %d", n_cur);
17649 printf(" %d", n_elem);
17650 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017651 }
17652 }
17653 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017654 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017655
Daniel Veillard42595322004-11-08 10:52:06 +000017656 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017657}
17658
17659
17660static int
17661test_xmlAttrSerializeTxtContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017662 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017663
William M. Brack21e4ef22005-01-02 09:53:13 +000017664#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000017665#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillardce244ad2004-11-05 10:03:46 +000017666 int mem_base;
17667 xmlBufferPtr buf; /* the XML buffer output */
17668 int n_buf;
17669 xmlDocPtr doc; /* the document */
17670 int n_doc;
17671 xmlAttrPtr attr; /* the attribute node */
17672 int n_attr;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017673 xmlChar * string; /* the text content */
Daniel Veillardce244ad2004-11-05 10:03:46 +000017674 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017675
Daniel Veillardce244ad2004-11-05 10:03:46 +000017676 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17677 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17678 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
17679 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
17680 mem_base = xmlMemBlocks();
17681 buf = gen_xmlBufferPtr(n_buf, 0);
17682 doc = gen_xmlDocPtr(n_doc, 1);
17683 attr = gen_xmlAttrPtr(n_attr, 2);
17684 string = gen_const_xmlChar_ptr(n_string, 3);
17685
William M. Brackf13f77f2004-11-12 16:03:48 +000017686 xmlAttrSerializeTxtContent(buf, doc, attr, (const xmlChar *)string);
Daniel Veillardce244ad2004-11-05 10:03:46 +000017687 call_tests++;
17688 des_xmlBufferPtr(n_buf, buf, 0);
17689 des_xmlDocPtr(n_doc, doc, 1);
17690 des_xmlAttrPtr(n_attr, attr, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000017691 des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 3);
Daniel Veillardce244ad2004-11-05 10:03:46 +000017692 xmlResetLastError();
17693 if (mem_base != xmlMemBlocks()) {
17694 printf("Leak of %d blocks found in xmlAttrSerializeTxtContent",
17695 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017696 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000017697 printf(" %d", n_buf);
17698 printf(" %d", n_doc);
17699 printf(" %d", n_attr);
17700 printf(" %d", n_string);
17701 printf("\n");
17702 }
17703 }
17704 }
17705 }
17706 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017707 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000017708#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000017709#endif
Daniel Veillardce244ad2004-11-05 10:03:46 +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_xmlBufferAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017717 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017718
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017719 int mem_base;
17720 int ret_val;
17721 xmlBufferPtr buf; /* the buffer to dump */
17722 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017723 xmlChar * str; /* the #xmlChar string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017724 int n_str;
17725 int len; /* the number of #xmlChar to add */
17726 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017727
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017728 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17729 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
17730 for (n_len = 0;n_len < gen_nb_int;n_len++) {
17731 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017732 buf = gen_xmlBufferPtr(n_buf, 0);
17733 str = gen_const_xmlChar_ptr(n_str, 1);
17734 len = gen_int(n_len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017735
William M. Brackf13f77f2004-11-12 16:03:48 +000017736 ret_val = xmlBufferAdd(buf, (const xmlChar *)str, len);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017737 desret_int(ret_val);
17738 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017739 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000017740 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000017741 des_int(n_len, len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017742 xmlResetLastError();
17743 if (mem_base != xmlMemBlocks()) {
17744 printf("Leak of %d blocks found in xmlBufferAdd",
17745 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017746 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017747 printf(" %d", n_buf);
17748 printf(" %d", n_str);
17749 printf(" %d", n_len);
17750 printf("\n");
17751 }
17752 }
17753 }
17754 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017755 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017756
Daniel Veillard42595322004-11-08 10:52:06 +000017757 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017758}
17759
17760
17761static int
17762test_xmlBufferAddHead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017763 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017764
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017765 int mem_base;
17766 int ret_val;
17767 xmlBufferPtr buf; /* the buffer */
17768 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017769 xmlChar * str; /* the #xmlChar string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017770 int n_str;
17771 int len; /* the number of #xmlChar to add */
17772 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017773
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017774 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17775 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
17776 for (n_len = 0;n_len < gen_nb_int;n_len++) {
17777 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017778 buf = gen_xmlBufferPtr(n_buf, 0);
17779 str = gen_const_xmlChar_ptr(n_str, 1);
17780 len = gen_int(n_len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017781
William M. Brackf13f77f2004-11-12 16:03:48 +000017782 ret_val = xmlBufferAddHead(buf, (const xmlChar *)str, len);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017783 desret_int(ret_val);
17784 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017785 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000017786 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000017787 des_int(n_len, len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017788 xmlResetLastError();
17789 if (mem_base != xmlMemBlocks()) {
17790 printf("Leak of %d blocks found in xmlBufferAddHead",
17791 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017792 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017793 printf(" %d", n_buf);
17794 printf(" %d", n_str);
17795 printf(" %d", n_len);
17796 printf("\n");
17797 }
17798 }
17799 }
17800 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017801 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017802
Daniel Veillard42595322004-11-08 10:52:06 +000017803 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017804}
17805
17806
17807static int
17808test_xmlBufferCCat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017809 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017810
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017811 int mem_base;
17812 int ret_val;
17813 xmlBufferPtr buf; /* the buffer to dump */
17814 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017815 char * str; /* the C char string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017816 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017817
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017818 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17819 for (n_str = 0;n_str < gen_nb_const_char_ptr;n_str++) {
17820 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017821 buf = gen_xmlBufferPtr(n_buf, 0);
17822 str = gen_const_char_ptr(n_str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017823
William M. Brackf13f77f2004-11-12 16:03:48 +000017824 ret_val = xmlBufferCCat(buf, (const char *)str);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017825 desret_int(ret_val);
17826 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017827 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000017828 des_const_char_ptr(n_str, (const char *)str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017829 xmlResetLastError();
17830 if (mem_base != xmlMemBlocks()) {
17831 printf("Leak of %d blocks found in xmlBufferCCat",
17832 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017833 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017834 printf(" %d", n_buf);
17835 printf(" %d", n_str);
17836 printf("\n");
17837 }
17838 }
17839 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017840 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017841
Daniel Veillard42595322004-11-08 10:52:06 +000017842 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017843}
17844
17845
17846static int
17847test_xmlBufferCat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017848 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017849
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017850 int mem_base;
17851 int ret_val;
17852 xmlBufferPtr buf; /* the buffer to add to */
17853 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017854 xmlChar * str; /* the #xmlChar string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017855 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017856
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017857 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17858 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
17859 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017860 buf = gen_xmlBufferPtr(n_buf, 0);
17861 str = gen_const_xmlChar_ptr(n_str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017862
William M. Brackf13f77f2004-11-12 16:03:48 +000017863 ret_val = xmlBufferCat(buf, (const xmlChar *)str);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017864 desret_int(ret_val);
17865 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017866 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000017867 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017868 xmlResetLastError();
17869 if (mem_base != xmlMemBlocks()) {
17870 printf("Leak of %d blocks found in xmlBufferCat",
17871 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017872 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017873 printf(" %d", n_buf);
17874 printf(" %d", n_str);
17875 printf("\n");
17876 }
17877 }
17878 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017879 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017880
Daniel Veillard42595322004-11-08 10:52:06 +000017881 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017882}
17883
17884
Daniel Veillardce682bc2004-11-05 17:22:25 +000017885#define gen_nb_const_xmlBufferPtr 1
17886static xmlBufferPtr gen_const_xmlBufferPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17887 return(NULL);
17888}
17889static void des_const_xmlBufferPtr(int no ATTRIBUTE_UNUSED, const xmlBufferPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17890}
17891
Daniel Veillardd93f6252004-11-02 15:53:51 +000017892static int
17893test_xmlBufferContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017894 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017895
Daniel Veillardce682bc2004-11-05 17:22:25 +000017896 int mem_base;
17897 const xmlChar * ret_val;
17898 xmlBufferPtr buf; /* the buffer */
17899 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017900
Daniel Veillardce682bc2004-11-05 17:22:25 +000017901 for (n_buf = 0;n_buf < gen_nb_const_xmlBufferPtr;n_buf++) {
17902 mem_base = xmlMemBlocks();
17903 buf = gen_const_xmlBufferPtr(n_buf, 0);
17904
William M. Brackf13f77f2004-11-12 16:03:48 +000017905 ret_val = xmlBufferContent((const xmlBufferPtr)buf);
Daniel Veillardce682bc2004-11-05 17:22:25 +000017906 desret_const_xmlChar_ptr(ret_val);
17907 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000017908 des_const_xmlBufferPtr(n_buf, (const xmlBufferPtr)buf, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000017909 xmlResetLastError();
17910 if (mem_base != xmlMemBlocks()) {
17911 printf("Leak of %d blocks found in xmlBufferContent",
17912 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017913 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017914 printf(" %d", n_buf);
17915 printf("\n");
17916 }
17917 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000017918 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017919
Daniel Veillard42595322004-11-08 10:52:06 +000017920 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017921}
17922
17923
17924static int
17925test_xmlBufferCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017926 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017927
Daniel Veillard3d95c732004-11-06 22:25:14 +000017928 int mem_base;
17929 xmlBufferPtr ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017930
Daniel Veillard3d95c732004-11-06 22:25:14 +000017931 mem_base = xmlMemBlocks();
17932
17933 ret_val = xmlBufferCreate();
17934 desret_xmlBufferPtr(ret_val);
17935 call_tests++;
17936 xmlResetLastError();
17937 if (mem_base != xmlMemBlocks()) {
17938 printf("Leak of %d blocks found in xmlBufferCreate",
17939 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017940 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000017941 printf("\n");
17942 }
Daniel Veillard3d95c732004-11-06 22:25:14 +000017943 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017944
Daniel Veillard42595322004-11-08 10:52:06 +000017945 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017946}
17947
17948
17949static int
17950test_xmlBufferCreateSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017951 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017952
17953
17954 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017955 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017956}
17957
17958
17959static int
17960test_xmlBufferCreateStatic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017961 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017962
17963
17964 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017965 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017966}
17967
17968
17969static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000017970test_xmlBufferEmpty(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017971 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017972
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017973 int mem_base;
17974 xmlBufferPtr buf; /* the buffer */
17975 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017976
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017977 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17978 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017979 buf = gen_xmlBufferPtr(n_buf, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017980
17981 xmlBufferEmpty(buf);
17982 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017983 des_xmlBufferPtr(n_buf, buf, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017984 xmlResetLastError();
17985 if (mem_base != xmlMemBlocks()) {
17986 printf("Leak of %d blocks found in xmlBufferEmpty",
17987 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017988 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017989 printf(" %d", n_buf);
17990 printf("\n");
17991 }
17992 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017993 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017994
Daniel Veillard42595322004-11-08 10:52:06 +000017995 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017996}
17997
17998
17999static int
18000test_xmlBufferGrow(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018001 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018002
Daniel Veillard3d97e662004-11-04 10:49:00 +000018003 int mem_base;
18004 int ret_val;
18005 xmlBufferPtr buf; /* the buffer */
18006 int n_buf;
18007 unsigned int len; /* the minimum free size to allocate */
18008 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018009
Daniel Veillard3d97e662004-11-04 10:49:00 +000018010 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18011 for (n_len = 0;n_len < gen_nb_unsigned_int;n_len++) {
18012 mem_base = xmlMemBlocks();
18013 buf = gen_xmlBufferPtr(n_buf, 0);
18014 len = gen_unsigned_int(n_len, 1);
18015
18016 ret_val = xmlBufferGrow(buf, len);
18017 desret_int(ret_val);
18018 call_tests++;
18019 des_xmlBufferPtr(n_buf, buf, 0);
18020 des_unsigned_int(n_len, len, 1);
18021 xmlResetLastError();
18022 if (mem_base != xmlMemBlocks()) {
18023 printf("Leak of %d blocks found in xmlBufferGrow",
18024 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018025 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018026 printf(" %d", n_buf);
18027 printf(" %d", n_len);
18028 printf("\n");
18029 }
18030 }
18031 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018032 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018033
Daniel Veillard42595322004-11-08 10:52:06 +000018034 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018035}
18036
18037
18038static int
18039test_xmlBufferLength(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018040 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018041
Daniel Veillardce682bc2004-11-05 17:22:25 +000018042 int mem_base;
18043 int ret_val;
18044 xmlBufferPtr buf; /* the buffer */
18045 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018046
Daniel Veillardce682bc2004-11-05 17:22:25 +000018047 for (n_buf = 0;n_buf < gen_nb_const_xmlBufferPtr;n_buf++) {
18048 mem_base = xmlMemBlocks();
18049 buf = gen_const_xmlBufferPtr(n_buf, 0);
18050
William M. Brackf13f77f2004-11-12 16:03:48 +000018051 ret_val = xmlBufferLength((const xmlBufferPtr)buf);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018052 desret_int(ret_val);
18053 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018054 des_const_xmlBufferPtr(n_buf, (const xmlBufferPtr)buf, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018055 xmlResetLastError();
18056 if (mem_base != xmlMemBlocks()) {
18057 printf("Leak of %d blocks found in xmlBufferLength",
18058 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018059 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018060 printf(" %d", n_buf);
18061 printf("\n");
18062 }
18063 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018064 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018065
Daniel Veillard42595322004-11-08 10:52:06 +000018066 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018067}
18068
18069
18070static int
18071test_xmlBufferResize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018072 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018073
Daniel Veillard3d97e662004-11-04 10:49:00 +000018074 int mem_base;
18075 int ret_val;
18076 xmlBufferPtr buf; /* the buffer to resize */
18077 int n_buf;
18078 unsigned int size; /* the desired size */
18079 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018080
Daniel Veillard3d97e662004-11-04 10:49:00 +000018081 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18082 for (n_size = 0;n_size < gen_nb_unsigned_int;n_size++) {
18083 mem_base = xmlMemBlocks();
18084 buf = gen_xmlBufferPtr(n_buf, 0);
18085 size = gen_unsigned_int(n_size, 1);
18086
18087 ret_val = xmlBufferResize(buf, size);
18088 desret_int(ret_val);
18089 call_tests++;
18090 des_xmlBufferPtr(n_buf, buf, 0);
18091 des_unsigned_int(n_size, size, 1);
18092 xmlResetLastError();
18093 if (mem_base != xmlMemBlocks()) {
18094 printf("Leak of %d blocks found in xmlBufferResize",
18095 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018096 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018097 printf(" %d", n_buf);
18098 printf(" %d", n_size);
18099 printf("\n");
18100 }
18101 }
18102 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018103 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018104
Daniel Veillard42595322004-11-08 10:52:06 +000018105 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018106}
18107
18108
18109static int
18110test_xmlBufferSetAllocationScheme(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018111 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018112
Daniel Veillard57b25162004-11-06 14:50:18 +000018113 int mem_base;
18114 xmlBufferPtr buf; /* the buffer to tune */
18115 int n_buf;
18116 xmlBufferAllocationScheme scheme; /* allocation scheme to use */
18117 int n_scheme;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018118
Daniel Veillard57b25162004-11-06 14:50:18 +000018119 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18120 for (n_scheme = 0;n_scheme < gen_nb_xmlBufferAllocationScheme;n_scheme++) {
18121 mem_base = xmlMemBlocks();
18122 buf = gen_xmlBufferPtr(n_buf, 0);
18123 scheme = gen_xmlBufferAllocationScheme(n_scheme, 1);
18124
18125 xmlBufferSetAllocationScheme(buf, scheme);
18126 call_tests++;
18127 des_xmlBufferPtr(n_buf, buf, 0);
18128 des_xmlBufferAllocationScheme(n_scheme, scheme, 1);
18129 xmlResetLastError();
18130 if (mem_base != xmlMemBlocks()) {
18131 printf("Leak of %d blocks found in xmlBufferSetAllocationScheme",
18132 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018133 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000018134 printf(" %d", n_buf);
18135 printf(" %d", n_scheme);
18136 printf("\n");
18137 }
18138 }
18139 }
Daniel Veillard57b25162004-11-06 14:50:18 +000018140 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018141
Daniel Veillard42595322004-11-08 10:52:06 +000018142 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018143}
18144
18145
18146static int
18147test_xmlBufferShrink(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018148 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018149
Daniel Veillard3d97e662004-11-04 10:49:00 +000018150 int mem_base;
18151 int ret_val;
18152 xmlBufferPtr buf; /* the buffer to dump */
18153 int n_buf;
18154 unsigned int len; /* the number of xmlChar to remove */
18155 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018156
Daniel Veillard3d97e662004-11-04 10:49:00 +000018157 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18158 for (n_len = 0;n_len < gen_nb_unsigned_int;n_len++) {
18159 mem_base = xmlMemBlocks();
18160 buf = gen_xmlBufferPtr(n_buf, 0);
18161 len = gen_unsigned_int(n_len, 1);
18162
18163 ret_val = xmlBufferShrink(buf, len);
18164 desret_int(ret_val);
18165 call_tests++;
18166 des_xmlBufferPtr(n_buf, buf, 0);
18167 des_unsigned_int(n_len, len, 1);
18168 xmlResetLastError();
18169 if (mem_base != xmlMemBlocks()) {
18170 printf("Leak of %d blocks found in xmlBufferShrink",
18171 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018172 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018173 printf(" %d", n_buf);
18174 printf(" %d", n_len);
18175 printf("\n");
18176 }
18177 }
18178 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018179 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018180
Daniel Veillard42595322004-11-08 10:52:06 +000018181 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018182}
18183
18184
18185static int
18186test_xmlBufferWriteCHAR(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018187 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018188
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018189 int mem_base;
18190 xmlBufferPtr buf; /* the XML buffer */
18191 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018192 xmlChar * string; /* the string to add */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018193 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018194
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018195 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18196 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
18197 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018198 buf = gen_xmlBufferPtr(n_buf, 0);
18199 string = gen_const_xmlChar_ptr(n_string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018200
William M. Brackf13f77f2004-11-12 16:03:48 +000018201 xmlBufferWriteCHAR(buf, (const xmlChar *)string);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018202 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018203 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018204 des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018205 xmlResetLastError();
18206 if (mem_base != xmlMemBlocks()) {
18207 printf("Leak of %d blocks found in xmlBufferWriteCHAR",
18208 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018209 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018210 printf(" %d", n_buf);
18211 printf(" %d", n_string);
18212 printf("\n");
18213 }
18214 }
18215 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018216 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018217
Daniel Veillard42595322004-11-08 10:52:06 +000018218 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018219}
18220
18221
18222static int
18223test_xmlBufferWriteChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018224 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018225
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018226 int mem_base;
18227 xmlBufferPtr buf; /* the XML buffer output */
18228 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018229 char * string; /* the string to add */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018230 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018231
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018232 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18233 for (n_string = 0;n_string < gen_nb_const_char_ptr;n_string++) {
18234 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018235 buf = gen_xmlBufferPtr(n_buf, 0);
18236 string = gen_const_char_ptr(n_string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018237
William M. Brackf13f77f2004-11-12 16:03:48 +000018238 xmlBufferWriteChar(buf, (const char *)string);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018239 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018240 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018241 des_const_char_ptr(n_string, (const char *)string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018242 xmlResetLastError();
18243 if (mem_base != xmlMemBlocks()) {
18244 printf("Leak of %d blocks found in xmlBufferWriteChar",
18245 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018246 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018247 printf(" %d", n_buf);
18248 printf(" %d", n_string);
18249 printf("\n");
18250 }
18251 }
18252 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018253 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018254
Daniel Veillard42595322004-11-08 10:52:06 +000018255 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018256}
18257
18258
18259static int
18260test_xmlBufferWriteQuotedString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018261 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018262
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018263 int mem_base;
18264 xmlBufferPtr buf; /* the XML buffer output */
18265 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018266 xmlChar * string; /* the string to add */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018267 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018268
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018269 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18270 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
18271 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018272 buf = gen_xmlBufferPtr(n_buf, 0);
18273 string = gen_const_xmlChar_ptr(n_string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018274
William M. Brackf13f77f2004-11-12 16:03:48 +000018275 xmlBufferWriteQuotedString(buf, (const xmlChar *)string);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018276 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018277 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018278 des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018279 xmlResetLastError();
18280 if (mem_base != xmlMemBlocks()) {
18281 printf("Leak of %d blocks found in xmlBufferWriteQuotedString",
18282 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018283 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018284 printf(" %d", n_buf);
18285 printf(" %d", n_string);
18286 printf("\n");
18287 }
18288 }
18289 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018290 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018291
Daniel Veillard42595322004-11-08 10:52:06 +000018292 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018293}
18294
18295
18296static int
18297test_xmlBuildQName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018298 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018299
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018300 int mem_base;
18301 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018302 xmlChar * ncname; /* the Name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018303 int n_ncname;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018304 xmlChar * prefix; /* the prefix */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018305 int n_prefix;
18306 xmlChar * memory; /* preallocated memory */
18307 int n_memory;
18308 int len; /* preallocated memory length */
18309 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018310
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018311 for (n_ncname = 0;n_ncname < gen_nb_const_xmlChar_ptr;n_ncname++) {
18312 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
18313 for (n_memory = 0;n_memory < gen_nb_xmlChar_ptr;n_memory++) {
18314 for (n_len = 0;n_len < gen_nb_int;n_len++) {
18315 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018316 ncname = gen_const_xmlChar_ptr(n_ncname, 0);
18317 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
18318 memory = gen_xmlChar_ptr(n_memory, 2);
18319 len = gen_int(n_len, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018320
William M. Brackf13f77f2004-11-12 16:03:48 +000018321 ret_val = xmlBuildQName((const xmlChar *)ncname, (const xmlChar *)prefix, memory, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018322 if ((ret_val != NULL) && (ret_val != ncname) &&
18323 (ret_val != prefix) && (ret_val != memory))
18324 xmlFree(ret_val);
18325 ret_val = NULL;
18326 desret_xmlChar_ptr(ret_val);
18327 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018328 des_const_xmlChar_ptr(n_ncname, (const xmlChar *)ncname, 0);
18329 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000018330 des_xmlChar_ptr(n_memory, memory, 2);
18331 des_int(n_len, len, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018332 xmlResetLastError();
18333 if (mem_base != xmlMemBlocks()) {
18334 printf("Leak of %d blocks found in xmlBuildQName",
18335 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018336 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018337 printf(" %d", n_ncname);
18338 printf(" %d", n_prefix);
18339 printf(" %d", n_memory);
18340 printf(" %d", n_len);
18341 printf("\n");
18342 }
18343 }
18344 }
18345 }
18346 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018347 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018348
Daniel Veillard42595322004-11-08 10:52:06 +000018349 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018350}
18351
18352
18353static int
18354test_xmlCopyDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018355 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018356
William M. Brack21e4ef22005-01-02 09:53:13 +000018357#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000018358 int mem_base;
18359 xmlDocPtr ret_val;
18360 xmlDocPtr doc; /* the document */
18361 int n_doc;
18362 int recursive; /* if not zero do a recursive copy. */
18363 int n_recursive;
18364
18365 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
18366 for (n_recursive = 0;n_recursive < gen_nb_int;n_recursive++) {
18367 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018368 doc = gen_xmlDocPtr(n_doc, 0);
18369 recursive = gen_int(n_recursive, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018370
18371 ret_val = xmlCopyDoc(doc, recursive);
18372 desret_xmlDocPtr(ret_val);
18373 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018374 des_xmlDocPtr(n_doc, doc, 0);
18375 des_int(n_recursive, recursive, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018376 xmlResetLastError();
18377 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000018378 printf("Leak of %d blocks found in xmlCopyDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000018379 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018380 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000018381 printf(" %d", n_doc);
18382 printf(" %d", n_recursive);
18383 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000018384 }
18385 }
18386 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018387 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018388#endif
18389
Daniel Veillard42595322004-11-08 10:52:06 +000018390 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018391}
18392
18393
18394static int
18395test_xmlCopyDtd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018396 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018397
William M. Brack21e4ef22005-01-02 09:53:13 +000018398#if defined(LIBXML_TREE_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000018399 int mem_base;
18400 xmlDtdPtr ret_val;
18401 xmlDtdPtr dtd; /* the dtd */
18402 int n_dtd;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018403
Daniel Veillard27f20102004-11-05 11:50:11 +000018404 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
18405 mem_base = xmlMemBlocks();
18406 dtd = gen_xmlDtdPtr(n_dtd, 0);
18407
18408 ret_val = xmlCopyDtd(dtd);
18409 desret_xmlDtdPtr(ret_val);
18410 call_tests++;
18411 des_xmlDtdPtr(n_dtd, dtd, 0);
18412 xmlResetLastError();
18413 if (mem_base != xmlMemBlocks()) {
18414 printf("Leak of %d blocks found in xmlCopyDtd",
18415 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018416 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000018417 printf(" %d", n_dtd);
18418 printf("\n");
18419 }
18420 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018421 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000018422#endif
18423
Daniel Veillard42595322004-11-08 10:52:06 +000018424 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018425}
18426
18427
18428static int
18429test_xmlCopyNamespace(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018430 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018431
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018432 int mem_base;
18433 xmlNsPtr ret_val;
18434 xmlNsPtr cur; /* the namespace */
18435 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018436
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018437 for (n_cur = 0;n_cur < gen_nb_xmlNsPtr;n_cur++) {
18438 mem_base = xmlMemBlocks();
18439 cur = gen_xmlNsPtr(n_cur, 0);
18440
18441 ret_val = xmlCopyNamespace(cur);
18442 if (ret_val != NULL) xmlFreeNs(ret_val);
18443 desret_xmlNsPtr(ret_val);
18444 call_tests++;
18445 des_xmlNsPtr(n_cur, cur, 0);
18446 xmlResetLastError();
18447 if (mem_base != xmlMemBlocks()) {
18448 printf("Leak of %d blocks found in xmlCopyNamespace",
18449 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018450 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018451 printf(" %d", n_cur);
18452 printf("\n");
18453 }
18454 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018455 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018456
Daniel Veillard42595322004-11-08 10:52:06 +000018457 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018458}
18459
18460
18461static int
18462test_xmlCopyNamespaceList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018463 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018464
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018465 int mem_base;
18466 xmlNsPtr ret_val;
18467 xmlNsPtr cur; /* the first namespace */
18468 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018469
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018470 for (n_cur = 0;n_cur < gen_nb_xmlNsPtr;n_cur++) {
18471 mem_base = xmlMemBlocks();
18472 cur = gen_xmlNsPtr(n_cur, 0);
18473
18474 ret_val = xmlCopyNamespaceList(cur);
18475 if (ret_val != NULL) xmlFreeNsList(ret_val);
18476 desret_xmlNsPtr(ret_val);
18477 call_tests++;
18478 des_xmlNsPtr(n_cur, cur, 0);
18479 xmlResetLastError();
18480 if (mem_base != xmlMemBlocks()) {
18481 printf("Leak of %d blocks found in xmlCopyNamespaceList",
18482 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018483 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018484 printf(" %d", n_cur);
18485 printf("\n");
18486 }
18487 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018488 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018489
Daniel Veillard42595322004-11-08 10:52:06 +000018490 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018491}
18492
18493
18494static int
18495test_xmlCopyNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018496 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018497
Daniel Veillardce682bc2004-11-05 17:22:25 +000018498 int mem_base;
18499 xmlNodePtr ret_val;
18500 xmlNodePtr node; /* the node */
18501 int n_node;
18502 int extended; /* if 1 do a recursive copy (properties, namespaces and children when applicable) if 2 copy properties and namespaces (when applicable) */
18503 int n_extended;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018504
Daniel Veillardce682bc2004-11-05 17:22:25 +000018505 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
18506 for (n_extended = 0;n_extended < gen_nb_int;n_extended++) {
18507 mem_base = xmlMemBlocks();
18508 node = gen_const_xmlNodePtr(n_node, 0);
18509 extended = gen_int(n_extended, 1);
18510
William M. Brackf13f77f2004-11-12 16:03:48 +000018511 ret_val = xmlCopyNode((const xmlNodePtr)node, extended);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018512 desret_xmlNodePtr(ret_val);
18513 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018514 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018515 des_int(n_extended, extended, 1);
18516 xmlResetLastError();
18517 if (mem_base != xmlMemBlocks()) {
18518 printf("Leak of %d blocks found in xmlCopyNode",
18519 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018520 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018521 printf(" %d", n_node);
18522 printf(" %d", n_extended);
18523 printf("\n");
18524 }
18525 }
18526 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018527 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018528
Daniel Veillard42595322004-11-08 10:52:06 +000018529 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018530}
18531
18532
18533static int
18534test_xmlCopyNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018535 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018536
Daniel Veillardce682bc2004-11-05 17:22:25 +000018537 int mem_base;
18538 xmlNodePtr ret_val;
18539 xmlNodePtr node; /* the first node in the list. */
18540 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018541
Daniel Veillardce682bc2004-11-05 17:22:25 +000018542 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
18543 mem_base = xmlMemBlocks();
18544 node = gen_const_xmlNodePtr(n_node, 0);
18545
William M. Brackf13f77f2004-11-12 16:03:48 +000018546 ret_val = xmlCopyNodeList((const xmlNodePtr)node);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018547 desret_xmlNodePtr(ret_val);
18548 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018549 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018550 xmlResetLastError();
18551 if (mem_base != xmlMemBlocks()) {
18552 printf("Leak of %d blocks found in xmlCopyNodeList",
18553 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018554 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018555 printf(" %d", n_node);
18556 printf("\n");
18557 }
18558 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018559 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018560
Daniel Veillard42595322004-11-08 10:52:06 +000018561 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018562}
18563
18564
18565static int
18566test_xmlCopyProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018567 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018568
Daniel Veillard57b25162004-11-06 14:50:18 +000018569 int mem_base;
18570 xmlAttrPtr ret_val;
18571 xmlNodePtr target; /* the element where the attribute will be grafted */
18572 int n_target;
18573 xmlAttrPtr cur; /* the attribute */
18574 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018575
Daniel Veillard57b25162004-11-06 14:50:18 +000018576 for (n_target = 0;n_target < gen_nb_xmlNodePtr;n_target++) {
18577 for (n_cur = 0;n_cur < gen_nb_xmlAttrPtr;n_cur++) {
18578 mem_base = xmlMemBlocks();
18579 target = gen_xmlNodePtr(n_target, 0);
18580 cur = gen_xmlAttrPtr(n_cur, 1);
18581
18582 ret_val = xmlCopyProp(target, cur);
18583 desret_xmlAttrPtr(ret_val);
18584 call_tests++;
18585 des_xmlNodePtr(n_target, target, 0);
18586 des_xmlAttrPtr(n_cur, cur, 1);
18587 xmlResetLastError();
18588 if (mem_base != xmlMemBlocks()) {
18589 printf("Leak of %d blocks found in xmlCopyProp",
18590 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018591 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000018592 printf(" %d", n_target);
18593 printf(" %d", n_cur);
18594 printf("\n");
18595 }
18596 }
18597 }
Daniel Veillard57b25162004-11-06 14:50:18 +000018598 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018599
Daniel Veillard42595322004-11-08 10:52:06 +000018600 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018601}
18602
18603
18604static int
18605test_xmlCopyPropList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018606 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018607
Daniel Veillard57b25162004-11-06 14:50:18 +000018608 int mem_base;
18609 xmlAttrPtr ret_val;
18610 xmlNodePtr target; /* the element where the attributes will be grafted */
18611 int n_target;
18612 xmlAttrPtr cur; /* the first attribute */
18613 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018614
Daniel Veillard57b25162004-11-06 14:50:18 +000018615 for (n_target = 0;n_target < gen_nb_xmlNodePtr;n_target++) {
18616 for (n_cur = 0;n_cur < gen_nb_xmlAttrPtr;n_cur++) {
18617 mem_base = xmlMemBlocks();
18618 target = gen_xmlNodePtr(n_target, 0);
18619 cur = gen_xmlAttrPtr(n_cur, 1);
18620
18621 ret_val = xmlCopyPropList(target, cur);
18622 desret_xmlAttrPtr(ret_val);
18623 call_tests++;
18624 des_xmlNodePtr(n_target, target, 0);
18625 des_xmlAttrPtr(n_cur, cur, 1);
18626 xmlResetLastError();
18627 if (mem_base != xmlMemBlocks()) {
18628 printf("Leak of %d blocks found in xmlCopyPropList",
18629 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018630 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000018631 printf(" %d", n_target);
18632 printf(" %d", n_cur);
18633 printf("\n");
18634 }
18635 }
18636 }
Daniel Veillard57b25162004-11-06 14:50:18 +000018637 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018638
Daniel Veillard42595322004-11-08 10:52:06 +000018639 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018640}
18641
18642
18643static int
18644test_xmlCreateIntSubset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018645 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018646
Daniel Veillard34099b42004-11-04 17:34:35 +000018647 int mem_base;
18648 xmlDtdPtr ret_val;
18649 xmlDocPtr doc; /* the document pointer */
18650 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018651 xmlChar * name; /* the DTD name */
Daniel Veillard34099b42004-11-04 17:34:35 +000018652 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018653 xmlChar * ExternalID; /* the external (PUBLIC) ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000018654 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018655 xmlChar * SystemID; /* the system ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000018656 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018657
Daniel Veillard34099b42004-11-04 17:34:35 +000018658 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
18659 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
18660 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
18661 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
18662 mem_base = xmlMemBlocks();
18663 doc = gen_xmlDocPtr(n_doc, 0);
18664 name = gen_const_xmlChar_ptr(n_name, 1);
18665 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
18666 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
18667
William M. Brackf13f77f2004-11-12 16:03:48 +000018668 ret_val = xmlCreateIntSubset(doc, (const xmlChar *)name, (const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard34099b42004-11-04 17:34:35 +000018669 desret_xmlDtdPtr(ret_val);
18670 call_tests++;
18671 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018672 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
18673 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 2);
18674 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 3);
Daniel Veillard34099b42004-11-04 17:34:35 +000018675 xmlResetLastError();
18676 if (mem_base != xmlMemBlocks()) {
18677 printf("Leak of %d blocks found in xmlCreateIntSubset",
18678 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018679 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000018680 printf(" %d", n_doc);
18681 printf(" %d", n_name);
18682 printf(" %d", n_ExternalID);
18683 printf(" %d", n_SystemID);
18684 printf("\n");
18685 }
18686 }
18687 }
18688 }
18689 }
Daniel Veillard34099b42004-11-04 17:34:35 +000018690 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018691
Daniel Veillard42595322004-11-08 10:52:06 +000018692 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018693}
18694
18695
18696static int
18697test_xmlDocCopyNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018698 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018699
Daniel Veillardce682bc2004-11-05 17:22:25 +000018700 int mem_base;
18701 xmlNodePtr ret_val;
18702 xmlNodePtr node; /* the node */
18703 int n_node;
18704 xmlDocPtr doc; /* the document */
18705 int n_doc;
18706 int extended; /* if 1 do a recursive copy (properties, namespaces and children when applicable) if 2 copy properties and namespaces (when applicable) */
18707 int n_extended;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018708
Daniel Veillardce682bc2004-11-05 17:22:25 +000018709 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
18710 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
18711 for (n_extended = 0;n_extended < gen_nb_int;n_extended++) {
18712 mem_base = xmlMemBlocks();
18713 node = gen_const_xmlNodePtr(n_node, 0);
18714 doc = gen_xmlDocPtr(n_doc, 1);
18715 extended = gen_int(n_extended, 2);
18716
William M. Brackf13f77f2004-11-12 16:03:48 +000018717 ret_val = xmlDocCopyNode((const xmlNodePtr)node, doc, extended);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018718 desret_xmlNodePtr(ret_val);
18719 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018720 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018721 des_xmlDocPtr(n_doc, doc, 1);
18722 des_int(n_extended, extended, 2);
18723 xmlResetLastError();
18724 if (mem_base != xmlMemBlocks()) {
18725 printf("Leak of %d blocks found in xmlDocCopyNode",
18726 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018727 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018728 printf(" %d", n_node);
18729 printf(" %d", n_doc);
18730 printf(" %d", n_extended);
18731 printf("\n");
18732 }
18733 }
18734 }
18735 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018736 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018737
Daniel Veillard42595322004-11-08 10:52:06 +000018738 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018739}
18740
18741
18742static int
18743test_xmlDocCopyNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018744 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018745
Daniel Veillardce682bc2004-11-05 17:22:25 +000018746 int mem_base;
18747 xmlNodePtr ret_val;
18748 xmlDocPtr doc; /* the target document */
18749 int n_doc;
18750 xmlNodePtr node; /* the first node in the list. */
18751 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018752
Daniel Veillardce682bc2004-11-05 17:22:25 +000018753 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
18754 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
18755 mem_base = xmlMemBlocks();
18756 doc = gen_xmlDocPtr(n_doc, 0);
18757 node = gen_const_xmlNodePtr(n_node, 1);
18758
William M. Brackf13f77f2004-11-12 16:03:48 +000018759 ret_val = xmlDocCopyNodeList(doc, (const xmlNodePtr)node);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018760 desret_xmlNodePtr(ret_val);
18761 call_tests++;
18762 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018763 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018764 xmlResetLastError();
18765 if (mem_base != xmlMemBlocks()) {
18766 printf("Leak of %d blocks found in xmlDocCopyNodeList",
18767 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018768 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018769 printf(" %d", n_doc);
18770 printf(" %d", n_node);
18771 printf("\n");
18772 }
18773 }
18774 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018775 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018776
Daniel Veillard42595322004-11-08 10:52:06 +000018777 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018778}
18779
18780
18781static int
18782test_xmlDocDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018783 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018784
William M. Brack21e4ef22005-01-02 09:53:13 +000018785#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000018786 int mem_base;
18787 int ret_val;
18788 FILE * f; /* the FILE* */
18789 int n_f;
18790 xmlDocPtr cur; /* the document */
18791 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018792
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000018793 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
18794 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
18795 mem_base = xmlMemBlocks();
18796 f = gen_FILE_ptr(n_f, 0);
18797 cur = gen_xmlDocPtr(n_cur, 1);
18798
18799 ret_val = xmlDocDump(f, cur);
18800 desret_int(ret_val);
18801 call_tests++;
18802 des_FILE_ptr(n_f, f, 0);
18803 des_xmlDocPtr(n_cur, cur, 1);
18804 xmlResetLastError();
18805 if (mem_base != xmlMemBlocks()) {
18806 printf("Leak of %d blocks found in xmlDocDump",
18807 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018808 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000018809 printf(" %d", n_f);
18810 printf(" %d", n_cur);
18811 printf("\n");
18812 }
18813 }
18814 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018815 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000018816#endif
18817
Daniel Veillard42595322004-11-08 10:52:06 +000018818 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018819}
18820
18821
18822static int
18823test_xmlDocDumpFormatMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018824 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018825
William M. Brack21e4ef22005-01-02 09:53:13 +000018826#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018827 int mem_base;
18828 xmlDocPtr cur; /* the document */
18829 int n_cur;
18830 xmlChar ** mem; /* OUT: the memory pointer */
18831 int n_mem;
18832 int * size; /* OUT: the memory length */
18833 int n_size;
18834 int format; /* should formatting spaces been added */
18835 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018836
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018837 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
18838 for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) {
18839 for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) {
18840 for (n_format = 0;n_format < gen_nb_int;n_format++) {
18841 mem_base = xmlMemBlocks();
18842 cur = gen_xmlDocPtr(n_cur, 0);
18843 mem = gen_xmlChar_ptr_ptr(n_mem, 1);
18844 size = gen_int_ptr(n_size, 2);
18845 format = gen_int(n_format, 3);
18846
18847 xmlDocDumpFormatMemory(cur, mem, size, format);
18848 call_tests++;
18849 des_xmlDocPtr(n_cur, cur, 0);
18850 des_xmlChar_ptr_ptr(n_mem, mem, 1);
18851 des_int_ptr(n_size, size, 2);
18852 des_int(n_format, format, 3);
18853 xmlResetLastError();
18854 if (mem_base != xmlMemBlocks()) {
18855 printf("Leak of %d blocks found in xmlDocDumpFormatMemory",
18856 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018857 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018858 printf(" %d", n_cur);
18859 printf(" %d", n_mem);
18860 printf(" %d", n_size);
18861 printf(" %d", n_format);
18862 printf("\n");
18863 }
18864 }
18865 }
18866 }
18867 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018868 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018869#endif
18870
Daniel Veillard42595322004-11-08 10:52:06 +000018871 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018872}
18873
18874
18875static int
18876test_xmlDocDumpFormatMemoryEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018877 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018878
William M. Brack21e4ef22005-01-02 09:53:13 +000018879#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018880 int mem_base;
18881 xmlDocPtr out_doc; /* Document to generate XML text from */
18882 int n_out_doc;
18883 xmlChar ** doc_txt_ptr; /* Memory pointer for allocated XML text */
18884 int n_doc_txt_ptr;
18885 int * doc_txt_len; /* Length of the generated XML text */
18886 int n_doc_txt_len;
18887 char * txt_encoding; /* Character encoding to use when generating XML text */
18888 int n_txt_encoding;
18889 int format; /* should formatting spaces been added */
18890 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018891
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018892 for (n_out_doc = 0;n_out_doc < gen_nb_xmlDocPtr;n_out_doc++) {
18893 for (n_doc_txt_ptr = 0;n_doc_txt_ptr < gen_nb_xmlChar_ptr_ptr;n_doc_txt_ptr++) {
18894 for (n_doc_txt_len = 0;n_doc_txt_len < gen_nb_int_ptr;n_doc_txt_len++) {
18895 for (n_txt_encoding = 0;n_txt_encoding < gen_nb_const_char_ptr;n_txt_encoding++) {
18896 for (n_format = 0;n_format < gen_nb_int;n_format++) {
18897 mem_base = xmlMemBlocks();
18898 out_doc = gen_xmlDocPtr(n_out_doc, 0);
18899 doc_txt_ptr = gen_xmlChar_ptr_ptr(n_doc_txt_ptr, 1);
18900 doc_txt_len = gen_int_ptr(n_doc_txt_len, 2);
18901 txt_encoding = gen_const_char_ptr(n_txt_encoding, 3);
18902 format = gen_int(n_format, 4);
18903
William M. Brackf13f77f2004-11-12 16:03:48 +000018904 xmlDocDumpFormatMemoryEnc(out_doc, doc_txt_ptr, doc_txt_len, (const char *)txt_encoding, format);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018905 call_tests++;
18906 des_xmlDocPtr(n_out_doc, out_doc, 0);
18907 des_xmlChar_ptr_ptr(n_doc_txt_ptr, doc_txt_ptr, 1);
18908 des_int_ptr(n_doc_txt_len, doc_txt_len, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000018909 des_const_char_ptr(n_txt_encoding, (const char *)txt_encoding, 3);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018910 des_int(n_format, format, 4);
18911 xmlResetLastError();
18912 if (mem_base != xmlMemBlocks()) {
18913 printf("Leak of %d blocks found in xmlDocDumpFormatMemoryEnc",
18914 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018915 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018916 printf(" %d", n_out_doc);
18917 printf(" %d", n_doc_txt_ptr);
18918 printf(" %d", n_doc_txt_len);
18919 printf(" %d", n_txt_encoding);
18920 printf(" %d", n_format);
18921 printf("\n");
18922 }
18923 }
18924 }
18925 }
18926 }
18927 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018928 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018929#endif
18930
Daniel Veillard42595322004-11-08 10:52:06 +000018931 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018932}
18933
18934
18935static int
18936test_xmlDocDumpMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018937 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018938
William M. Brack21e4ef22005-01-02 09:53:13 +000018939#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018940 int mem_base;
18941 xmlDocPtr cur; /* the document */
18942 int n_cur;
18943 xmlChar ** mem; /* OUT: the memory pointer */
18944 int n_mem;
18945 int * size; /* OUT: the memory length */
18946 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018947
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018948 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
18949 for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) {
18950 for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) {
18951 mem_base = xmlMemBlocks();
18952 cur = gen_xmlDocPtr(n_cur, 0);
18953 mem = gen_xmlChar_ptr_ptr(n_mem, 1);
18954 size = gen_int_ptr(n_size, 2);
18955
18956 xmlDocDumpMemory(cur, mem, size);
18957 call_tests++;
18958 des_xmlDocPtr(n_cur, cur, 0);
18959 des_xmlChar_ptr_ptr(n_mem, mem, 1);
18960 des_int_ptr(n_size, size, 2);
18961 xmlResetLastError();
18962 if (mem_base != xmlMemBlocks()) {
18963 printf("Leak of %d blocks found in xmlDocDumpMemory",
18964 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018965 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018966 printf(" %d", n_cur);
18967 printf(" %d", n_mem);
18968 printf(" %d", n_size);
18969 printf("\n");
18970 }
18971 }
18972 }
18973 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018974 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018975#endif
18976
Daniel Veillard42595322004-11-08 10:52:06 +000018977 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018978}
18979
18980
18981static int
18982test_xmlDocDumpMemoryEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018983 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018984
William M. Brack21e4ef22005-01-02 09:53:13 +000018985#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018986 int mem_base;
18987 xmlDocPtr out_doc; /* Document to generate XML text from */
18988 int n_out_doc;
18989 xmlChar ** doc_txt_ptr; /* Memory pointer for allocated XML text */
18990 int n_doc_txt_ptr;
18991 int * doc_txt_len; /* Length of the generated XML text */
18992 int n_doc_txt_len;
18993 char * txt_encoding; /* Character encoding to use when generating XML text */
18994 int n_txt_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018995
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018996 for (n_out_doc = 0;n_out_doc < gen_nb_xmlDocPtr;n_out_doc++) {
18997 for (n_doc_txt_ptr = 0;n_doc_txt_ptr < gen_nb_xmlChar_ptr_ptr;n_doc_txt_ptr++) {
18998 for (n_doc_txt_len = 0;n_doc_txt_len < gen_nb_int_ptr;n_doc_txt_len++) {
18999 for (n_txt_encoding = 0;n_txt_encoding < gen_nb_const_char_ptr;n_txt_encoding++) {
19000 mem_base = xmlMemBlocks();
19001 out_doc = gen_xmlDocPtr(n_out_doc, 0);
19002 doc_txt_ptr = gen_xmlChar_ptr_ptr(n_doc_txt_ptr, 1);
19003 doc_txt_len = gen_int_ptr(n_doc_txt_len, 2);
19004 txt_encoding = gen_const_char_ptr(n_txt_encoding, 3);
19005
William M. Brackf13f77f2004-11-12 16:03:48 +000019006 xmlDocDumpMemoryEnc(out_doc, doc_txt_ptr, doc_txt_len, (const char *)txt_encoding);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019007 call_tests++;
19008 des_xmlDocPtr(n_out_doc, out_doc, 0);
19009 des_xmlChar_ptr_ptr(n_doc_txt_ptr, doc_txt_ptr, 1);
19010 des_int_ptr(n_doc_txt_len, doc_txt_len, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000019011 des_const_char_ptr(n_txt_encoding, (const char *)txt_encoding, 3);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019012 xmlResetLastError();
19013 if (mem_base != xmlMemBlocks()) {
19014 printf("Leak of %d blocks found in xmlDocDumpMemoryEnc",
19015 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019016 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019017 printf(" %d", n_out_doc);
19018 printf(" %d", n_doc_txt_ptr);
19019 printf(" %d", n_doc_txt_len);
19020 printf(" %d", n_txt_encoding);
19021 printf("\n");
19022 }
19023 }
19024 }
19025 }
19026 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019027 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019028#endif
19029
Daniel Veillard42595322004-11-08 10:52:06 +000019030 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019031}
19032
19033
19034static int
19035test_xmlDocFormatDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019036 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019037
William M. Brack21e4ef22005-01-02 09:53:13 +000019038#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019039 int mem_base;
19040 int ret_val;
19041 FILE * f; /* the FILE* */
19042 int n_f;
19043 xmlDocPtr cur; /* the document */
19044 int n_cur;
19045 int format; /* should formatting spaces been added */
19046 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019047
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019048 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
19049 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
19050 for (n_format = 0;n_format < gen_nb_int;n_format++) {
19051 mem_base = xmlMemBlocks();
19052 f = gen_FILE_ptr(n_f, 0);
19053 cur = gen_xmlDocPtr(n_cur, 1);
19054 format = gen_int(n_format, 2);
19055
19056 ret_val = xmlDocFormatDump(f, cur, format);
19057 desret_int(ret_val);
19058 call_tests++;
19059 des_FILE_ptr(n_f, f, 0);
19060 des_xmlDocPtr(n_cur, cur, 1);
19061 des_int(n_format, format, 2);
19062 xmlResetLastError();
19063 if (mem_base != xmlMemBlocks()) {
19064 printf("Leak of %d blocks found in xmlDocFormatDump",
19065 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019066 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019067 printf(" %d", n_f);
19068 printf(" %d", n_cur);
19069 printf(" %d", n_format);
19070 printf("\n");
19071 }
19072 }
19073 }
19074 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019075 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019076#endif
19077
Daniel Veillard42595322004-11-08 10:52:06 +000019078 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019079}
19080
19081
19082static int
19083test_xmlDocGetRootElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019084 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019085
19086 int mem_base;
19087 xmlNodePtr ret_val;
19088 xmlDocPtr doc; /* the document */
19089 int n_doc;
19090
19091 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19092 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019093 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019094
19095 ret_val = xmlDocGetRootElement(doc);
19096 desret_xmlNodePtr(ret_val);
19097 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019098 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019099 xmlResetLastError();
19100 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019101 printf("Leak of %d blocks found in xmlDocGetRootElement",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019102 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019103 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019104 printf(" %d", n_doc);
19105 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019106 }
19107 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019108 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019109
Daniel Veillard42595322004-11-08 10:52:06 +000019110 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019111}
19112
19113
19114static int
19115test_xmlDocSetRootElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019116 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019117
William M. Brack21e4ef22005-01-02 09:53:13 +000019118#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000019119 int mem_base;
19120 xmlNodePtr ret_val;
19121 xmlDocPtr doc; /* the document */
19122 int n_doc;
19123 xmlNodePtr root; /* the new document root element */
19124 int n_root;
19125
19126 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019127 for (n_root = 0;n_root < gen_nb_xmlNodePtr_in;n_root++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000019128 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019129 doc = gen_xmlDocPtr(n_doc, 0);
19130 root = gen_xmlNodePtr_in(n_root, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019131
19132 ret_val = xmlDocSetRootElement(doc, root);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019133 if (doc == NULL) { xmlFreeNode(root) ; root = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000019134 desret_xmlNodePtr(ret_val);
19135 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019136 des_xmlDocPtr(n_doc, doc, 0);
19137 des_xmlNodePtr_in(n_root, root, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019138 xmlResetLastError();
19139 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019140 printf("Leak of %d blocks found in xmlDocSetRootElement",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019141 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019142 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019143 printf(" %d", n_doc);
19144 printf(" %d", n_root);
19145 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019146 }
19147 }
19148 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019149 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019150#endif
19151
Daniel Veillard42595322004-11-08 10:52:06 +000019152 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019153}
19154
19155
19156static int
19157test_xmlElemDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019158 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019159
William M. Brack21e4ef22005-01-02 09:53:13 +000019160#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019161 int mem_base;
19162 FILE * f; /* the FILE * for the output */
19163 int n_f;
19164 xmlDocPtr doc; /* the document */
19165 int n_doc;
19166 xmlNodePtr cur; /* the current node */
19167 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019168
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019169 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
19170 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19171 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
19172 mem_base = xmlMemBlocks();
19173 f = gen_FILE_ptr(n_f, 0);
19174 doc = gen_xmlDocPtr(n_doc, 1);
19175 cur = gen_xmlNodePtr(n_cur, 2);
19176
19177 xmlElemDump(f, doc, cur);
19178 call_tests++;
19179 des_FILE_ptr(n_f, f, 0);
19180 des_xmlDocPtr(n_doc, doc, 1);
19181 des_xmlNodePtr(n_cur, cur, 2);
19182 xmlResetLastError();
19183 if (mem_base != xmlMemBlocks()) {
19184 printf("Leak of %d blocks found in xmlElemDump",
19185 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019186 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019187 printf(" %d", n_f);
19188 printf(" %d", n_doc);
19189 printf(" %d", n_cur);
19190 printf("\n");
19191 }
19192 }
19193 }
19194 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019195 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019196#endif
19197
Daniel Veillard42595322004-11-08 10:52:06 +000019198 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019199}
19200
19201
19202static int
19203test_xmlGetBufferAllocationScheme(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019204 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019205
Daniel Veillard57b25162004-11-06 14:50:18 +000019206 int mem_base;
19207 xmlBufferAllocationScheme ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019208
Daniel Veillard57b25162004-11-06 14:50:18 +000019209 mem_base = xmlMemBlocks();
19210
19211 ret_val = xmlGetBufferAllocationScheme();
19212 desret_xmlBufferAllocationScheme(ret_val);
19213 call_tests++;
19214 xmlResetLastError();
19215 if (mem_base != xmlMemBlocks()) {
19216 printf("Leak of %d blocks found in xmlGetBufferAllocationScheme",
19217 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019218 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000019219 printf("\n");
19220 }
Daniel Veillard57b25162004-11-06 14:50:18 +000019221 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019222
Daniel Veillard42595322004-11-08 10:52:06 +000019223 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019224}
19225
19226
19227static int
19228test_xmlGetCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019229 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019230
19231 int mem_base;
19232 int ret_val;
19233
19234 mem_base = xmlMemBlocks();
19235
19236 ret_val = xmlGetCompressMode();
19237 desret_int(ret_val);
19238 call_tests++;
19239 xmlResetLastError();
19240 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019241 printf("Leak of %d blocks found in xmlGetCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019242 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019243 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019244 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019245 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019246 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019247
Daniel Veillard42595322004-11-08 10:52:06 +000019248 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019249}
19250
19251
19252static int
19253test_xmlGetDocCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019254 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019255
19256 int mem_base;
19257 int ret_val;
19258 xmlDocPtr doc; /* the document */
19259 int n_doc;
19260
19261 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19262 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019263 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019264
19265 ret_val = xmlGetDocCompressMode(doc);
19266 desret_int(ret_val);
19267 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019268 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019269 xmlResetLastError();
19270 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019271 printf("Leak of %d blocks found in xmlGetDocCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019272 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019273 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019274 printf(" %d", n_doc);
19275 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019276 }
19277 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019278 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019279
Daniel Veillard42595322004-11-08 10:52:06 +000019280 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019281}
19282
19283
19284static int
19285test_xmlGetIntSubset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019286 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019287
Daniel Veillard34099b42004-11-04 17:34:35 +000019288 int mem_base;
19289 xmlDtdPtr ret_val;
19290 xmlDocPtr doc; /* the document pointer */
19291 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019292
Daniel Veillard34099b42004-11-04 17:34:35 +000019293 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19294 mem_base = xmlMemBlocks();
19295 doc = gen_xmlDocPtr(n_doc, 0);
19296
19297 ret_val = xmlGetIntSubset(doc);
19298 desret_xmlDtdPtr(ret_val);
19299 call_tests++;
19300 des_xmlDocPtr(n_doc, doc, 0);
19301 xmlResetLastError();
19302 if (mem_base != xmlMemBlocks()) {
19303 printf("Leak of %d blocks found in xmlGetIntSubset",
19304 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019305 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000019306 printf(" %d", n_doc);
19307 printf("\n");
19308 }
19309 }
Daniel Veillard34099b42004-11-04 17:34:35 +000019310 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019311
Daniel Veillard42595322004-11-08 10:52:06 +000019312 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019313}
19314
19315
19316static int
19317test_xmlGetLastChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019318 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019319
19320 int mem_base;
19321 xmlNodePtr ret_val;
19322 xmlNodePtr parent; /* the parent node */
19323 int n_parent;
19324
19325 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
19326 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019327 parent = gen_xmlNodePtr(n_parent, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019328
19329 ret_val = xmlGetLastChild(parent);
19330 desret_xmlNodePtr(ret_val);
19331 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019332 des_xmlNodePtr(n_parent, parent, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019333 xmlResetLastError();
19334 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019335 printf("Leak of %d blocks found in xmlGetLastChild",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019336 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019337 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019338 printf(" %d", n_parent);
19339 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019340 }
19341 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019342 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019343
Daniel Veillard42595322004-11-08 10:52:06 +000019344 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019345}
19346
19347
19348static int
19349test_xmlGetLineNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019350 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019351
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019352 int mem_base;
19353 long ret_val;
19354 xmlNodePtr node; /* valid node */
19355 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019356
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019357 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19358 mem_base = xmlMemBlocks();
19359 node = gen_xmlNodePtr(n_node, 0);
19360
19361 ret_val = xmlGetLineNo(node);
19362 desret_long(ret_val);
19363 call_tests++;
19364 des_xmlNodePtr(n_node, node, 0);
19365 xmlResetLastError();
19366 if (mem_base != xmlMemBlocks()) {
19367 printf("Leak of %d blocks found in xmlGetLineNo",
19368 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019369 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019370 printf(" %d", n_node);
19371 printf("\n");
19372 }
19373 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019374 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019375
Daniel Veillard42595322004-11-08 10:52:06 +000019376 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019377}
19378
19379
19380static int
19381test_xmlGetNoNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019382 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019383
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019384 int mem_base;
19385 xmlChar * ret_val;
19386 xmlNodePtr node; /* the node */
19387 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019388 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019389 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019390
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019391 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19392 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19393 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019394 node = gen_xmlNodePtr(n_node, 0);
19395 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019396
William M. Brackf13f77f2004-11-12 16:03:48 +000019397 ret_val = xmlGetNoNsProp(node, (const xmlChar *)name);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019398 desret_xmlChar_ptr(ret_val);
19399 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019400 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019401 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019402 xmlResetLastError();
19403 if (mem_base != xmlMemBlocks()) {
19404 printf("Leak of %d blocks found in xmlGetNoNsProp",
19405 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019406 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019407 printf(" %d", n_node);
19408 printf(" %d", n_name);
19409 printf("\n");
19410 }
19411 }
19412 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019413 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019414
Daniel Veillard42595322004-11-08 10:52:06 +000019415 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019416}
19417
19418
19419static int
19420test_xmlGetNodePath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019421 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019422
William M. Brack21e4ef22005-01-02 09:53:13 +000019423#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_DEBUG_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019424 int mem_base;
19425 xmlChar * ret_val;
19426 xmlNodePtr node; /* a node */
19427 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019428
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019429 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19430 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019431 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019432
19433 ret_val = xmlGetNodePath(node);
19434 desret_xmlChar_ptr(ret_val);
19435 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019436 des_xmlNodePtr(n_node, node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019437 xmlResetLastError();
19438 if (mem_base != xmlMemBlocks()) {
19439 printf("Leak of %d blocks found in xmlGetNodePath",
19440 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019441 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019442 printf(" %d", n_node);
19443 printf("\n");
19444 }
19445 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019446 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019447#endif
19448
Daniel Veillard42595322004-11-08 10:52:06 +000019449 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019450}
19451
19452
19453static int
19454test_xmlGetNsList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019455 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019456
19457
19458 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000019459 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019460}
19461
19462
19463static int
19464test_xmlGetNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019465 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019466
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019467 int mem_base;
19468 xmlChar * ret_val;
19469 xmlNodePtr node; /* the node */
19470 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019471 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019472 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019473 xmlChar * nameSpace; /* the URI of the namespace */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019474 int n_nameSpace;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019475
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019476 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19477 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19478 for (n_nameSpace = 0;n_nameSpace < gen_nb_const_xmlChar_ptr;n_nameSpace++) {
19479 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019480 node = gen_xmlNodePtr(n_node, 0);
19481 name = gen_const_xmlChar_ptr(n_name, 1);
19482 nameSpace = gen_const_xmlChar_ptr(n_nameSpace, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019483
William M. Brackf13f77f2004-11-12 16:03:48 +000019484 ret_val = xmlGetNsProp(node, (const xmlChar *)name, (const xmlChar *)nameSpace);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019485 desret_xmlChar_ptr(ret_val);
19486 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019487 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019488 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
19489 des_const_xmlChar_ptr(n_nameSpace, (const xmlChar *)nameSpace, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019490 xmlResetLastError();
19491 if (mem_base != xmlMemBlocks()) {
19492 printf("Leak of %d blocks found in xmlGetNsProp",
19493 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019494 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019495 printf(" %d", n_node);
19496 printf(" %d", n_name);
19497 printf(" %d", n_nameSpace);
19498 printf("\n");
19499 }
19500 }
19501 }
19502 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019503 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019504
Daniel Veillard42595322004-11-08 10:52:06 +000019505 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019506}
19507
19508
19509static int
19510test_xmlGetProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019511 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019512
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019513 int mem_base;
19514 xmlChar * ret_val;
19515 xmlNodePtr node; /* the node */
19516 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019517 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019518 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019519
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019520 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19521 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19522 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019523 node = gen_xmlNodePtr(n_node, 0);
19524 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019525
William M. Brackf13f77f2004-11-12 16:03:48 +000019526 ret_val = xmlGetProp(node, (const xmlChar *)name);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019527 desret_xmlChar_ptr(ret_val);
19528 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019529 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019530 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019531 xmlResetLastError();
19532 if (mem_base != xmlMemBlocks()) {
19533 printf("Leak of %d blocks found in xmlGetProp",
19534 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019535 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019536 printf(" %d", n_node);
19537 printf(" %d", n_name);
19538 printf("\n");
19539 }
19540 }
19541 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019542 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019543
Daniel Veillard42595322004-11-08 10:52:06 +000019544 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019545}
19546
19547
19548static int
19549test_xmlHasNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019550 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019551
Daniel Veillard57b25162004-11-06 14:50:18 +000019552 int mem_base;
19553 xmlAttrPtr ret_val;
19554 xmlNodePtr node; /* the node */
19555 int n_node;
19556 xmlChar * name; /* the attribute name */
19557 int n_name;
19558 xmlChar * nameSpace; /* the URI of the namespace */
19559 int n_nameSpace;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019560
Daniel Veillard57b25162004-11-06 14:50:18 +000019561 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19562 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19563 for (n_nameSpace = 0;n_nameSpace < gen_nb_const_xmlChar_ptr;n_nameSpace++) {
19564 mem_base = xmlMemBlocks();
19565 node = gen_xmlNodePtr(n_node, 0);
19566 name = gen_const_xmlChar_ptr(n_name, 1);
19567 nameSpace = gen_const_xmlChar_ptr(n_nameSpace, 2);
19568
William M. Brackf13f77f2004-11-12 16:03:48 +000019569 ret_val = xmlHasNsProp(node, (const xmlChar *)name, (const xmlChar *)nameSpace);
Daniel Veillard57b25162004-11-06 14:50:18 +000019570 desret_xmlAttrPtr(ret_val);
19571 call_tests++;
19572 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019573 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
19574 des_const_xmlChar_ptr(n_nameSpace, (const xmlChar *)nameSpace, 2);
Daniel Veillard57b25162004-11-06 14:50:18 +000019575 xmlResetLastError();
19576 if (mem_base != xmlMemBlocks()) {
19577 printf("Leak of %d blocks found in xmlHasNsProp",
19578 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019579 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000019580 printf(" %d", n_node);
19581 printf(" %d", n_name);
19582 printf(" %d", n_nameSpace);
19583 printf("\n");
19584 }
19585 }
19586 }
19587 }
Daniel Veillard57b25162004-11-06 14:50:18 +000019588 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019589
Daniel Veillard42595322004-11-08 10:52:06 +000019590 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019591}
19592
19593
19594static int
19595test_xmlHasProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019596 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019597
Daniel Veillard57b25162004-11-06 14:50:18 +000019598 int mem_base;
19599 xmlAttrPtr ret_val;
19600 xmlNodePtr node; /* the node */
19601 int n_node;
19602 xmlChar * name; /* the attribute name */
19603 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019604
Daniel Veillard57b25162004-11-06 14:50:18 +000019605 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19606 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19607 mem_base = xmlMemBlocks();
19608 node = gen_xmlNodePtr(n_node, 0);
19609 name = gen_const_xmlChar_ptr(n_name, 1);
19610
William M. Brackf13f77f2004-11-12 16:03:48 +000019611 ret_val = xmlHasProp(node, (const xmlChar *)name);
Daniel Veillard57b25162004-11-06 14:50:18 +000019612 desret_xmlAttrPtr(ret_val);
19613 call_tests++;
19614 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019615 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +000019616 xmlResetLastError();
19617 if (mem_base != xmlMemBlocks()) {
19618 printf("Leak of %d blocks found in xmlHasProp",
19619 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019620 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000019621 printf(" %d", n_node);
19622 printf(" %d", n_name);
19623 printf("\n");
19624 }
19625 }
19626 }
Daniel Veillard57b25162004-11-06 14:50:18 +000019627 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019628
Daniel Veillard42595322004-11-08 10:52:06 +000019629 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019630}
19631
19632
19633static int
19634test_xmlIsBlankNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019635 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019636
19637 int mem_base;
19638 int ret_val;
19639 xmlNodePtr node; /* the node */
19640 int n_node;
19641
19642 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19643 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019644 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019645
19646 ret_val = xmlIsBlankNode(node);
19647 desret_int(ret_val);
19648 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019649 des_xmlNodePtr(n_node, node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019650 xmlResetLastError();
19651 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019652 printf("Leak of %d blocks found in xmlIsBlankNode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019653 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019654 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019655 printf(" %d", n_node);
19656 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019657 }
19658 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019659 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019660
Daniel Veillard42595322004-11-08 10:52:06 +000019661 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019662}
19663
19664
19665static int
19666test_xmlIsXHTML(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019667 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019668
19669 int mem_base;
19670 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019671 xmlChar * systemID; /* the system identifier */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019672 int n_systemID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019673 xmlChar * publicID; /* the public identifier */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019674 int n_publicID;
19675
19676 for (n_systemID = 0;n_systemID < gen_nb_const_xmlChar_ptr;n_systemID++) {
19677 for (n_publicID = 0;n_publicID < gen_nb_const_xmlChar_ptr;n_publicID++) {
19678 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019679 systemID = gen_const_xmlChar_ptr(n_systemID, 0);
19680 publicID = gen_const_xmlChar_ptr(n_publicID, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019681
William M. Brackf13f77f2004-11-12 16:03:48 +000019682 ret_val = xmlIsXHTML((const xmlChar *)systemID, (const xmlChar *)publicID);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019683 desret_int(ret_val);
19684 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000019685 des_const_xmlChar_ptr(n_systemID, (const xmlChar *)systemID, 0);
19686 des_const_xmlChar_ptr(n_publicID, (const xmlChar *)publicID, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019687 xmlResetLastError();
19688 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019689 printf("Leak of %d blocks found in xmlIsXHTML",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019690 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019691 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019692 printf(" %d", n_systemID);
19693 printf(" %d", n_publicID);
19694 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019695 }
19696 }
19697 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019698 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019699
Daniel Veillard42595322004-11-08 10:52:06 +000019700 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019701}
19702
19703
19704static int
19705test_xmlNewCDataBlock(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019706 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019707
19708 int mem_base;
19709 xmlNodePtr ret_val;
19710 xmlDocPtr doc; /* the document */
19711 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019712 xmlChar * content; /* the CDATA block content content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019713 int n_content;
19714 int len; /* the length of the block */
19715 int n_len;
19716
19717 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19718 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
19719 for (n_len = 0;n_len < gen_nb_int;n_len++) {
19720 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019721 doc = gen_xmlDocPtr(n_doc, 0);
19722 content = gen_const_xmlChar_ptr(n_content, 1);
19723 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019724
William M. Brackf13f77f2004-11-12 16:03:48 +000019725 ret_val = xmlNewCDataBlock(doc, (const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019726 desret_xmlNodePtr(ret_val);
19727 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019728 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019729 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000019730 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019731 xmlResetLastError();
19732 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019733 printf("Leak of %d blocks found in xmlNewCDataBlock",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019734 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019735 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019736 printf(" %d", n_doc);
19737 printf(" %d", n_content);
19738 printf(" %d", n_len);
19739 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019740 }
19741 }
19742 }
19743 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019744 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019745
Daniel Veillard42595322004-11-08 10:52:06 +000019746 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019747}
19748
19749
19750static int
19751test_xmlNewCharRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019752 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019753
19754 int mem_base;
19755 xmlNodePtr ret_val;
19756 xmlDocPtr doc; /* the document */
19757 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019758 xmlChar * name; /* the char ref string, starting with # or "&# ... ;" */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019759 int n_name;
19760
19761 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19762 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19763 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019764 doc = gen_xmlDocPtr(n_doc, 0);
19765 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019766
William M. Brackf13f77f2004-11-12 16:03:48 +000019767 ret_val = xmlNewCharRef(doc, (const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019768 desret_xmlNodePtr(ret_val);
19769 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019770 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019771 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019772 xmlResetLastError();
19773 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019774 printf("Leak of %d blocks found in xmlNewCharRef",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019775 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019776 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019777 printf(" %d", n_doc);
19778 printf(" %d", n_name);
19779 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019780 }
19781 }
19782 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019783 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019784
Daniel Veillard42595322004-11-08 10:52:06 +000019785 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019786}
19787
19788
19789static int
19790test_xmlNewChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019791 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019792
William M. Brack21e4ef22005-01-02 09:53:13 +000019793#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000019794#ifdef LIBXML_TREE_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +000019795 int mem_base;
19796 xmlNodePtr ret_val;
19797 xmlNodePtr parent; /* the parent node */
19798 int n_parent;
19799 xmlNsPtr ns; /* a namespace if any */
19800 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019801 xmlChar * name; /* the name of the child */
Daniel Veillard27f20102004-11-05 11:50:11 +000019802 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019803 xmlChar * content; /* the XML content of the child if any. */
Daniel Veillard27f20102004-11-05 11:50:11 +000019804 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019805
Daniel Veillard27f20102004-11-05 11:50:11 +000019806 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
19807 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
19808 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19809 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
19810 mem_base = xmlMemBlocks();
19811 parent = gen_xmlNodePtr(n_parent, 0);
19812 ns = gen_xmlNsPtr(n_ns, 1);
19813 name = gen_const_xmlChar_ptr(n_name, 2);
19814 content = gen_const_xmlChar_ptr(n_content, 3);
19815
William M. Brackf13f77f2004-11-12 16:03:48 +000019816 ret_val = xmlNewChild(parent, ns, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillard27f20102004-11-05 11:50:11 +000019817 desret_xmlNodePtr(ret_val);
19818 call_tests++;
19819 des_xmlNodePtr(n_parent, parent, 0);
19820 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000019821 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
19822 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000019823 xmlResetLastError();
19824 if (mem_base != xmlMemBlocks()) {
19825 printf("Leak of %d blocks found in xmlNewChild",
19826 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019827 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000019828 printf(" %d", n_parent);
19829 printf(" %d", n_ns);
19830 printf(" %d", n_name);
19831 printf(" %d", n_content);
19832 printf("\n");
19833 }
19834 }
19835 }
19836 }
19837 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019838 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000019839#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000019840#endif
Daniel Veillard27f20102004-11-05 11:50:11 +000019841
Daniel Veillard42595322004-11-08 10:52:06 +000019842 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019843}
19844
19845
19846static int
19847test_xmlNewComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019848 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019849
19850 int mem_base;
19851 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019852 xmlChar * content; /* the comment content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019853 int n_content;
19854
19855 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
19856 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019857 content = gen_const_xmlChar_ptr(n_content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019858
William M. Brackf13f77f2004-11-12 16:03:48 +000019859 ret_val = xmlNewComment((const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019860 desret_xmlNodePtr(ret_val);
19861 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000019862 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019863 xmlResetLastError();
19864 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019865 printf("Leak of %d blocks found in xmlNewComment",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019866 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019867 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019868 printf(" %d", n_content);
19869 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019870 }
19871 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019872 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019873
Daniel Veillard42595322004-11-08 10:52:06 +000019874 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019875}
19876
19877
19878static int
19879test_xmlNewDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019880 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019881
19882 int mem_base;
19883 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019884 xmlChar * version; /* xmlChar string giving the version of XML "1.0" */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019885 int n_version;
19886
19887 for (n_version = 0;n_version < gen_nb_const_xmlChar_ptr;n_version++) {
19888 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019889 version = gen_const_xmlChar_ptr(n_version, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019890
William M. Brackf13f77f2004-11-12 16:03:48 +000019891 ret_val = xmlNewDoc((const xmlChar *)version);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019892 desret_xmlDocPtr(ret_val);
19893 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000019894 des_const_xmlChar_ptr(n_version, (const xmlChar *)version, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019895 xmlResetLastError();
19896 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019897 printf("Leak of %d blocks found in xmlNewDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019898 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019899 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019900 printf(" %d", n_version);
19901 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019902 }
19903 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019904 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019905
Daniel Veillard42595322004-11-08 10:52:06 +000019906 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019907}
19908
19909
19910static int
19911test_xmlNewDocComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019912 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019913
19914 int mem_base;
19915 xmlNodePtr ret_val;
19916 xmlDocPtr doc; /* the document */
19917 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019918 xmlChar * content; /* the comment content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019919 int n_content;
19920
19921 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19922 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
19923 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019924 doc = gen_xmlDocPtr(n_doc, 0);
19925 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019926
William M. Brackf13f77f2004-11-12 16:03:48 +000019927 ret_val = xmlNewDocComment(doc, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019928 desret_xmlNodePtr(ret_val);
19929 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019930 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019931 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019932 xmlResetLastError();
19933 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019934 printf("Leak of %d blocks found in xmlNewDocComment",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019935 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019936 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019937 printf(" %d", n_doc);
19938 printf(" %d", n_content);
19939 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019940 }
19941 }
19942 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019943 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019944
Daniel Veillard42595322004-11-08 10:52:06 +000019945 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019946}
19947
19948
19949static int
19950test_xmlNewDocFragment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019951 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019952
William M. Brack21e4ef22005-01-02 09:53:13 +000019953#if defined(LIBXML_TREE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000019954 int mem_base;
19955 xmlNodePtr ret_val;
19956 xmlDocPtr doc; /* the document owning the fragment */
19957 int n_doc;
19958
19959 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19960 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019961 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019962
19963 ret_val = xmlNewDocFragment(doc);
19964 desret_xmlNodePtr(ret_val);
19965 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019966 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019967 xmlResetLastError();
19968 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019969 printf("Leak of %d blocks found in xmlNewDocFragment",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019970 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019971 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019972 printf(" %d", n_doc);
19973 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019974 }
19975 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019976 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019977#endif
19978
Daniel Veillard42595322004-11-08 10:52:06 +000019979 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019980}
19981
19982
19983static int
19984test_xmlNewDocNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019985 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019986
Daniel Veillard27f20102004-11-05 11:50:11 +000019987 int mem_base;
19988 xmlNodePtr ret_val;
19989 xmlDocPtr doc; /* the document */
19990 int n_doc;
19991 xmlNsPtr ns; /* namespace if any */
19992 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019993 xmlChar * name; /* the node name */
Daniel Veillard27f20102004-11-05 11:50:11 +000019994 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019995 xmlChar * content; /* the XML text content if any */
Daniel Veillard27f20102004-11-05 11:50:11 +000019996 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019997
Daniel Veillard27f20102004-11-05 11:50:11 +000019998 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19999 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20000 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20001 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20002 mem_base = xmlMemBlocks();
20003 doc = gen_xmlDocPtr(n_doc, 0);
20004 ns = gen_xmlNsPtr(n_ns, 1);
20005 name = gen_const_xmlChar_ptr(n_name, 2);
20006 content = gen_const_xmlChar_ptr(n_content, 3);
20007
William M. Brackf13f77f2004-11-12 16:03:48 +000020008 ret_val = xmlNewDocNode(doc, ns, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillard27f20102004-11-05 11:50:11 +000020009 desret_xmlNodePtr(ret_val);
20010 call_tests++;
20011 des_xmlDocPtr(n_doc, doc, 0);
20012 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000020013 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
20014 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000020015 xmlResetLastError();
20016 if (mem_base != xmlMemBlocks()) {
20017 printf("Leak of %d blocks found in xmlNewDocNode",
20018 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020019 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020020 printf(" %d", n_doc);
20021 printf(" %d", n_ns);
20022 printf(" %d", n_name);
20023 printf(" %d", n_content);
20024 printf("\n");
20025 }
20026 }
20027 }
20028 }
20029 }
Daniel Veillard27f20102004-11-05 11:50:11 +000020030 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020031
Daniel Veillard42595322004-11-08 10:52:06 +000020032 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020033}
20034
20035
20036static int
20037test_xmlNewDocNodeEatName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020038 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020039
Daniel Veillard27f20102004-11-05 11:50:11 +000020040 int mem_base;
20041 xmlNodePtr ret_val;
20042 xmlDocPtr doc; /* the document */
20043 int n_doc;
20044 xmlNsPtr ns; /* namespace if any */
20045 int n_ns;
20046 xmlChar * name; /* the node name */
20047 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020048 xmlChar * content; /* the XML text content if any */
Daniel Veillard27f20102004-11-05 11:50:11 +000020049 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020050
Daniel Veillard27f20102004-11-05 11:50:11 +000020051 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20052 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20053 for (n_name = 0;n_name < gen_nb_eaten_name;n_name++) {
20054 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20055 mem_base = xmlMemBlocks();
20056 doc = gen_xmlDocPtr(n_doc, 0);
20057 ns = gen_xmlNsPtr(n_ns, 1);
20058 name = gen_eaten_name(n_name, 2);
20059 content = gen_const_xmlChar_ptr(n_content, 3);
20060
William M. Brackf13f77f2004-11-12 16:03:48 +000020061 ret_val = xmlNewDocNodeEatName(doc, ns, name, (const xmlChar *)content);
Daniel Veillard27f20102004-11-05 11:50:11 +000020062 desret_xmlNodePtr(ret_val);
20063 call_tests++;
20064 des_xmlDocPtr(n_doc, doc, 0);
20065 des_xmlNsPtr(n_ns, ns, 1);
20066 des_eaten_name(n_name, name, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000020067 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000020068 xmlResetLastError();
20069 if (mem_base != xmlMemBlocks()) {
20070 printf("Leak of %d blocks found in xmlNewDocNodeEatName",
20071 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020072 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020073 printf(" %d", n_doc);
20074 printf(" %d", n_ns);
20075 printf(" %d", n_name);
20076 printf(" %d", n_content);
20077 printf("\n");
20078 }
20079 }
20080 }
20081 }
20082 }
Daniel Veillard27f20102004-11-05 11:50:11 +000020083 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020084
Daniel Veillard42595322004-11-08 10:52:06 +000020085 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020086}
20087
20088
20089static int
20090test_xmlNewDocPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020091 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020092
20093 int mem_base;
20094 xmlNodePtr ret_val;
20095 xmlDocPtr doc; /* the target document */
20096 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020097 xmlChar * name; /* the processing instruction name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020098 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020099 xmlChar * content; /* the PI content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020100 int n_content;
20101
20102 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20103 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20104 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20105 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020106 doc = gen_xmlDocPtr(n_doc, 0);
20107 name = gen_const_xmlChar_ptr(n_name, 1);
20108 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020109
William M. Brackf13f77f2004-11-12 16:03:48 +000020110 ret_val = xmlNewDocPI(doc, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020111 desret_xmlNodePtr(ret_val);
20112 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020113 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020114 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
20115 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020116 xmlResetLastError();
20117 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020118 printf("Leak of %d blocks found in xmlNewDocPI",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020119 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020120 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020121 printf(" %d", n_doc);
20122 printf(" %d", n_name);
20123 printf(" %d", n_content);
20124 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020125 }
20126 }
20127 }
20128 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020129 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020130
Daniel Veillard42595322004-11-08 10:52:06 +000020131 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020132}
20133
20134
20135static int
20136test_xmlNewDocProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020137 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020138
Daniel Veillard57b25162004-11-06 14:50:18 +000020139 int mem_base;
20140 xmlAttrPtr ret_val;
20141 xmlDocPtr doc; /* the document */
20142 int n_doc;
20143 xmlChar * name; /* the name of the attribute */
20144 int n_name;
20145 xmlChar * value; /* the value of the attribute */
20146 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020147
Daniel Veillard57b25162004-11-06 14:50:18 +000020148 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20149 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20150 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20151 mem_base = xmlMemBlocks();
20152 doc = gen_xmlDocPtr(n_doc, 0);
20153 name = gen_const_xmlChar_ptr(n_name, 1);
20154 value = gen_const_xmlChar_ptr(n_value, 2);
20155
William M. Brackf13f77f2004-11-12 16:03:48 +000020156 ret_val = xmlNewDocProp(doc, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000020157 desret_xmlAttrPtr(ret_val);
20158 call_tests++;
20159 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020160 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
20161 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
Daniel Veillard57b25162004-11-06 14:50:18 +000020162 xmlResetLastError();
20163 if (mem_base != xmlMemBlocks()) {
20164 printf("Leak of %d blocks found in xmlNewDocProp",
20165 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020166 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000020167 printf(" %d", n_doc);
20168 printf(" %d", n_name);
20169 printf(" %d", n_value);
20170 printf("\n");
20171 }
20172 }
20173 }
20174 }
Daniel Veillard57b25162004-11-06 14:50:18 +000020175 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020176
Daniel Veillard42595322004-11-08 10:52:06 +000020177 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020178}
20179
20180
20181static int
20182test_xmlNewDocRawNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020183 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020184
William M. Brack21e4ef22005-01-02 09:53:13 +000020185#if defined(LIBXML_TREE_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000020186#ifdef LIBXML_TREE_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +000020187 int mem_base;
20188 xmlNodePtr ret_val;
20189 xmlDocPtr doc; /* the document */
20190 int n_doc;
20191 xmlNsPtr ns; /* namespace if any */
20192 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020193 xmlChar * name; /* the node name */
Daniel Veillard27f20102004-11-05 11:50:11 +000020194 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020195 xmlChar * content; /* the text content if any */
Daniel Veillard27f20102004-11-05 11:50:11 +000020196 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020197
Daniel Veillard27f20102004-11-05 11:50:11 +000020198 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20199 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20200 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20201 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20202 mem_base = xmlMemBlocks();
20203 doc = gen_xmlDocPtr(n_doc, 0);
20204 ns = gen_xmlNsPtr(n_ns, 1);
20205 name = gen_const_xmlChar_ptr(n_name, 2);
20206 content = gen_const_xmlChar_ptr(n_content, 3);
20207
William M. Brackf13f77f2004-11-12 16:03:48 +000020208 ret_val = xmlNewDocRawNode(doc, ns, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillard27f20102004-11-05 11:50:11 +000020209 desret_xmlNodePtr(ret_val);
20210 call_tests++;
20211 des_xmlDocPtr(n_doc, doc, 0);
20212 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000020213 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
20214 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000020215 xmlResetLastError();
20216 if (mem_base != xmlMemBlocks()) {
20217 printf("Leak of %d blocks found in xmlNewDocRawNode",
20218 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020219 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020220 printf(" %d", n_doc);
20221 printf(" %d", n_ns);
20222 printf(" %d", n_name);
20223 printf(" %d", n_content);
20224 printf("\n");
20225 }
20226 }
20227 }
20228 }
20229 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020230 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000020231#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000020232#endif
Daniel Veillard27f20102004-11-05 11:50:11 +000020233
Daniel Veillard42595322004-11-08 10:52:06 +000020234 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020235}
20236
20237
20238static int
20239test_xmlNewDocText(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020240 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020241
20242 int mem_base;
20243 xmlNodePtr ret_val;
20244 xmlDocPtr doc; /* the document */
20245 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020246 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020247 int n_content;
20248
20249 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20250 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20251 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020252 doc = gen_xmlDocPtr(n_doc, 0);
20253 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020254
William M. Brackf13f77f2004-11-12 16:03:48 +000020255 ret_val = xmlNewDocText(doc, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020256 desret_xmlNodePtr(ret_val);
20257 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020258 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020259 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020260 xmlResetLastError();
20261 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020262 printf("Leak of %d blocks found in xmlNewDocText",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020263 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020264 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020265 printf(" %d", n_doc);
20266 printf(" %d", n_content);
20267 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020268 }
20269 }
20270 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020271 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020272
Daniel Veillard42595322004-11-08 10:52:06 +000020273 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020274}
20275
20276
20277static int
20278test_xmlNewDocTextLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020279 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020280
20281 int mem_base;
20282 xmlNodePtr ret_val;
20283 xmlDocPtr doc; /* the document */
20284 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020285 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020286 int n_content;
20287 int len; /* the text len. */
20288 int n_len;
20289
20290 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20291 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20292 for (n_len = 0;n_len < gen_nb_int;n_len++) {
20293 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020294 doc = gen_xmlDocPtr(n_doc, 0);
20295 content = gen_const_xmlChar_ptr(n_content, 1);
20296 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020297
William M. Brackf13f77f2004-11-12 16:03:48 +000020298 ret_val = xmlNewDocTextLen(doc, (const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020299 desret_xmlNodePtr(ret_val);
20300 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020301 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020302 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000020303 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020304 xmlResetLastError();
20305 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020306 printf("Leak of %d blocks found in xmlNewDocTextLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020307 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020308 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020309 printf(" %d", n_doc);
20310 printf(" %d", n_content);
20311 printf(" %d", n_len);
20312 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020313 }
20314 }
20315 }
20316 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020317 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020318
Daniel Veillard42595322004-11-08 10:52:06 +000020319 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020320}
20321
20322
20323static int
20324test_xmlNewDtd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020325 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020326
Daniel Veillard34099b42004-11-04 17:34:35 +000020327 int mem_base;
20328 xmlDtdPtr ret_val;
20329 xmlDocPtr doc; /* the document pointer */
20330 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020331 xmlChar * name; /* the DTD name */
Daniel Veillard34099b42004-11-04 17:34:35 +000020332 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020333 xmlChar * ExternalID; /* the external ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000020334 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020335 xmlChar * SystemID; /* the system ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000020336 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020337
Daniel Veillard34099b42004-11-04 17:34:35 +000020338 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20339 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20340 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
20341 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
20342 mem_base = xmlMemBlocks();
20343 doc = gen_xmlDocPtr(n_doc, 0);
20344 name = gen_const_xmlChar_ptr(n_name, 1);
20345 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
20346 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
20347
William M. Brackf13f77f2004-11-12 16:03:48 +000020348 ret_val = xmlNewDtd(doc, (const xmlChar *)name, (const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard34099b42004-11-04 17:34:35 +000020349 desret_xmlDtdPtr(ret_val);
20350 call_tests++;
20351 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020352 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
20353 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 2);
20354 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 3);
Daniel Veillard34099b42004-11-04 17:34:35 +000020355 xmlResetLastError();
20356 if (mem_base != xmlMemBlocks()) {
20357 printf("Leak of %d blocks found in xmlNewDtd",
20358 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020359 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000020360 printf(" %d", n_doc);
20361 printf(" %d", n_name);
20362 printf(" %d", n_ExternalID);
20363 printf(" %d", n_SystemID);
20364 printf("\n");
20365 }
20366 }
20367 }
20368 }
20369 }
Daniel Veillard34099b42004-11-04 17:34:35 +000020370 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020371
Daniel Veillard42595322004-11-08 10:52:06 +000020372 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020373}
20374
20375
20376static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000020377test_xmlNewNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020378 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020379
Daniel Veillard27f20102004-11-05 11:50:11 +000020380 int mem_base;
20381 xmlNodePtr ret_val;
20382 xmlNsPtr ns; /* namespace if any */
20383 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020384 xmlChar * name; /* the node name */
Daniel Veillard27f20102004-11-05 11:50:11 +000020385 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020386
Daniel Veillard27f20102004-11-05 11:50:11 +000020387 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20388 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20389 mem_base = xmlMemBlocks();
20390 ns = gen_xmlNsPtr(n_ns, 0);
20391 name = gen_const_xmlChar_ptr(n_name, 1);
20392
William M. Brackf13f77f2004-11-12 16:03:48 +000020393 ret_val = xmlNewNode(ns, (const xmlChar *)name);
Daniel Veillard27f20102004-11-05 11:50:11 +000020394 desret_xmlNodePtr(ret_val);
20395 call_tests++;
20396 des_xmlNsPtr(n_ns, ns, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020397 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard27f20102004-11-05 11:50:11 +000020398 xmlResetLastError();
20399 if (mem_base != xmlMemBlocks()) {
20400 printf("Leak of %d blocks found in xmlNewNode",
20401 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020402 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020403 printf(" %d", n_ns);
20404 printf(" %d", n_name);
20405 printf("\n");
20406 }
20407 }
20408 }
Daniel Veillard27f20102004-11-05 11:50:11 +000020409 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020410
Daniel Veillard42595322004-11-08 10:52:06 +000020411 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020412}
20413
20414
20415static int
20416test_xmlNewNodeEatName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020417 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020418
Daniel Veillard27f20102004-11-05 11:50:11 +000020419 int mem_base;
20420 xmlNodePtr ret_val;
20421 xmlNsPtr ns; /* namespace if any */
20422 int n_ns;
20423 xmlChar * name; /* the node name */
20424 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020425
Daniel Veillard27f20102004-11-05 11:50:11 +000020426 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20427 for (n_name = 0;n_name < gen_nb_eaten_name;n_name++) {
20428 mem_base = xmlMemBlocks();
20429 ns = gen_xmlNsPtr(n_ns, 0);
20430 name = gen_eaten_name(n_name, 1);
20431
20432 ret_val = xmlNewNodeEatName(ns, name);
20433 desret_xmlNodePtr(ret_val);
20434 call_tests++;
20435 des_xmlNsPtr(n_ns, ns, 0);
20436 des_eaten_name(n_name, name, 1);
20437 xmlResetLastError();
20438 if (mem_base != xmlMemBlocks()) {
20439 printf("Leak of %d blocks found in xmlNewNodeEatName",
20440 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020441 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020442 printf(" %d", n_ns);
20443 printf(" %d", n_name);
20444 printf("\n");
20445 }
20446 }
20447 }
Daniel Veillard27f20102004-11-05 11:50:11 +000020448 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020449
Daniel Veillard42595322004-11-08 10:52:06 +000020450 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020451}
20452
20453
20454static int
20455test_xmlNewNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020456 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020457
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020458 int mem_base;
20459 xmlNsPtr ret_val;
20460 xmlNodePtr node; /* the element carrying the namespace */
20461 int n_node;
20462 xmlChar * href; /* the URI associated */
20463 int n_href;
20464 xmlChar * prefix; /* the prefix for the namespace */
20465 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020466
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020467 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
20468 for (n_href = 0;n_href < gen_nb_const_xmlChar_ptr;n_href++) {
20469 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
20470 mem_base = xmlMemBlocks();
20471 node = gen_xmlNodePtr(n_node, 0);
20472 href = gen_const_xmlChar_ptr(n_href, 1);
20473 prefix = gen_const_xmlChar_ptr(n_prefix, 2);
20474
William M. Brackf13f77f2004-11-12 16:03:48 +000020475 ret_val = xmlNewNs(node, (const xmlChar *)href, (const xmlChar *)prefix);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020476 if ((node == NULL) && (ret_val != NULL)) xmlFreeNs(ret_val);
20477 desret_xmlNsPtr(ret_val);
20478 call_tests++;
20479 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020480 des_const_xmlChar_ptr(n_href, (const xmlChar *)href, 1);
20481 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020482 xmlResetLastError();
20483 if (mem_base != xmlMemBlocks()) {
20484 printf("Leak of %d blocks found in xmlNewNs",
20485 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020486 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020487 printf(" %d", n_node);
20488 printf(" %d", n_href);
20489 printf(" %d", n_prefix);
20490 printf("\n");
20491 }
20492 }
20493 }
20494 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020495 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020496
Daniel Veillard42595322004-11-08 10:52:06 +000020497 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020498}
20499
20500
20501static int
20502test_xmlNewNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020503 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020504
Daniel Veillard57b25162004-11-06 14:50:18 +000020505 int mem_base;
20506 xmlAttrPtr ret_val;
20507 xmlNodePtr node; /* the holding node */
20508 int n_node;
20509 xmlNsPtr ns; /* the namespace */
20510 int n_ns;
20511 xmlChar * name; /* the name of the attribute */
20512 int n_name;
20513 xmlChar * value; /* the value of the attribute */
20514 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020515
Daniel Veillard57b25162004-11-06 14:50:18 +000020516 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
20517 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20518 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20519 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20520 mem_base = xmlMemBlocks();
20521 node = gen_xmlNodePtr(n_node, 0);
20522 ns = gen_xmlNsPtr(n_ns, 1);
20523 name = gen_const_xmlChar_ptr(n_name, 2);
20524 value = gen_const_xmlChar_ptr(n_value, 3);
20525
William M. Brackf13f77f2004-11-12 16:03:48 +000020526 ret_val = xmlNewNsProp(node, ns, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000020527 desret_xmlAttrPtr(ret_val);
20528 call_tests++;
20529 des_xmlNodePtr(n_node, node, 0);
20530 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000020531 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
20532 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000020533 xmlResetLastError();
20534 if (mem_base != xmlMemBlocks()) {
20535 printf("Leak of %d blocks found in xmlNewNsProp",
20536 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020537 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000020538 printf(" %d", n_node);
20539 printf(" %d", n_ns);
20540 printf(" %d", n_name);
20541 printf(" %d", n_value);
20542 printf("\n");
20543 }
20544 }
20545 }
20546 }
20547 }
Daniel Veillard57b25162004-11-06 14:50:18 +000020548 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020549
Daniel Veillard42595322004-11-08 10:52:06 +000020550 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020551}
20552
20553
20554static int
20555test_xmlNewNsPropEatName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020556 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020557
Daniel Veillard57b25162004-11-06 14:50:18 +000020558 int mem_base;
20559 xmlAttrPtr ret_val;
20560 xmlNodePtr node; /* the holding node */
20561 int n_node;
20562 xmlNsPtr ns; /* the namespace */
20563 int n_ns;
20564 xmlChar * name; /* the name of the attribute */
20565 int n_name;
20566 xmlChar * value; /* the value of the attribute */
20567 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020568
Daniel Veillard57b25162004-11-06 14:50:18 +000020569 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
20570 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20571 for (n_name = 0;n_name < gen_nb_eaten_name;n_name++) {
20572 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20573 mem_base = xmlMemBlocks();
20574 node = gen_xmlNodePtr(n_node, 0);
20575 ns = gen_xmlNsPtr(n_ns, 1);
20576 name = gen_eaten_name(n_name, 2);
20577 value = gen_const_xmlChar_ptr(n_value, 3);
20578
William M. Brackf13f77f2004-11-12 16:03:48 +000020579 ret_val = xmlNewNsPropEatName(node, ns, name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000020580 desret_xmlAttrPtr(ret_val);
20581 call_tests++;
20582 des_xmlNodePtr(n_node, node, 0);
20583 des_xmlNsPtr(n_ns, ns, 1);
20584 des_eaten_name(n_name, name, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000020585 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000020586 xmlResetLastError();
20587 if (mem_base != xmlMemBlocks()) {
20588 printf("Leak of %d blocks found in xmlNewNsPropEatName",
20589 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020590 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000020591 printf(" %d", n_node);
20592 printf(" %d", n_ns);
20593 printf(" %d", n_name);
20594 printf(" %d", n_value);
20595 printf("\n");
20596 }
20597 }
20598 }
20599 }
20600 }
Daniel Veillard57b25162004-11-06 14:50:18 +000020601 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020602
Daniel Veillard42595322004-11-08 10:52:06 +000020603 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020604}
20605
20606
20607static int
20608test_xmlNewPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020609 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020610
20611 int mem_base;
20612 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020613 xmlChar * name; /* the processing instruction name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020614 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020615 xmlChar * content; /* the PI content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020616 int n_content;
20617
20618 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20619 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20620 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020621 name = gen_const_xmlChar_ptr(n_name, 0);
20622 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020623
William M. Brackf13f77f2004-11-12 16:03:48 +000020624 ret_val = xmlNewPI((const xmlChar *)name, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020625 desret_xmlNodePtr(ret_val);
20626 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000020627 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
20628 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020629 xmlResetLastError();
20630 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020631 printf("Leak of %d blocks found in xmlNewPI",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020632 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020633 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020634 printf(" %d", n_name);
20635 printf(" %d", n_content);
20636 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020637 }
20638 }
20639 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020640 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020641
Daniel Veillard42595322004-11-08 10:52:06 +000020642 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020643}
20644
20645
20646static int
20647test_xmlNewProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020648 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020649
William M. Brack21e4ef22005-01-02 09:53:13 +000020650#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000020651#ifdef LIBXML_TREE_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +000020652 int mem_base;
20653 xmlAttrPtr ret_val;
20654 xmlNodePtr node; /* the holding node */
20655 int n_node;
20656 xmlChar * name; /* the name of the attribute */
20657 int n_name;
20658 xmlChar * value; /* the value of the attribute */
20659 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020660
Daniel Veillard57b25162004-11-06 14:50:18 +000020661 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
20662 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20663 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20664 mem_base = xmlMemBlocks();
20665 node = gen_xmlNodePtr(n_node, 0);
20666 name = gen_const_xmlChar_ptr(n_name, 1);
20667 value = gen_const_xmlChar_ptr(n_value, 2);
20668
William M. Brackf13f77f2004-11-12 16:03:48 +000020669 ret_val = xmlNewProp(node, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000020670 desret_xmlAttrPtr(ret_val);
20671 call_tests++;
20672 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020673 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
20674 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
Daniel Veillard57b25162004-11-06 14:50:18 +000020675 xmlResetLastError();
20676 if (mem_base != xmlMemBlocks()) {
20677 printf("Leak of %d blocks found in xmlNewProp",
20678 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020679 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000020680 printf(" %d", n_node);
20681 printf(" %d", n_name);
20682 printf(" %d", n_value);
20683 printf("\n");
20684 }
20685 }
20686 }
20687 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020688 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000020689#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000020690#endif
Daniel Veillard57b25162004-11-06 14:50:18 +000020691
Daniel Veillard42595322004-11-08 10:52:06 +000020692 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020693}
20694
20695
20696static int
20697test_xmlNewReference(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020698 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020699
20700 int mem_base;
20701 xmlNodePtr ret_val;
20702 xmlDocPtr doc; /* the document */
20703 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020704 xmlChar * name; /* the reference name, or the reference string with & and ; */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020705 int n_name;
20706
20707 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20708 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20709 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020710 doc = gen_xmlDocPtr(n_doc, 0);
20711 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020712
William M. Brackf13f77f2004-11-12 16:03:48 +000020713 ret_val = xmlNewReference(doc, (const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020714 desret_xmlNodePtr(ret_val);
20715 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020716 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020717 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020718 xmlResetLastError();
20719 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020720 printf("Leak of %d blocks found in xmlNewReference",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020721 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020722 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020723 printf(" %d", n_doc);
20724 printf(" %d", n_name);
20725 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020726 }
20727 }
20728 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020729 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020730
Daniel Veillard42595322004-11-08 10:52:06 +000020731 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020732}
20733
20734
20735static int
20736test_xmlNewText(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020737 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020738
20739 int mem_base;
20740 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020741 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020742 int n_content;
20743
20744 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20745 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020746 content = gen_const_xmlChar_ptr(n_content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020747
William M. Brackf13f77f2004-11-12 16:03:48 +000020748 ret_val = xmlNewText((const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020749 desret_xmlNodePtr(ret_val);
20750 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000020751 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020752 xmlResetLastError();
20753 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020754 printf("Leak of %d blocks found in xmlNewText",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020755 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020756 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020757 printf(" %d", n_content);
20758 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020759 }
20760 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020761 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020762
Daniel Veillard42595322004-11-08 10:52:06 +000020763 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020764}
20765
20766
20767static int
20768test_xmlNewTextChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020769 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020770
William M. Brack21e4ef22005-01-02 09:53:13 +000020771#if defined(LIBXML_TREE_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000020772#ifdef LIBXML_TREE_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +000020773 int mem_base;
20774 xmlNodePtr ret_val;
20775 xmlNodePtr parent; /* the parent node */
20776 int n_parent;
20777 xmlNsPtr ns; /* a namespace if any */
20778 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020779 xmlChar * name; /* the name of the child */
Daniel Veillard27f20102004-11-05 11:50:11 +000020780 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020781 xmlChar * content; /* the text content of the child if any. */
Daniel Veillard27f20102004-11-05 11:50:11 +000020782 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020783
Daniel Veillard27f20102004-11-05 11:50:11 +000020784 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
20785 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20786 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20787 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20788 mem_base = xmlMemBlocks();
20789 parent = gen_xmlNodePtr(n_parent, 0);
20790 ns = gen_xmlNsPtr(n_ns, 1);
20791 name = gen_const_xmlChar_ptr(n_name, 2);
20792 content = gen_const_xmlChar_ptr(n_content, 3);
20793
William M. Brackf13f77f2004-11-12 16:03:48 +000020794 ret_val = xmlNewTextChild(parent, ns, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillard27f20102004-11-05 11:50:11 +000020795 desret_xmlNodePtr(ret_val);
20796 call_tests++;
20797 des_xmlNodePtr(n_parent, parent, 0);
20798 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000020799 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
20800 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000020801 xmlResetLastError();
20802 if (mem_base != xmlMemBlocks()) {
20803 printf("Leak of %d blocks found in xmlNewTextChild",
20804 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020805 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020806 printf(" %d", n_parent);
20807 printf(" %d", n_ns);
20808 printf(" %d", n_name);
20809 printf(" %d", n_content);
20810 printf("\n");
20811 }
20812 }
20813 }
20814 }
20815 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020816 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000020817#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000020818#endif
Daniel Veillard27f20102004-11-05 11:50:11 +000020819
Daniel Veillard42595322004-11-08 10:52:06 +000020820 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020821}
20822
20823
20824static int
20825test_xmlNewTextLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020826 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020827
20828 int mem_base;
20829 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020830 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020831 int n_content;
20832 int len; /* the text len. */
20833 int n_len;
20834
20835 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20836 for (n_len = 0;n_len < gen_nb_int;n_len++) {
20837 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020838 content = gen_const_xmlChar_ptr(n_content, 0);
20839 len = gen_int(n_len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020840
William M. Brackf13f77f2004-11-12 16:03:48 +000020841 ret_val = xmlNewTextLen((const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020842 desret_xmlNodePtr(ret_val);
20843 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000020844 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000020845 des_int(n_len, len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020846 xmlResetLastError();
20847 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020848 printf("Leak of %d blocks found in xmlNewTextLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020849 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020850 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020851 printf(" %d", n_content);
20852 printf(" %d", n_len);
20853 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020854 }
20855 }
20856 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020857 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020858
Daniel Veillard42595322004-11-08 10:52:06 +000020859 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020860}
20861
20862
20863static int
20864test_xmlNodeAddContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020865 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020866
20867 int mem_base;
20868 xmlNodePtr cur; /* the node being modified */
20869 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020870 xmlChar * content; /* extra content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020871 int n_content;
20872
20873 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
20874 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20875 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020876 cur = gen_xmlNodePtr(n_cur, 0);
20877 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020878
William M. Brackf13f77f2004-11-12 16:03:48 +000020879 xmlNodeAddContent(cur, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020880 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020881 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020882 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020883 xmlResetLastError();
20884 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020885 printf("Leak of %d blocks found in xmlNodeAddContent",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020886 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020887 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020888 printf(" %d", n_cur);
20889 printf(" %d", n_content);
20890 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020891 }
20892 }
20893 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020894 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020895
Daniel Veillard42595322004-11-08 10:52:06 +000020896 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020897}
20898
20899
20900static int
20901test_xmlNodeAddContentLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020902 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020903
20904 int mem_base;
20905 xmlNodePtr cur; /* the node being modified */
20906 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020907 xmlChar * content; /* extra content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020908 int n_content;
20909 int len; /* the size of @content */
20910 int n_len;
20911
20912 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
20913 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20914 for (n_len = 0;n_len < gen_nb_int;n_len++) {
20915 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020916 cur = gen_xmlNodePtr(n_cur, 0);
20917 content = gen_const_xmlChar_ptr(n_content, 1);
20918 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020919
William M. Brackf13f77f2004-11-12 16:03:48 +000020920 xmlNodeAddContentLen(cur, (const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020921 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020922 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020923 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000020924 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020925 xmlResetLastError();
20926 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020927 printf("Leak of %d blocks found in xmlNodeAddContentLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020928 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020929 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020930 printf(" %d", n_cur);
20931 printf(" %d", n_content);
20932 printf(" %d", n_len);
20933 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020934 }
20935 }
20936 }
20937 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020938 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020939
Daniel Veillard42595322004-11-08 10:52:06 +000020940 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020941}
20942
20943
20944static int
20945test_xmlNodeBufGetContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020946 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020947
Daniel Veillardd005b9e2004-11-03 17:07:05 +000020948 int mem_base;
20949 int ret_val;
20950 xmlBufferPtr buffer; /* a buffer */
20951 int n_buffer;
20952 xmlNodePtr cur; /* the node being read */
20953 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020954
Daniel Veillardd005b9e2004-11-03 17:07:05 +000020955 for (n_buffer = 0;n_buffer < gen_nb_xmlBufferPtr;n_buffer++) {
20956 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
20957 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020958 buffer = gen_xmlBufferPtr(n_buffer, 0);
20959 cur = gen_xmlNodePtr(n_cur, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000020960
20961 ret_val = xmlNodeBufGetContent(buffer, cur);
20962 desret_int(ret_val);
20963 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020964 des_xmlBufferPtr(n_buffer, buffer, 0);
20965 des_xmlNodePtr(n_cur, cur, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000020966 xmlResetLastError();
20967 if (mem_base != xmlMemBlocks()) {
20968 printf("Leak of %d blocks found in xmlNodeBufGetContent",
20969 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020970 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000020971 printf(" %d", n_buffer);
20972 printf(" %d", n_cur);
20973 printf("\n");
20974 }
20975 }
20976 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020977 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020978
Daniel Veillard42595322004-11-08 10:52:06 +000020979 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020980}
20981
20982
20983static int
20984test_xmlNodeDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020985 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020986
William M. Brack21e4ef22005-01-02 09:53:13 +000020987#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000020988 int mem_base;
20989 int ret_val;
20990 xmlBufferPtr buf; /* the XML buffer output */
20991 int n_buf;
20992 xmlDocPtr doc; /* the document */
20993 int n_doc;
20994 xmlNodePtr cur; /* the current node */
20995 int n_cur;
20996 int level; /* the imbrication level for indenting */
20997 int n_level;
20998 int format; /* is formatting allowed */
20999 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021000
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021001 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
21002 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21003 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21004 for (n_level = 0;n_level < gen_nb_int;n_level++) {
21005 for (n_format = 0;n_format < gen_nb_int;n_format++) {
21006 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021007 buf = gen_xmlBufferPtr(n_buf, 0);
21008 doc = gen_xmlDocPtr(n_doc, 1);
21009 cur = gen_xmlNodePtr(n_cur, 2);
21010 level = gen_int(n_level, 3);
21011 format = gen_int(n_format, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021012
21013 ret_val = xmlNodeDump(buf, doc, cur, level, format);
21014 desret_int(ret_val);
21015 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021016 des_xmlBufferPtr(n_buf, buf, 0);
21017 des_xmlDocPtr(n_doc, doc, 1);
21018 des_xmlNodePtr(n_cur, cur, 2);
21019 des_int(n_level, level, 3);
21020 des_int(n_format, format, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021021 xmlResetLastError();
21022 if (mem_base != xmlMemBlocks()) {
21023 printf("Leak of %d blocks found in xmlNodeDump",
21024 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021025 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021026 printf(" %d", n_buf);
21027 printf(" %d", n_doc);
21028 printf(" %d", n_cur);
21029 printf(" %d", n_level);
21030 printf(" %d", n_format);
21031 printf("\n");
21032 }
21033 }
21034 }
21035 }
21036 }
21037 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021038 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021039#endif
21040
Daniel Veillard42595322004-11-08 10:52:06 +000021041 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021042}
21043
21044
21045static int
21046test_xmlNodeDumpOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021047 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021048
William M. Brack21e4ef22005-01-02 09:53:13 +000021049#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000021050 int mem_base;
21051 xmlOutputBufferPtr buf; /* the XML buffer output */
21052 int n_buf;
21053 xmlDocPtr doc; /* the document */
21054 int n_doc;
21055 xmlNodePtr cur; /* the current node */
21056 int n_cur;
21057 int level; /* the imbrication level for indenting */
21058 int n_level;
21059 int format; /* is formatting allowed */
21060 int n_format;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021061 char * encoding; /* an optional encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +000021062 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021063
Daniel Veillard3d97e662004-11-04 10:49:00 +000021064 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
21065 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21066 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21067 for (n_level = 0;n_level < gen_nb_int;n_level++) {
21068 for (n_format = 0;n_format < gen_nb_int;n_format++) {
21069 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
21070 mem_base = xmlMemBlocks();
21071 buf = gen_xmlOutputBufferPtr(n_buf, 0);
21072 doc = gen_xmlDocPtr(n_doc, 1);
21073 cur = gen_xmlNodePtr(n_cur, 2);
21074 level = gen_int(n_level, 3);
21075 format = gen_int(n_format, 4);
21076 encoding = gen_const_char_ptr(n_encoding, 5);
21077
William M. Brackf13f77f2004-11-12 16:03:48 +000021078 xmlNodeDumpOutput(buf, doc, cur, level, format, (const char *)encoding);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021079 call_tests++;
21080 des_xmlOutputBufferPtr(n_buf, buf, 0);
21081 des_xmlDocPtr(n_doc, doc, 1);
21082 des_xmlNodePtr(n_cur, cur, 2);
21083 des_int(n_level, level, 3);
21084 des_int(n_format, format, 4);
William M. Brackf13f77f2004-11-12 16:03:48 +000021085 des_const_char_ptr(n_encoding, (const char *)encoding, 5);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021086 xmlResetLastError();
21087 if (mem_base != xmlMemBlocks()) {
21088 printf("Leak of %d blocks found in xmlNodeDumpOutput",
21089 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021090 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021091 printf(" %d", n_buf);
21092 printf(" %d", n_doc);
21093 printf(" %d", n_cur);
21094 printf(" %d", n_level);
21095 printf(" %d", n_format);
21096 printf(" %d", n_encoding);
21097 printf("\n");
21098 }
21099 }
21100 }
21101 }
21102 }
21103 }
21104 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021105 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021106#endif
21107
Daniel Veillard42595322004-11-08 10:52:06 +000021108 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021109}
21110
21111
21112static int
21113test_xmlNodeGetBase(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021114 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021115
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021116 int mem_base;
21117 xmlChar * ret_val;
21118 xmlDocPtr doc; /* the document the node pertains to */
21119 int n_doc;
21120 xmlNodePtr cur; /* the node being checked */
21121 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021122
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021123 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21124 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21125 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021126 doc = gen_xmlDocPtr(n_doc, 0);
21127 cur = gen_xmlNodePtr(n_cur, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021128
21129 ret_val = xmlNodeGetBase(doc, cur);
21130 desret_xmlChar_ptr(ret_val);
21131 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021132 des_xmlDocPtr(n_doc, doc, 0);
21133 des_xmlNodePtr(n_cur, cur, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021134 xmlResetLastError();
21135 if (mem_base != xmlMemBlocks()) {
21136 printf("Leak of %d blocks found in xmlNodeGetBase",
21137 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021138 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021139 printf(" %d", n_doc);
21140 printf(" %d", n_cur);
21141 printf("\n");
21142 }
21143 }
21144 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021145 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021146
Daniel Veillard42595322004-11-08 10:52:06 +000021147 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021148}
21149
21150
21151static int
21152test_xmlNodeGetContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021153 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021154
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021155 int mem_base;
21156 xmlChar * ret_val;
21157 xmlNodePtr cur; /* the node being read */
21158 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021159
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021160 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21161 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021162 cur = gen_xmlNodePtr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021163
21164 ret_val = xmlNodeGetContent(cur);
21165 desret_xmlChar_ptr(ret_val);
21166 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021167 des_xmlNodePtr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021168 xmlResetLastError();
21169 if (mem_base != xmlMemBlocks()) {
21170 printf("Leak of %d blocks found in xmlNodeGetContent",
21171 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021172 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021173 printf(" %d", n_cur);
21174 printf("\n");
21175 }
21176 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021177 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021178
Daniel Veillard42595322004-11-08 10:52:06 +000021179 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021180}
21181
21182
21183static int
21184test_xmlNodeGetLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021185 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021186
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021187 int mem_base;
21188 xmlChar * ret_val;
21189 xmlNodePtr cur; /* the node being checked */
21190 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021191
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021192 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21193 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021194 cur = gen_xmlNodePtr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021195
21196 ret_val = xmlNodeGetLang(cur);
21197 desret_xmlChar_ptr(ret_val);
21198 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021199 des_xmlNodePtr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021200 xmlResetLastError();
21201 if (mem_base != xmlMemBlocks()) {
21202 printf("Leak of %d blocks found in xmlNodeGetLang",
21203 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021204 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021205 printf(" %d", n_cur);
21206 printf("\n");
21207 }
21208 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021209 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021210
Daniel Veillard42595322004-11-08 10:52:06 +000021211 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021212}
21213
21214
21215static int
21216test_xmlNodeGetSpacePreserve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021217 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021218
21219 int mem_base;
21220 int ret_val;
21221 xmlNodePtr cur; /* the node being checked */
21222 int n_cur;
21223
21224 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21225 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021226 cur = gen_xmlNodePtr(n_cur, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021227
21228 ret_val = xmlNodeGetSpacePreserve(cur);
21229 desret_int(ret_val);
21230 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021231 des_xmlNodePtr(n_cur, cur, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021232 xmlResetLastError();
21233 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021234 printf("Leak of %d blocks found in xmlNodeGetSpacePreserve",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021235 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021236 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021237 printf(" %d", n_cur);
21238 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021239 }
21240 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021241 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021242
Daniel Veillard42595322004-11-08 10:52:06 +000021243 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021244}
21245
21246
21247static int
21248test_xmlNodeIsText(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021249 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021250
21251 int mem_base;
21252 int ret_val;
21253 xmlNodePtr node; /* the node */
21254 int n_node;
21255
21256 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
21257 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021258 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021259
21260 ret_val = xmlNodeIsText(node);
21261 desret_int(ret_val);
21262 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021263 des_xmlNodePtr(n_node, node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021264 xmlResetLastError();
21265 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021266 printf("Leak of %d blocks found in xmlNodeIsText",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021267 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021268 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021269 printf(" %d", n_node);
21270 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021271 }
21272 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021273 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021274
Daniel Veillard42595322004-11-08 10:52:06 +000021275 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021276}
21277
21278
21279static int
21280test_xmlNodeListGetRawString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021281 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021282
William M. Brack21e4ef22005-01-02 09:53:13 +000021283#if defined(LIBXML_TREE_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021284 int mem_base;
21285 xmlChar * ret_val;
21286 xmlDocPtr doc; /* the document */
21287 int n_doc;
21288 xmlNodePtr list; /* a Node list */
21289 int n_list;
21290 int inLine; /* should we replace entity contents or show their external form */
21291 int n_inLine;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021292
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021293 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21294 for (n_list = 0;n_list < gen_nb_xmlNodePtr;n_list++) {
21295 for (n_inLine = 0;n_inLine < gen_nb_int;n_inLine++) {
21296 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021297 doc = gen_xmlDocPtr(n_doc, 0);
21298 list = gen_xmlNodePtr(n_list, 1);
21299 inLine = gen_int(n_inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021300
21301 ret_val = xmlNodeListGetRawString(doc, list, inLine);
21302 desret_xmlChar_ptr(ret_val);
21303 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021304 des_xmlDocPtr(n_doc, doc, 0);
21305 des_xmlNodePtr(n_list, list, 1);
21306 des_int(n_inLine, inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021307 xmlResetLastError();
21308 if (mem_base != xmlMemBlocks()) {
21309 printf("Leak of %d blocks found in xmlNodeListGetRawString",
21310 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021311 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021312 printf(" %d", n_doc);
21313 printf(" %d", n_list);
21314 printf(" %d", n_inLine);
21315 printf("\n");
21316 }
21317 }
21318 }
21319 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021320 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021321#endif
21322
Daniel Veillard42595322004-11-08 10:52:06 +000021323 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021324}
21325
21326
21327static int
21328test_xmlNodeListGetString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021329 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021330
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021331 int mem_base;
21332 xmlChar * ret_val;
21333 xmlDocPtr doc; /* the document */
21334 int n_doc;
21335 xmlNodePtr list; /* a Node list */
21336 int n_list;
21337 int inLine; /* should we replace entity contents or show their external form */
21338 int n_inLine;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021339
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021340 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21341 for (n_list = 0;n_list < gen_nb_xmlNodePtr;n_list++) {
21342 for (n_inLine = 0;n_inLine < gen_nb_int;n_inLine++) {
21343 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021344 doc = gen_xmlDocPtr(n_doc, 0);
21345 list = gen_xmlNodePtr(n_list, 1);
21346 inLine = gen_int(n_inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021347
21348 ret_val = xmlNodeListGetString(doc, list, inLine);
21349 desret_xmlChar_ptr(ret_val);
21350 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021351 des_xmlDocPtr(n_doc, doc, 0);
21352 des_xmlNodePtr(n_list, list, 1);
21353 des_int(n_inLine, inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021354 xmlResetLastError();
21355 if (mem_base != xmlMemBlocks()) {
21356 printf("Leak of %d blocks found in xmlNodeListGetString",
21357 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021358 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021359 printf(" %d", n_doc);
21360 printf(" %d", n_list);
21361 printf(" %d", n_inLine);
21362 printf("\n");
21363 }
21364 }
21365 }
21366 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021367 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021368
Daniel Veillard42595322004-11-08 10:52:06 +000021369 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021370}
21371
21372
21373static int
21374test_xmlNodeSetBase(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021375 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021376
William M. Brack21e4ef22005-01-02 09:53:13 +000021377#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021378 int mem_base;
21379 xmlNodePtr cur; /* the node being changed */
21380 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021381 xmlChar * uri; /* the new base URI */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021382 int n_uri;
21383
21384 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21385 for (n_uri = 0;n_uri < gen_nb_const_xmlChar_ptr;n_uri++) {
21386 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021387 cur = gen_xmlNodePtr(n_cur, 0);
21388 uri = gen_const_xmlChar_ptr(n_uri, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021389
William M. Brackf13f77f2004-11-12 16:03:48 +000021390 xmlNodeSetBase(cur, (const xmlChar *)uri);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021391 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021392 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021393 des_const_xmlChar_ptr(n_uri, (const xmlChar *)uri, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021394 xmlResetLastError();
21395 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021396 printf("Leak of %d blocks found in xmlNodeSetBase",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021397 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021398 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021399 printf(" %d", n_cur);
21400 printf(" %d", n_uri);
21401 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021402 }
21403 }
21404 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021405 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021406#endif
21407
Daniel Veillard42595322004-11-08 10:52:06 +000021408 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021409}
21410
21411
21412static int
21413test_xmlNodeSetContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021414 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021415
21416 int mem_base;
21417 xmlNodePtr cur; /* the node being modified */
21418 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021419 xmlChar * content; /* the new value of the content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021420 int n_content;
21421
21422 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21423 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21424 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021425 cur = gen_xmlNodePtr(n_cur, 0);
21426 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021427
William M. Brackf13f77f2004-11-12 16:03:48 +000021428 xmlNodeSetContent(cur, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021429 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021430 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021431 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021432 xmlResetLastError();
21433 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021434 printf("Leak of %d blocks found in xmlNodeSetContent",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021435 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021436 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021437 printf(" %d", n_cur);
21438 printf(" %d", n_content);
21439 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021440 }
21441 }
21442 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021443 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021444
Daniel Veillard42595322004-11-08 10:52:06 +000021445 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021446}
21447
21448
21449static int
21450test_xmlNodeSetContentLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021451 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021452
William M. Brack21e4ef22005-01-02 09:53:13 +000021453#if defined(LIBXML_TREE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021454 int mem_base;
21455 xmlNodePtr cur; /* the node being modified */
21456 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021457 xmlChar * content; /* the new value of the content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021458 int n_content;
21459 int len; /* the size of @content */
21460 int n_len;
21461
21462 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21463 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21464 for (n_len = 0;n_len < gen_nb_int;n_len++) {
21465 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021466 cur = gen_xmlNodePtr(n_cur, 0);
21467 content = gen_const_xmlChar_ptr(n_content, 1);
21468 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021469
William M. Brackf13f77f2004-11-12 16:03:48 +000021470 xmlNodeSetContentLen(cur, (const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021471 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021472 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021473 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021474 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021475 xmlResetLastError();
21476 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021477 printf("Leak of %d blocks found in xmlNodeSetContentLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021478 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021479 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021480 printf(" %d", n_cur);
21481 printf(" %d", n_content);
21482 printf(" %d", n_len);
21483 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021484 }
21485 }
21486 }
21487 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021488 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021489#endif
21490
Daniel Veillard42595322004-11-08 10:52:06 +000021491 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021492}
21493
21494
21495static int
21496test_xmlNodeSetLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021497 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021498
William M. Brack21e4ef22005-01-02 09:53:13 +000021499#if defined(LIBXML_TREE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021500 int mem_base;
21501 xmlNodePtr cur; /* the node being changed */
21502 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021503 xmlChar * lang; /* the language description */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021504 int n_lang;
21505
21506 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21507 for (n_lang = 0;n_lang < gen_nb_const_xmlChar_ptr;n_lang++) {
21508 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021509 cur = gen_xmlNodePtr(n_cur, 0);
21510 lang = gen_const_xmlChar_ptr(n_lang, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021511
William M. Brackf13f77f2004-11-12 16:03:48 +000021512 xmlNodeSetLang(cur, (const xmlChar *)lang);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021513 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021514 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021515 des_const_xmlChar_ptr(n_lang, (const xmlChar *)lang, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021516 xmlResetLastError();
21517 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021518 printf("Leak of %d blocks found in xmlNodeSetLang",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021519 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021520 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021521 printf(" %d", n_cur);
21522 printf(" %d", n_lang);
21523 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021524 }
21525 }
21526 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021527 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021528#endif
21529
Daniel Veillard42595322004-11-08 10:52:06 +000021530 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021531}
21532
21533
21534static int
21535test_xmlNodeSetName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021536 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021537
William M. Brack21e4ef22005-01-02 09:53:13 +000021538#if defined(LIBXML_TREE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021539 int mem_base;
21540 xmlNodePtr cur; /* the node being changed */
21541 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021542 xmlChar * name; /* the new tag name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021543 int n_name;
21544
21545 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21546 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
21547 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021548 cur = gen_xmlNodePtr(n_cur, 0);
21549 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021550
William M. Brackf13f77f2004-11-12 16:03:48 +000021551 xmlNodeSetName(cur, (const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021552 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021553 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021554 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021555 xmlResetLastError();
21556 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021557 printf("Leak of %d blocks found in xmlNodeSetName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021558 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021559 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021560 printf(" %d", n_cur);
21561 printf(" %d", n_name);
21562 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021563 }
21564 }
21565 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021566 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021567#endif
21568
Daniel Veillard42595322004-11-08 10:52:06 +000021569 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021570}
21571
21572
21573static int
21574test_xmlNodeSetSpacePreserve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021575 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021576
William M. Brack21e4ef22005-01-02 09:53:13 +000021577#if defined(LIBXML_TREE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021578 int mem_base;
21579 xmlNodePtr cur; /* the node being changed */
21580 int n_cur;
21581 int val; /* the xml:space value ("0": default, 1: "preserve") */
21582 int n_val;
21583
21584 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21585 for (n_val = 0;n_val < gen_nb_int;n_val++) {
21586 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021587 cur = gen_xmlNodePtr(n_cur, 0);
21588 val = gen_int(n_val, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021589
21590 xmlNodeSetSpacePreserve(cur, val);
21591 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021592 des_xmlNodePtr(n_cur, cur, 0);
21593 des_int(n_val, val, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021594 xmlResetLastError();
21595 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021596 printf("Leak of %d blocks found in xmlNodeSetSpacePreserve",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021597 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021598 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021599 printf(" %d", n_cur);
21600 printf(" %d", n_val);
21601 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021602 }
21603 }
21604 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021605 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021606#endif
21607
Daniel Veillard42595322004-11-08 10:52:06 +000021608 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021609}
21610
21611
21612static int
21613test_xmlReconciliateNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021614 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021615
William M. Brack21e4ef22005-01-02 09:53:13 +000021616#if defined(LIBXML_TREE_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000021617#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000021618 int mem_base;
21619 int ret_val;
21620 xmlDocPtr doc; /* the document */
21621 int n_doc;
21622 xmlNodePtr tree; /* a node defining the subtree to reconciliate */
21623 int n_tree;
21624
21625 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21626 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
21627 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021628 doc = gen_xmlDocPtr(n_doc, 0);
21629 tree = gen_xmlNodePtr(n_tree, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021630
21631 ret_val = xmlReconciliateNs(doc, tree);
21632 desret_int(ret_val);
21633 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021634 des_xmlDocPtr(n_doc, doc, 0);
21635 des_xmlNodePtr(n_tree, tree, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021636 xmlResetLastError();
21637 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021638 printf("Leak of %d blocks found in xmlReconciliateNs",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021639 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021640 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021641 printf(" %d", n_doc);
21642 printf(" %d", n_tree);
21643 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021644 }
21645 }
21646 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021647 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000021648#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000021649#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000021650
Daniel Veillard42595322004-11-08 10:52:06 +000021651 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021652}
21653
21654
21655static int
21656test_xmlRemoveProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021657 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021658
William M. Brack21e4ef22005-01-02 09:53:13 +000021659#if defined(LIBXML_TREE_ENABLED)
Daniel Veillardce244ad2004-11-05 10:03:46 +000021660 int mem_base;
21661 int ret_val;
21662 xmlAttrPtr cur; /* an attribute */
21663 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021664
Daniel Veillardce244ad2004-11-05 10:03:46 +000021665 for (n_cur = 0;n_cur < gen_nb_xmlAttrPtr;n_cur++) {
21666 mem_base = xmlMemBlocks();
21667 cur = gen_xmlAttrPtr(n_cur, 0);
21668
21669 ret_val = xmlRemoveProp(cur);
21670 cur = NULL;
21671 desret_int(ret_val);
21672 call_tests++;
21673 des_xmlAttrPtr(n_cur, cur, 0);
21674 xmlResetLastError();
21675 if (mem_base != xmlMemBlocks()) {
21676 printf("Leak of %d blocks found in xmlRemoveProp",
21677 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021678 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000021679 printf(" %d", n_cur);
21680 printf("\n");
21681 }
21682 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021683 function_tests++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000021684#endif
21685
Daniel Veillard42595322004-11-08 10:52:06 +000021686 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021687}
21688
21689
21690static int
21691test_xmlReplaceNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021692 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021693
William M. Brack21e4ef22005-01-02 09:53:13 +000021694#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021695 int mem_base;
21696 xmlNodePtr ret_val;
21697 xmlNodePtr old; /* the old node */
21698 int n_old;
21699 xmlNodePtr cur; /* the node */
21700 int n_cur;
21701
21702 for (n_old = 0;n_old < gen_nb_xmlNodePtr;n_old++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021703 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000021704 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021705 old = gen_xmlNodePtr(n_old, 0);
21706 cur = gen_xmlNodePtr_in(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021707
21708 ret_val = xmlReplaceNode(old, cur);
Daniel Veillardce244ad2004-11-05 10:03:46 +000021709 if (cur != NULL) {
21710 xmlUnlinkNode(cur);
Daniel Veillarda03e3652004-11-02 18:45:30 +000021711 xmlFreeNode(cur) ; cur = NULL ; }
Daniel Veillardce244ad2004-11-05 10:03:46 +000021712 if (old != NULL) {
21713 xmlUnlinkNode(old);
21714 xmlFreeNode(old) ; old = NULL ; }
21715 ret_val = NULL;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021716 desret_xmlNodePtr(ret_val);
21717 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021718 des_xmlNodePtr(n_old, old, 0);
21719 des_xmlNodePtr_in(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021720 xmlResetLastError();
21721 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021722 printf("Leak of %d blocks found in xmlReplaceNode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021723 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021724 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021725 printf(" %d", n_old);
21726 printf(" %d", n_cur);
21727 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021728 }
21729 }
21730 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021731 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021732#endif
21733
Daniel Veillard42595322004-11-08 10:52:06 +000021734 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021735}
21736
21737
21738static int
21739test_xmlSaveFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021740 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021741
William M. Brack21e4ef22005-01-02 09:53:13 +000021742#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021743 int mem_base;
21744 int ret_val;
21745 const char * filename; /* the filename (or URL) */
21746 int n_filename;
21747 xmlDocPtr cur; /* the document */
21748 int n_cur;
21749
21750 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
21751 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
21752 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021753 filename = gen_fileoutput(n_filename, 0);
21754 cur = gen_xmlDocPtr(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021755
21756 ret_val = xmlSaveFile(filename, cur);
21757 desret_int(ret_val);
21758 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021759 des_fileoutput(n_filename, filename, 0);
21760 des_xmlDocPtr(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021761 xmlResetLastError();
21762 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021763 printf("Leak of %d blocks found in xmlSaveFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021764 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021765 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021766 printf(" %d", n_filename);
21767 printf(" %d", n_cur);
21768 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021769 }
21770 }
21771 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021772 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021773#endif
21774
Daniel Veillard42595322004-11-08 10:52:06 +000021775 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021776}
21777
21778
21779static int
21780test_xmlSaveFileEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021781 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021782
William M. Brack21e4ef22005-01-02 09:53:13 +000021783#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021784 int mem_base;
21785 int ret_val;
21786 const char * filename; /* the filename (or URL) */
21787 int n_filename;
21788 xmlDocPtr cur; /* the document */
21789 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021790 char * encoding; /* the name of an encoding (or NULL) */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021791 int n_encoding;
21792
21793 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
21794 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
21795 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
21796 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021797 filename = gen_fileoutput(n_filename, 0);
21798 cur = gen_xmlDocPtr(n_cur, 1);
21799 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021800
William M. Brackf13f77f2004-11-12 16:03:48 +000021801 ret_val = xmlSaveFileEnc(filename, cur, (const char *)encoding);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021802 desret_int(ret_val);
21803 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021804 des_fileoutput(n_filename, filename, 0);
21805 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000021806 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021807 xmlResetLastError();
21808 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021809 printf("Leak of %d blocks found in xmlSaveFileEnc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021810 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021811 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021812 printf(" %d", n_filename);
21813 printf(" %d", n_cur);
21814 printf(" %d", n_encoding);
21815 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021816 }
21817 }
21818 }
21819 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021820 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +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_xmlSaveFileTo(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_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000021832 int mem_base;
21833 int ret_val;
21834 xmlOutputBufferPtr buf; /* an output I/O buffer */
21835 int n_buf;
21836 xmlDocPtr cur; /* the document */
21837 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021838 char * encoding; /* the encoding if any assuming the I/O layer handles the trancoding */
Daniel Veillard3d97e662004-11-04 10:49:00 +000021839 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021840
Daniel Veillard3d97e662004-11-04 10:49:00 +000021841 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
21842 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
21843 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
21844 mem_base = xmlMemBlocks();
21845 buf = gen_xmlOutputBufferPtr(n_buf, 0);
21846 cur = gen_xmlDocPtr(n_cur, 1);
21847 encoding = gen_const_char_ptr(n_encoding, 2);
21848
William M. Brackf13f77f2004-11-12 16:03:48 +000021849 ret_val = xmlSaveFileTo(buf, cur, (const char *)encoding);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021850 buf = NULL;
21851 desret_int(ret_val);
21852 call_tests++;
21853 des_xmlOutputBufferPtr(n_buf, buf, 0);
21854 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000021855 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021856 xmlResetLastError();
21857 if (mem_base != xmlMemBlocks()) {
21858 printf("Leak of %d blocks found in xmlSaveFileTo",
21859 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021860 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021861 printf(" %d", n_buf);
21862 printf(" %d", n_cur);
21863 printf(" %d", n_encoding);
21864 printf("\n");
21865 }
21866 }
21867 }
21868 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021869 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021870#endif
21871
Daniel Veillard42595322004-11-08 10:52:06 +000021872 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021873}
21874
21875
21876static int
21877test_xmlSaveFormatFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021878 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021879
William M. Brack21e4ef22005-01-02 09:53:13 +000021880#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021881 int mem_base;
21882 int ret_val;
21883 const char * filename; /* the filename (or URL) */
21884 int n_filename;
21885 xmlDocPtr cur; /* the document */
21886 int n_cur;
21887 int format; /* should formatting spaces been added */
21888 int n_format;
21889
21890 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
21891 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
21892 for (n_format = 0;n_format < gen_nb_int;n_format++) {
21893 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021894 filename = gen_fileoutput(n_filename, 0);
21895 cur = gen_xmlDocPtr(n_cur, 1);
21896 format = gen_int(n_format, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021897
21898 ret_val = xmlSaveFormatFile(filename, cur, format);
21899 desret_int(ret_val);
21900 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021901 des_fileoutput(n_filename, filename, 0);
21902 des_xmlDocPtr(n_cur, cur, 1);
21903 des_int(n_format, format, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021904 xmlResetLastError();
21905 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021906 printf("Leak of %d blocks found in xmlSaveFormatFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021907 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021908 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021909 printf(" %d", n_filename);
21910 printf(" %d", n_cur);
21911 printf(" %d", n_format);
21912 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021913 }
21914 }
21915 }
21916 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021917 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021918#endif
21919
Daniel Veillard42595322004-11-08 10:52:06 +000021920 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021921}
21922
21923
21924static int
21925test_xmlSaveFormatFileEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021926 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021927
William M. Brack21e4ef22005-01-02 09:53:13 +000021928#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021929 int mem_base;
21930 int ret_val;
21931 const char * filename; /* the filename or URL to output */
21932 int n_filename;
21933 xmlDocPtr cur; /* the document being saved */
21934 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021935 char * encoding; /* the name of the encoding to use or NULL. */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021936 int n_encoding;
21937 int format; /* should formatting spaces be added. */
21938 int n_format;
21939
21940 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
21941 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
21942 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
21943 for (n_format = 0;n_format < gen_nb_int;n_format++) {
21944 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021945 filename = gen_fileoutput(n_filename, 0);
21946 cur = gen_xmlDocPtr(n_cur, 1);
21947 encoding = gen_const_char_ptr(n_encoding, 2);
21948 format = gen_int(n_format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021949
William M. Brackf13f77f2004-11-12 16:03:48 +000021950 ret_val = xmlSaveFormatFileEnc(filename, cur, (const char *)encoding, format);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021951 desret_int(ret_val);
21952 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021953 des_fileoutput(n_filename, filename, 0);
21954 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000021955 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021956 des_int(n_format, format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021957 xmlResetLastError();
21958 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021959 printf("Leak of %d blocks found in xmlSaveFormatFileEnc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021960 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021961 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021962 printf(" %d", n_filename);
21963 printf(" %d", n_cur);
21964 printf(" %d", n_encoding);
21965 printf(" %d", n_format);
21966 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021967 }
21968 }
21969 }
21970 }
21971 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021972 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021973#endif
21974
Daniel Veillard42595322004-11-08 10:52:06 +000021975 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021976}
21977
21978
21979static int
21980test_xmlSaveFormatFileTo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021981 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021982
William M. Brack21e4ef22005-01-02 09:53:13 +000021983#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000021984 int mem_base;
21985 int ret_val;
21986 xmlOutputBufferPtr buf; /* an output I/O buffer */
21987 int n_buf;
21988 xmlDocPtr cur; /* the document */
21989 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021990 char * encoding; /* the encoding if any assuming the I/O layer handles the trancoding */
Daniel Veillard3d97e662004-11-04 10:49:00 +000021991 int n_encoding;
21992 int format; /* should formatting spaces been added */
21993 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021994
Daniel Veillard3d97e662004-11-04 10:49:00 +000021995 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
21996 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
21997 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
21998 for (n_format = 0;n_format < gen_nb_int;n_format++) {
21999 mem_base = xmlMemBlocks();
22000 buf = gen_xmlOutputBufferPtr(n_buf, 0);
22001 cur = gen_xmlDocPtr(n_cur, 1);
22002 encoding = gen_const_char_ptr(n_encoding, 2);
22003 format = gen_int(n_format, 3);
22004
William M. Brackf13f77f2004-11-12 16:03:48 +000022005 ret_val = xmlSaveFormatFileTo(buf, cur, (const char *)encoding, format);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022006 buf = NULL;
22007 desret_int(ret_val);
22008 call_tests++;
22009 des_xmlOutputBufferPtr(n_buf, buf, 0);
22010 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022011 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022012 des_int(n_format, format, 3);
22013 xmlResetLastError();
22014 if (mem_base != xmlMemBlocks()) {
22015 printf("Leak of %d blocks found in xmlSaveFormatFileTo",
22016 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022017 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022018 printf(" %d", n_buf);
22019 printf(" %d", n_cur);
22020 printf(" %d", n_encoding);
22021 printf(" %d", n_format);
22022 printf("\n");
22023 }
22024 }
22025 }
22026 }
22027 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022028 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022029#endif
22030
Daniel Veillard42595322004-11-08 10:52:06 +000022031 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022032}
22033
22034
22035static int
22036test_xmlSearchNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022037 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022038
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022039 int mem_base;
22040 xmlNsPtr ret_val;
22041 xmlDocPtr doc; /* the document */
22042 int n_doc;
22043 xmlNodePtr node; /* the current node */
22044 int n_node;
22045 xmlChar * nameSpace; /* the namespace prefix */
22046 int n_nameSpace;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022047
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022048 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22049 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22050 for (n_nameSpace = 0;n_nameSpace < gen_nb_const_xmlChar_ptr;n_nameSpace++) {
22051 mem_base = xmlMemBlocks();
22052 doc = gen_xmlDocPtr(n_doc, 0);
22053 node = gen_xmlNodePtr(n_node, 1);
22054 nameSpace = gen_const_xmlChar_ptr(n_nameSpace, 2);
22055
William M. Brackf13f77f2004-11-12 16:03:48 +000022056 ret_val = xmlSearchNs(doc, node, (const xmlChar *)nameSpace);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022057 desret_xmlNsPtr(ret_val);
22058 call_tests++;
22059 des_xmlDocPtr(n_doc, doc, 0);
22060 des_xmlNodePtr(n_node, node, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022061 des_const_xmlChar_ptr(n_nameSpace, (const xmlChar *)nameSpace, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022062 xmlResetLastError();
22063 if (mem_base != xmlMemBlocks()) {
22064 printf("Leak of %d blocks found in xmlSearchNs",
22065 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022066 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022067 printf(" %d", n_doc);
22068 printf(" %d", n_node);
22069 printf(" %d", n_nameSpace);
22070 printf("\n");
22071 }
22072 }
22073 }
22074 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022075 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022076
Daniel Veillard42595322004-11-08 10:52:06 +000022077 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022078}
22079
22080
22081static int
22082test_xmlSearchNsByHref(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022083 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022084
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022085 int mem_base;
22086 xmlNsPtr ret_val;
22087 xmlDocPtr doc; /* the document */
22088 int n_doc;
22089 xmlNodePtr node; /* the current node */
22090 int n_node;
22091 xmlChar * href; /* the namespace value */
22092 int n_href;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022093
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022094 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22095 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22096 for (n_href = 0;n_href < gen_nb_const_xmlChar_ptr;n_href++) {
22097 mem_base = xmlMemBlocks();
22098 doc = gen_xmlDocPtr(n_doc, 0);
22099 node = gen_xmlNodePtr(n_node, 1);
22100 href = gen_const_xmlChar_ptr(n_href, 2);
22101
William M. Brackf13f77f2004-11-12 16:03:48 +000022102 ret_val = xmlSearchNsByHref(doc, node, (const xmlChar *)href);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022103 desret_xmlNsPtr(ret_val);
22104 call_tests++;
22105 des_xmlDocPtr(n_doc, doc, 0);
22106 des_xmlNodePtr(n_node, node, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022107 des_const_xmlChar_ptr(n_href, (const xmlChar *)href, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022108 xmlResetLastError();
22109 if (mem_base != xmlMemBlocks()) {
22110 printf("Leak of %d blocks found in xmlSearchNsByHref",
22111 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022112 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022113 printf(" %d", n_doc);
22114 printf(" %d", n_node);
22115 printf(" %d", n_href);
22116 printf("\n");
22117 }
22118 }
22119 }
22120 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022121 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022122
Daniel Veillard42595322004-11-08 10:52:06 +000022123 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022124}
22125
22126
22127static int
22128test_xmlSetBufferAllocationScheme(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022129 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022130
Daniel Veillard57b25162004-11-06 14:50:18 +000022131 int mem_base;
22132 xmlBufferAllocationScheme scheme; /* allocation method to use */
22133 int n_scheme;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022134
Daniel Veillard57b25162004-11-06 14:50:18 +000022135 for (n_scheme = 0;n_scheme < gen_nb_xmlBufferAllocationScheme;n_scheme++) {
22136 mem_base = xmlMemBlocks();
22137 scheme = gen_xmlBufferAllocationScheme(n_scheme, 0);
22138
22139 xmlSetBufferAllocationScheme(scheme);
22140 call_tests++;
22141 des_xmlBufferAllocationScheme(n_scheme, scheme, 0);
22142 xmlResetLastError();
22143 if (mem_base != xmlMemBlocks()) {
22144 printf("Leak of %d blocks found in xmlSetBufferAllocationScheme",
22145 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022146 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022147 printf(" %d", n_scheme);
22148 printf("\n");
22149 }
22150 }
Daniel Veillard57b25162004-11-06 14:50:18 +000022151 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022152
Daniel Veillard42595322004-11-08 10:52:06 +000022153 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022154}
22155
22156
22157static int
22158test_xmlSetCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022159 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022160
22161 int mem_base;
22162 int mode; /* the compression ratio */
22163 int n_mode;
22164
22165 for (n_mode = 0;n_mode < gen_nb_int;n_mode++) {
22166 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022167 mode = gen_int(n_mode, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022168
22169 xmlSetCompressMode(mode);
22170 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022171 des_int(n_mode, mode, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022172 xmlResetLastError();
22173 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022174 printf("Leak of %d blocks found in xmlSetCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022175 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022176 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022177 printf(" %d", n_mode);
22178 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022179 }
22180 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022181 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022182
Daniel Veillard42595322004-11-08 10:52:06 +000022183 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022184}
22185
22186
22187static int
22188test_xmlSetDocCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022189 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022190
22191 int mem_base;
22192 xmlDocPtr doc; /* the document */
22193 int n_doc;
22194 int mode; /* the compression ratio */
22195 int n_mode;
22196
22197 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22198 for (n_mode = 0;n_mode < gen_nb_int;n_mode++) {
22199 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022200 doc = gen_xmlDocPtr(n_doc, 0);
22201 mode = gen_int(n_mode, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022202
22203 xmlSetDocCompressMode(doc, mode);
22204 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022205 des_xmlDocPtr(n_doc, doc, 0);
22206 des_int(n_mode, mode, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022207 xmlResetLastError();
22208 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022209 printf("Leak of %d blocks found in xmlSetDocCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022210 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022211 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022212 printf(" %d", n_doc);
22213 printf(" %d", n_mode);
22214 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022215 }
22216 }
22217 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022218 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022219
Daniel Veillard42595322004-11-08 10:52:06 +000022220 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022221}
22222
22223
22224static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000022225test_xmlSetNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022226 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022227
Daniel Veillard27f20102004-11-05 11:50:11 +000022228 int mem_base;
22229 xmlNodePtr node; /* a node in the document */
22230 int n_node;
22231 xmlNsPtr ns; /* a namespace pointer */
22232 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022233
Daniel Veillard27f20102004-11-05 11:50:11 +000022234 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22235 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
22236 mem_base = xmlMemBlocks();
22237 node = gen_xmlNodePtr(n_node, 0);
22238 ns = gen_xmlNsPtr(n_ns, 1);
22239
22240 xmlSetNs(node, ns);
22241 call_tests++;
22242 des_xmlNodePtr(n_node, node, 0);
22243 des_xmlNsPtr(n_ns, ns, 1);
22244 xmlResetLastError();
22245 if (mem_base != xmlMemBlocks()) {
22246 printf("Leak of %d blocks found in xmlSetNs",
22247 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022248 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000022249 printf(" %d", n_node);
22250 printf(" %d", n_ns);
22251 printf("\n");
22252 }
22253 }
22254 }
Daniel Veillard27f20102004-11-05 11:50:11 +000022255 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022256
Daniel Veillard42595322004-11-08 10:52:06 +000022257 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022258}
22259
22260
22261static int
22262test_xmlSetNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022263 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022264
William M. Brack21e4ef22005-01-02 09:53:13 +000022265#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +000022266 int mem_base;
22267 xmlAttrPtr ret_val;
22268 xmlNodePtr node; /* the node */
22269 int n_node;
22270 xmlNsPtr ns; /* the namespace definition */
22271 int n_ns;
22272 xmlChar * name; /* the attribute name */
22273 int n_name;
22274 xmlChar * value; /* the attribute value */
22275 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022276
Daniel Veillard57b25162004-11-06 14:50:18 +000022277 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22278 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
22279 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22280 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22281 mem_base = xmlMemBlocks();
22282 node = gen_xmlNodePtr(n_node, 0);
22283 ns = gen_xmlNsPtr(n_ns, 1);
22284 name = gen_const_xmlChar_ptr(n_name, 2);
22285 value = gen_const_xmlChar_ptr(n_value, 3);
22286
William M. Brackf13f77f2004-11-12 16:03:48 +000022287 ret_val = xmlSetNsProp(node, ns, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000022288 desret_xmlAttrPtr(ret_val);
22289 call_tests++;
22290 des_xmlNodePtr(n_node, node, 0);
22291 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022292 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
22293 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000022294 xmlResetLastError();
22295 if (mem_base != xmlMemBlocks()) {
22296 printf("Leak of %d blocks found in xmlSetNsProp",
22297 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022298 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022299 printf(" %d", n_node);
22300 printf(" %d", n_ns);
22301 printf(" %d", n_name);
22302 printf(" %d", n_value);
22303 printf("\n");
22304 }
22305 }
22306 }
22307 }
22308 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022309 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022310#endif
22311
Daniel Veillard42595322004-11-08 10:52:06 +000022312 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022313}
22314
22315
22316static int
22317test_xmlSetProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022318 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022319
William M. Brack21e4ef22005-01-02 09:53:13 +000022320#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +000022321 int mem_base;
22322 xmlAttrPtr ret_val;
22323 xmlNodePtr node; /* the node */
22324 int n_node;
22325 xmlChar * name; /* the attribute name */
22326 int n_name;
22327 xmlChar * value; /* the attribute value */
22328 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022329
Daniel Veillard57b25162004-11-06 14:50:18 +000022330 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22331 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22332 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22333 mem_base = xmlMemBlocks();
22334 node = gen_xmlNodePtr(n_node, 0);
22335 name = gen_const_xmlChar_ptr(n_name, 1);
22336 value = gen_const_xmlChar_ptr(n_value, 2);
22337
William M. Brackf13f77f2004-11-12 16:03:48 +000022338 ret_val = xmlSetProp(node, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000022339 desret_xmlAttrPtr(ret_val);
22340 call_tests++;
22341 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000022342 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
22343 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
Daniel Veillard57b25162004-11-06 14:50:18 +000022344 xmlResetLastError();
22345 if (mem_base != xmlMemBlocks()) {
22346 printf("Leak of %d blocks found in xmlSetProp",
22347 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022348 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022349 printf(" %d", n_node);
22350 printf(" %d", n_name);
22351 printf(" %d", n_value);
22352 printf("\n");
22353 }
22354 }
22355 }
22356 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022357 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022358#endif
22359
Daniel Veillard42595322004-11-08 10:52:06 +000022360 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022361}
22362
22363
22364static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000022365test_xmlSplitQName2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022366 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022367
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022368 int mem_base;
22369 xmlChar * ret_val;
22370 xmlChar * name; /* the full QName */
22371 int n_name;
22372 xmlChar ** prefix; /* a xmlChar ** */
22373 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022374
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022375 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22376 for (n_prefix = 0;n_prefix < gen_nb_xmlChar_ptr_ptr;n_prefix++) {
22377 mem_base = xmlMemBlocks();
22378 name = gen_const_xmlChar_ptr(n_name, 0);
22379 prefix = gen_xmlChar_ptr_ptr(n_prefix, 1);
22380
William M. Brackf13f77f2004-11-12 16:03:48 +000022381 ret_val = xmlSplitQName2((const xmlChar *)name, prefix);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022382 desret_xmlChar_ptr(ret_val);
22383 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000022384 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022385 des_xmlChar_ptr_ptr(n_prefix, prefix, 1);
22386 xmlResetLastError();
22387 if (mem_base != xmlMemBlocks()) {
22388 printf("Leak of %d blocks found in xmlSplitQName2",
22389 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022390 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022391 printf(" %d", n_name);
22392 printf(" %d", n_prefix);
22393 printf("\n");
22394 }
22395 }
22396 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022397 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022398
Daniel Veillard42595322004-11-08 10:52:06 +000022399 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022400}
22401
22402
22403static int
22404test_xmlSplitQName3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022405 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022406
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022407 int mem_base;
22408 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022409 xmlChar * name; /* the full QName */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022410 int n_name;
22411 int * len; /* an int * */
22412 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022413
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022414 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22415 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
22416 mem_base = xmlMemBlocks();
22417 name = gen_const_xmlChar_ptr(n_name, 0);
22418 len = gen_int_ptr(n_len, 1);
22419
William M. Brackf13f77f2004-11-12 16:03:48 +000022420 ret_val = xmlSplitQName3((const xmlChar *)name, len);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022421 desret_const_xmlChar_ptr(ret_val);
22422 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000022423 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022424 des_int_ptr(n_len, len, 1);
22425 xmlResetLastError();
22426 if (mem_base != xmlMemBlocks()) {
22427 printf("Leak of %d blocks found in xmlSplitQName3",
22428 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022429 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022430 printf(" %d", n_name);
22431 printf(" %d", n_len);
22432 printf("\n");
22433 }
22434 }
22435 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022436 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022437
Daniel Veillard42595322004-11-08 10:52:06 +000022438 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022439}
22440
22441
22442static int
22443test_xmlStringGetNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022444 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022445
22446 int mem_base;
22447 xmlNodePtr ret_val;
22448 xmlDocPtr doc; /* the document */
22449 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022450 xmlChar * value; /* the value of the attribute */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022451 int n_value;
22452
22453 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22454 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22455 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022456 doc = gen_xmlDocPtr(n_doc, 0);
22457 value = gen_const_xmlChar_ptr(n_value, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022458
William M. Brackf13f77f2004-11-12 16:03:48 +000022459 ret_val = xmlStringGetNodeList(doc, (const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022460 desret_xmlNodePtr(ret_val);
22461 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022462 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000022463 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022464 xmlResetLastError();
22465 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022466 printf("Leak of %d blocks found in xmlStringGetNodeList",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022467 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022468 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022469 printf(" %d", n_doc);
22470 printf(" %d", n_value);
22471 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022472 }
22473 }
22474 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022475 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022476
Daniel Veillard42595322004-11-08 10:52:06 +000022477 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022478}
22479
22480
22481static int
22482test_xmlStringLenGetNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022483 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022484
22485 int mem_base;
22486 xmlNodePtr ret_val;
22487 xmlDocPtr doc; /* the document */
22488 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022489 xmlChar * value; /* the value of the text */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022490 int n_value;
22491 int len; /* the length of the string value */
22492 int n_len;
22493
22494 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22495 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22496 for (n_len = 0;n_len < gen_nb_int;n_len++) {
22497 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022498 doc = gen_xmlDocPtr(n_doc, 0);
22499 value = gen_const_xmlChar_ptr(n_value, 1);
22500 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022501
William M. Brackf13f77f2004-11-12 16:03:48 +000022502 ret_val = xmlStringLenGetNodeList(doc, (const xmlChar *)value, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022503 desret_xmlNodePtr(ret_val);
22504 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022505 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000022506 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022507 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022508 xmlResetLastError();
22509 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022510 printf("Leak of %d blocks found in xmlStringLenGetNodeList",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022511 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022512 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022513 printf(" %d", n_doc);
22514 printf(" %d", n_value);
22515 printf(" %d", n_len);
22516 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022517 }
22518 }
22519 }
22520 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022521 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022522
Daniel Veillard42595322004-11-08 10:52:06 +000022523 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022524}
22525
22526
22527static int
22528test_xmlTextConcat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022529 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022530
22531 int mem_base;
22532 int ret_val;
22533 xmlNodePtr node; /* the node */
22534 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022535 xmlChar * content; /* the content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022536 int n_content;
22537 int len; /* @content length */
22538 int n_len;
22539
22540 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22541 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
22542 for (n_len = 0;n_len < gen_nb_int;n_len++) {
22543 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022544 node = gen_xmlNodePtr(n_node, 0);
22545 content = gen_const_xmlChar_ptr(n_content, 1);
22546 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022547
William M. Brackf13f77f2004-11-12 16:03:48 +000022548 ret_val = xmlTextConcat(node, (const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022549 desret_int(ret_val);
22550 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022551 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000022552 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022553 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022554 xmlResetLastError();
22555 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022556 printf("Leak of %d blocks found in xmlTextConcat",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022557 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022558 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022559 printf(" %d", n_node);
22560 printf(" %d", n_content);
22561 printf(" %d", n_len);
22562 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022563 }
22564 }
22565 }
22566 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022567 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022568
Daniel Veillard42595322004-11-08 10:52:06 +000022569 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022570}
22571
22572
22573static int
22574test_xmlTextMerge(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022575 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022576
22577 int mem_base;
22578 xmlNodePtr ret_val;
22579 xmlNodePtr first; /* the first text node */
22580 int n_first;
22581 xmlNodePtr second; /* the second text node being merged */
22582 int n_second;
22583
Daniel Veillarda03e3652004-11-02 18:45:30 +000022584 for (n_first = 0;n_first < gen_nb_xmlNodePtr_in;n_first++) {
22585 for (n_second = 0;n_second < gen_nb_xmlNodePtr_in;n_second++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000022586 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022587 first = gen_xmlNodePtr_in(n_first, 0);
22588 second = gen_xmlNodePtr_in(n_second, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022589
22590 ret_val = xmlTextMerge(first, second);
Daniel Veillarda03e3652004-11-02 18:45:30 +000022591 if ((first != NULL) && (first->type != XML_TEXT_NODE)) {
Daniel Veillardce244ad2004-11-05 10:03:46 +000022592 xmlUnlinkNode(second);
Daniel Veillarda03e3652004-11-02 18:45:30 +000022593 xmlFreeNode(second) ; second = NULL ; }
Daniel Veillard8a32fe42004-11-02 22:10:16 +000022594 desret_xmlNodePtr(ret_val);
22595 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022596 des_xmlNodePtr_in(n_first, first, 0);
22597 des_xmlNodePtr_in(n_second, second, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022598 xmlResetLastError();
22599 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022600 printf("Leak of %d blocks found in xmlTextMerge",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022601 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022602 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022603 printf(" %d", n_first);
22604 printf(" %d", n_second);
22605 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022606 }
22607 }
22608 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022609 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022610
Daniel Veillard42595322004-11-08 10:52:06 +000022611 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022612}
22613
22614
22615static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000022616test_xmlUnsetNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022617 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022618
William M. Brack21e4ef22005-01-02 09:53:13 +000022619#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000022620 int mem_base;
22621 int ret_val;
22622 xmlNodePtr node; /* the node */
22623 int n_node;
22624 xmlNsPtr ns; /* the namespace definition */
22625 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022626 xmlChar * name; /* the attribute name */
Daniel Veillard27f20102004-11-05 11:50:11 +000022627 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022628
Daniel Veillard27f20102004-11-05 11:50:11 +000022629 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22630 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
22631 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22632 mem_base = xmlMemBlocks();
22633 node = gen_xmlNodePtr(n_node, 0);
22634 ns = gen_xmlNsPtr(n_ns, 1);
22635 name = gen_const_xmlChar_ptr(n_name, 2);
22636
William M. Brackf13f77f2004-11-12 16:03:48 +000022637 ret_val = xmlUnsetNsProp(node, ns, (const xmlChar *)name);
Daniel Veillard27f20102004-11-05 11:50:11 +000022638 desret_int(ret_val);
22639 call_tests++;
22640 des_xmlNodePtr(n_node, node, 0);
22641 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022642 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillard27f20102004-11-05 11:50:11 +000022643 xmlResetLastError();
22644 if (mem_base != xmlMemBlocks()) {
22645 printf("Leak of %d blocks found in xmlUnsetNsProp",
22646 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022647 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000022648 printf(" %d", n_node);
22649 printf(" %d", n_ns);
22650 printf(" %d", n_name);
22651 printf("\n");
22652 }
22653 }
22654 }
22655 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022656 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000022657#endif
22658
Daniel Veillard42595322004-11-08 10:52:06 +000022659 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022660}
22661
22662
22663static int
22664test_xmlUnsetProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022665 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022666
William M. Brack21e4ef22005-01-02 09:53:13 +000022667#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000022668 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 * name; /* the attribute name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022673 int n_name;
22674
22675 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22676 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22677 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022678 node = gen_xmlNodePtr(n_node, 0);
22679 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022680
William M. Brackf13f77f2004-11-12 16:03:48 +000022681 ret_val = xmlUnsetProp(node, (const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022682 desret_int(ret_val);
22683 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022684 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000022685 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022686 xmlResetLastError();
22687 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022688 printf("Leak of %d blocks found in xmlUnsetProp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022689 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022690 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022691 printf(" %d", n_node);
22692 printf(" %d", n_name);
22693 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022694 }
22695 }
22696 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022697 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022698#endif
22699
Daniel Veillard42595322004-11-08 10:52:06 +000022700 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022701}
22702
22703
22704static int
22705test_xmlValidateNCName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022706 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022707
William M. Brack21e4ef22005-01-02 09:53:13 +000022708#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000022709#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000022710 int mem_base;
22711 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022712 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022713 int n_value;
22714 int space; /* allow spaces in front and end of the string */
22715 int n_space;
22716
22717 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22718 for (n_space = 0;n_space < gen_nb_int;n_space++) {
22719 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022720 value = gen_const_xmlChar_ptr(n_value, 0);
22721 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022722
William M. Brackf13f77f2004-11-12 16:03:48 +000022723 ret_val = xmlValidateNCName((const xmlChar *)value, space);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022724 desret_int(ret_val);
22725 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000022726 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022727 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022728 xmlResetLastError();
22729 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022730 printf("Leak of %d blocks found in xmlValidateNCName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022731 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022732 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022733 printf(" %d", n_value);
22734 printf(" %d", n_space);
22735 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022736 }
22737 }
22738 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022739 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000022740#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000022741#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000022742
Daniel Veillard42595322004-11-08 10:52:06 +000022743 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022744}
22745
22746
22747static int
22748test_xmlValidateNMToken(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022749 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022750
William M. Brack21e4ef22005-01-02 09:53:13 +000022751#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000022752#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000022753 int mem_base;
22754 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022755 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022756 int n_value;
22757 int space; /* allow spaces in front and end of the string */
22758 int n_space;
22759
22760 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22761 for (n_space = 0;n_space < gen_nb_int;n_space++) {
22762 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022763 value = gen_const_xmlChar_ptr(n_value, 0);
22764 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022765
William M. Brackf13f77f2004-11-12 16:03:48 +000022766 ret_val = xmlValidateNMToken((const xmlChar *)value, space);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022767 desret_int(ret_val);
22768 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000022769 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022770 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022771 xmlResetLastError();
22772 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022773 printf("Leak of %d blocks found in xmlValidateNMToken",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022774 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022775 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022776 printf(" %d", n_value);
22777 printf(" %d", n_space);
22778 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022779 }
22780 }
22781 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022782 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000022783#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000022784#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000022785
Daniel Veillard42595322004-11-08 10:52:06 +000022786 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022787}
22788
22789
22790static int
22791test_xmlValidateName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022792 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022793
William M. Brack21e4ef22005-01-02 09:53:13 +000022794#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000022795#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000022796 int mem_base;
22797 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022798 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022799 int n_value;
22800 int space; /* allow spaces in front and end of the string */
22801 int n_space;
22802
22803 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22804 for (n_space = 0;n_space < gen_nb_int;n_space++) {
22805 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022806 value = gen_const_xmlChar_ptr(n_value, 0);
22807 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022808
William M. Brackf13f77f2004-11-12 16:03:48 +000022809 ret_val = xmlValidateName((const xmlChar *)value, space);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022810 desret_int(ret_val);
22811 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000022812 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022813 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022814 xmlResetLastError();
22815 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022816 printf("Leak of %d blocks found in xmlValidateName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022817 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022818 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022819 printf(" %d", n_value);
22820 printf(" %d", n_space);
22821 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022822 }
22823 }
22824 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022825 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000022826#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000022827#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000022828
Daniel Veillard42595322004-11-08 10:52:06 +000022829 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022830}
22831
22832
22833static int
22834test_xmlValidateQName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022835 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022836
William M. Brack21e4ef22005-01-02 09:53:13 +000022837#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000022838#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000022839 int mem_base;
22840 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022841 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022842 int n_value;
22843 int space; /* allow spaces in front and end of the string */
22844 int n_space;
22845
22846 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22847 for (n_space = 0;n_space < gen_nb_int;n_space++) {
22848 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022849 value = gen_const_xmlChar_ptr(n_value, 0);
22850 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022851
William M. Brackf13f77f2004-11-12 16:03:48 +000022852 ret_val = xmlValidateQName((const xmlChar *)value, space);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022853 desret_int(ret_val);
22854 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000022855 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022856 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022857 xmlResetLastError();
22858 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022859 printf("Leak of %d blocks found in xmlValidateQName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022860 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022861 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022862 printf(" %d", n_value);
22863 printf(" %d", n_space);
22864 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022865 }
22866 }
22867 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022868 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000022869#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000022870#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000022871
Daniel Veillard42595322004-11-08 10:52:06 +000022872 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022873}
22874
22875static int
22876test_tree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022877 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022878
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022879 if (quiet == 0) printf("Testing tree : 129 of 146 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000022880 test_ret += test_xmlAddChild();
22881 test_ret += test_xmlAddChildList();
22882 test_ret += test_xmlAddNextSibling();
22883 test_ret += test_xmlAddPrevSibling();
22884 test_ret += test_xmlAddSibling();
22885 test_ret += test_xmlAttrSerializeTxtContent();
22886 test_ret += test_xmlBufferAdd();
22887 test_ret += test_xmlBufferAddHead();
22888 test_ret += test_xmlBufferCCat();
22889 test_ret += test_xmlBufferCat();
22890 test_ret += test_xmlBufferContent();
22891 test_ret += test_xmlBufferCreate();
22892 test_ret += test_xmlBufferCreateSize();
22893 test_ret += test_xmlBufferCreateStatic();
22894 test_ret += test_xmlBufferEmpty();
22895 test_ret += test_xmlBufferGrow();
22896 test_ret += test_xmlBufferLength();
22897 test_ret += test_xmlBufferResize();
22898 test_ret += test_xmlBufferSetAllocationScheme();
22899 test_ret += test_xmlBufferShrink();
22900 test_ret += test_xmlBufferWriteCHAR();
22901 test_ret += test_xmlBufferWriteChar();
22902 test_ret += test_xmlBufferWriteQuotedString();
22903 test_ret += test_xmlBuildQName();
22904 test_ret += test_xmlCopyDoc();
22905 test_ret += test_xmlCopyDtd();
22906 test_ret += test_xmlCopyNamespace();
22907 test_ret += test_xmlCopyNamespaceList();
22908 test_ret += test_xmlCopyNode();
22909 test_ret += test_xmlCopyNodeList();
22910 test_ret += test_xmlCopyProp();
22911 test_ret += test_xmlCopyPropList();
22912 test_ret += test_xmlCreateIntSubset();
22913 test_ret += test_xmlDocCopyNode();
22914 test_ret += test_xmlDocCopyNodeList();
22915 test_ret += test_xmlDocDump();
22916 test_ret += test_xmlDocDumpFormatMemory();
22917 test_ret += test_xmlDocDumpFormatMemoryEnc();
22918 test_ret += test_xmlDocDumpMemory();
22919 test_ret += test_xmlDocDumpMemoryEnc();
22920 test_ret += test_xmlDocFormatDump();
22921 test_ret += test_xmlDocGetRootElement();
22922 test_ret += test_xmlDocSetRootElement();
22923 test_ret += test_xmlElemDump();
22924 test_ret += test_xmlGetBufferAllocationScheme();
22925 test_ret += test_xmlGetCompressMode();
22926 test_ret += test_xmlGetDocCompressMode();
22927 test_ret += test_xmlGetIntSubset();
22928 test_ret += test_xmlGetLastChild();
22929 test_ret += test_xmlGetLineNo();
22930 test_ret += test_xmlGetNoNsProp();
22931 test_ret += test_xmlGetNodePath();
22932 test_ret += test_xmlGetNsList();
22933 test_ret += test_xmlGetNsProp();
22934 test_ret += test_xmlGetProp();
22935 test_ret += test_xmlHasNsProp();
22936 test_ret += test_xmlHasProp();
22937 test_ret += test_xmlIsBlankNode();
22938 test_ret += test_xmlIsXHTML();
22939 test_ret += test_xmlNewCDataBlock();
22940 test_ret += test_xmlNewCharRef();
22941 test_ret += test_xmlNewChild();
22942 test_ret += test_xmlNewComment();
22943 test_ret += test_xmlNewDoc();
22944 test_ret += test_xmlNewDocComment();
22945 test_ret += test_xmlNewDocFragment();
22946 test_ret += test_xmlNewDocNode();
22947 test_ret += test_xmlNewDocNodeEatName();
22948 test_ret += test_xmlNewDocPI();
22949 test_ret += test_xmlNewDocProp();
22950 test_ret += test_xmlNewDocRawNode();
22951 test_ret += test_xmlNewDocText();
22952 test_ret += test_xmlNewDocTextLen();
22953 test_ret += test_xmlNewDtd();
22954 test_ret += test_xmlNewNode();
22955 test_ret += test_xmlNewNodeEatName();
22956 test_ret += test_xmlNewNs();
22957 test_ret += test_xmlNewNsProp();
22958 test_ret += test_xmlNewNsPropEatName();
22959 test_ret += test_xmlNewPI();
22960 test_ret += test_xmlNewProp();
22961 test_ret += test_xmlNewReference();
22962 test_ret += test_xmlNewText();
22963 test_ret += test_xmlNewTextChild();
22964 test_ret += test_xmlNewTextLen();
22965 test_ret += test_xmlNodeAddContent();
22966 test_ret += test_xmlNodeAddContentLen();
22967 test_ret += test_xmlNodeBufGetContent();
22968 test_ret += test_xmlNodeDump();
22969 test_ret += test_xmlNodeDumpOutput();
22970 test_ret += test_xmlNodeGetBase();
22971 test_ret += test_xmlNodeGetContent();
22972 test_ret += test_xmlNodeGetLang();
22973 test_ret += test_xmlNodeGetSpacePreserve();
22974 test_ret += test_xmlNodeIsText();
22975 test_ret += test_xmlNodeListGetRawString();
22976 test_ret += test_xmlNodeListGetString();
22977 test_ret += test_xmlNodeSetBase();
22978 test_ret += test_xmlNodeSetContent();
22979 test_ret += test_xmlNodeSetContentLen();
22980 test_ret += test_xmlNodeSetLang();
22981 test_ret += test_xmlNodeSetName();
22982 test_ret += test_xmlNodeSetSpacePreserve();
22983 test_ret += test_xmlReconciliateNs();
22984 test_ret += test_xmlRemoveProp();
22985 test_ret += test_xmlReplaceNode();
22986 test_ret += test_xmlSaveFile();
22987 test_ret += test_xmlSaveFileEnc();
22988 test_ret += test_xmlSaveFileTo();
22989 test_ret += test_xmlSaveFormatFile();
22990 test_ret += test_xmlSaveFormatFileEnc();
22991 test_ret += test_xmlSaveFormatFileTo();
22992 test_ret += test_xmlSearchNs();
22993 test_ret += test_xmlSearchNsByHref();
22994 test_ret += test_xmlSetBufferAllocationScheme();
22995 test_ret += test_xmlSetCompressMode();
22996 test_ret += test_xmlSetDocCompressMode();
22997 test_ret += test_xmlSetNs();
22998 test_ret += test_xmlSetNsProp();
22999 test_ret += test_xmlSetProp();
23000 test_ret += test_xmlSplitQName2();
23001 test_ret += test_xmlSplitQName3();
23002 test_ret += test_xmlStringGetNodeList();
23003 test_ret += test_xmlStringLenGetNodeList();
23004 test_ret += test_xmlTextConcat();
23005 test_ret += test_xmlTextMerge();
23006 test_ret += test_xmlUnsetNsProp();
23007 test_ret += test_xmlUnsetProp();
23008 test_ret += test_xmlValidateNCName();
23009 test_ret += test_xmlValidateNMToken();
23010 test_ret += test_xmlValidateName();
23011 test_ret += test_xmlValidateQName();
Daniel Veillardd93f6252004-11-02 15:53:51 +000023012
Daniel Veillard42595322004-11-08 10:52:06 +000023013 if (test_ret != 0)
23014 printf("Module tree: %d errors\n", test_ret);
23015 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023016}
23017
23018static int
23019test_xmlBuildRelativeURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023020 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023021
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023022 int mem_base;
23023 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023024 xmlChar * URI; /* the URI reference under consideration */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023025 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023026 xmlChar * base; /* the base value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023027 int n_base;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023028
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023029 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
23030 for (n_base = 0;n_base < gen_nb_const_xmlChar_ptr;n_base++) {
23031 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023032 URI = gen_const_xmlChar_ptr(n_URI, 0);
23033 base = gen_const_xmlChar_ptr(n_base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023034
William M. Brackf13f77f2004-11-12 16:03:48 +000023035 ret_val = xmlBuildRelativeURI((const xmlChar *)URI, (const xmlChar *)base);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023036 desret_xmlChar_ptr(ret_val);
23037 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023038 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0);
23039 des_const_xmlChar_ptr(n_base, (const xmlChar *)base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023040 xmlResetLastError();
23041 if (mem_base != xmlMemBlocks()) {
23042 printf("Leak of %d blocks found in xmlBuildRelativeURI",
23043 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023044 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023045 printf(" %d", n_URI);
23046 printf(" %d", n_base);
23047 printf("\n");
23048 }
23049 }
23050 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023051 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023052
Daniel Veillard42595322004-11-08 10:52:06 +000023053 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023054}
23055
23056
23057static int
23058test_xmlBuildURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023059 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023060
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023061 int mem_base;
23062 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023063 xmlChar * URI; /* the URI instance found in the document */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023064 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023065 xmlChar * base; /* the base value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023066 int n_base;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023067
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023068 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
23069 for (n_base = 0;n_base < gen_nb_const_xmlChar_ptr;n_base++) {
23070 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023071 URI = gen_const_xmlChar_ptr(n_URI, 0);
23072 base = gen_const_xmlChar_ptr(n_base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023073
William M. Brackf13f77f2004-11-12 16:03:48 +000023074 ret_val = xmlBuildURI((const xmlChar *)URI, (const xmlChar *)base);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023075 desret_xmlChar_ptr(ret_val);
23076 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023077 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0);
23078 des_const_xmlChar_ptr(n_base, (const xmlChar *)base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023079 xmlResetLastError();
23080 if (mem_base != xmlMemBlocks()) {
23081 printf("Leak of %d blocks found in xmlBuildURI",
23082 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023083 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023084 printf(" %d", n_URI);
23085 printf(" %d", n_base);
23086 printf("\n");
23087 }
23088 }
23089 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023090 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023091
Daniel Veillard42595322004-11-08 10:52:06 +000023092 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023093}
23094
23095
23096static int
23097test_xmlCanonicPath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023098 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023099
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023100 int mem_base;
23101 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023102 xmlChar * path; /* the resource locator in a filesystem notation */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023103 int n_path;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023104
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023105 for (n_path = 0;n_path < gen_nb_const_xmlChar_ptr;n_path++) {
23106 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023107 path = gen_const_xmlChar_ptr(n_path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023108
William M. Brackf13f77f2004-11-12 16:03:48 +000023109 ret_val = xmlCanonicPath((const xmlChar *)path);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023110 desret_xmlChar_ptr(ret_val);
23111 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023112 des_const_xmlChar_ptr(n_path, (const xmlChar *)path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023113 xmlResetLastError();
23114 if (mem_base != xmlMemBlocks()) {
23115 printf("Leak of %d blocks found in xmlCanonicPath",
23116 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023117 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023118 printf(" %d", n_path);
23119 printf("\n");
23120 }
23121 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023122 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023123
Daniel Veillard42595322004-11-08 10:52:06 +000023124 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023125}
23126
23127
23128static int
23129test_xmlCreateURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023130 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023131
23132
23133 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023134 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023135}
23136
23137
23138static int
23139test_xmlNormalizeURIPath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023140 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023141
Daniel Veillardce682bc2004-11-05 17:22:25 +000023142 int mem_base;
23143 int ret_val;
23144 char * path; /* pointer to the path string */
23145 int n_path;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023146
Daniel Veillardce682bc2004-11-05 17:22:25 +000023147 for (n_path = 0;n_path < gen_nb_char_ptr;n_path++) {
23148 mem_base = xmlMemBlocks();
23149 path = gen_char_ptr(n_path, 0);
23150
23151 ret_val = xmlNormalizeURIPath(path);
23152 desret_int(ret_val);
23153 call_tests++;
23154 des_char_ptr(n_path, path, 0);
23155 xmlResetLastError();
23156 if (mem_base != xmlMemBlocks()) {
23157 printf("Leak of %d blocks found in xmlNormalizeURIPath",
23158 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023159 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023160 printf(" %d", n_path);
23161 printf("\n");
23162 }
23163 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000023164 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023165
Daniel Veillard42595322004-11-08 10:52:06 +000023166 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023167}
23168
23169
23170static int
23171test_xmlParseURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023172 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023173
23174
23175 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023176 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023177}
23178
23179
Daniel Veillardce682bc2004-11-05 17:22:25 +000023180#define gen_nb_xmlURIPtr 1
23181static xmlURIPtr gen_xmlURIPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23182 return(NULL);
23183}
23184static void des_xmlURIPtr(int no ATTRIBUTE_UNUSED, xmlURIPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23185}
23186
Daniel Veillardd93f6252004-11-02 15:53:51 +000023187static int
23188test_xmlParseURIReference(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023189 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023190
Daniel Veillardce682bc2004-11-05 17:22:25 +000023191 int mem_base;
23192 int ret_val;
23193 xmlURIPtr uri; /* pointer to an URI structure */
23194 int n_uri;
23195 char * str; /* the string to analyze */
23196 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023197
Daniel Veillardce682bc2004-11-05 17:22:25 +000023198 for (n_uri = 0;n_uri < gen_nb_xmlURIPtr;n_uri++) {
23199 for (n_str = 0;n_str < gen_nb_const_char_ptr;n_str++) {
23200 mem_base = xmlMemBlocks();
23201 uri = gen_xmlURIPtr(n_uri, 0);
23202 str = gen_const_char_ptr(n_str, 1);
23203
William M. Brackf13f77f2004-11-12 16:03:48 +000023204 ret_val = xmlParseURIReference(uri, (const char *)str);
Daniel Veillardce682bc2004-11-05 17:22:25 +000023205 desret_int(ret_val);
23206 call_tests++;
23207 des_xmlURIPtr(n_uri, uri, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000023208 des_const_char_ptr(n_str, (const char *)str, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000023209 xmlResetLastError();
23210 if (mem_base != xmlMemBlocks()) {
23211 printf("Leak of %d blocks found in xmlParseURIReference",
23212 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023213 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023214 printf(" %d", n_uri);
23215 printf(" %d", n_str);
23216 printf("\n");
23217 }
23218 }
23219 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000023220 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023221
Daniel Veillard42595322004-11-08 10:52:06 +000023222 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023223}
23224
23225
23226static int
23227test_xmlPrintURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023228 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023229
Daniel Veillardce682bc2004-11-05 17:22:25 +000023230 int mem_base;
23231 FILE * stream; /* a FILE* for the output */
23232 int n_stream;
23233 xmlURIPtr uri; /* pointer to an xmlURI */
23234 int n_uri;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023235
Daniel Veillardce682bc2004-11-05 17:22:25 +000023236 for (n_stream = 0;n_stream < gen_nb_FILE_ptr;n_stream++) {
23237 for (n_uri = 0;n_uri < gen_nb_xmlURIPtr;n_uri++) {
23238 mem_base = xmlMemBlocks();
23239 stream = gen_FILE_ptr(n_stream, 0);
23240 uri = gen_xmlURIPtr(n_uri, 1);
23241
23242 xmlPrintURI(stream, uri);
23243 call_tests++;
23244 des_FILE_ptr(n_stream, stream, 0);
23245 des_xmlURIPtr(n_uri, uri, 1);
23246 xmlResetLastError();
23247 if (mem_base != xmlMemBlocks()) {
23248 printf("Leak of %d blocks found in xmlPrintURI",
23249 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023250 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023251 printf(" %d", n_stream);
23252 printf(" %d", n_uri);
23253 printf("\n");
23254 }
23255 }
23256 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000023257 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023258
Daniel Veillard42595322004-11-08 10:52:06 +000023259 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023260}
23261
23262
23263static int
23264test_xmlSaveUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023265 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023266
Daniel Veillardce682bc2004-11-05 17:22:25 +000023267 int mem_base;
23268 xmlChar * ret_val;
23269 xmlURIPtr uri; /* pointer to an xmlURI */
23270 int n_uri;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023271
Daniel Veillardce682bc2004-11-05 17:22:25 +000023272 for (n_uri = 0;n_uri < gen_nb_xmlURIPtr;n_uri++) {
23273 mem_base = xmlMemBlocks();
23274 uri = gen_xmlURIPtr(n_uri, 0);
23275
23276 ret_val = xmlSaveUri(uri);
23277 desret_xmlChar_ptr(ret_val);
23278 call_tests++;
23279 des_xmlURIPtr(n_uri, uri, 0);
23280 xmlResetLastError();
23281 if (mem_base != xmlMemBlocks()) {
23282 printf("Leak of %d blocks found in xmlSaveUri",
23283 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023284 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023285 printf(" %d", n_uri);
23286 printf("\n");
23287 }
23288 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000023289 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023290
Daniel Veillard42595322004-11-08 10:52:06 +000023291 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023292}
23293
23294
23295static int
23296test_xmlURIEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023297 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023298
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023299 int mem_base;
23300 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023301 xmlChar * str; /* the string of the URI to escape */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023302 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023303
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023304 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
23305 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023306 str = gen_const_xmlChar_ptr(n_str, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023307
William M. Brackf13f77f2004-11-12 16:03:48 +000023308 ret_val = xmlURIEscape((const xmlChar *)str);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023309 desret_xmlChar_ptr(ret_val);
23310 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023311 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023312 xmlResetLastError();
23313 if (mem_base != xmlMemBlocks()) {
23314 printf("Leak of %d blocks found in xmlURIEscape",
23315 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023316 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023317 printf(" %d", n_str);
23318 printf("\n");
23319 }
23320 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023321 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023322
Daniel Veillard42595322004-11-08 10:52:06 +000023323 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023324}
23325
23326
23327static int
23328test_xmlURIEscapeStr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023329 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023330
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023331 int mem_base;
23332 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023333 xmlChar * str; /* string to escape */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023334 int n_str;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023335 xmlChar * list; /* exception list string of chars not to escape */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023336 int n_list;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023337
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023338 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
23339 for (n_list = 0;n_list < gen_nb_const_xmlChar_ptr;n_list++) {
23340 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023341 str = gen_const_xmlChar_ptr(n_str, 0);
23342 list = gen_const_xmlChar_ptr(n_list, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023343
William M. Brackf13f77f2004-11-12 16:03:48 +000023344 ret_val = xmlURIEscapeStr((const xmlChar *)str, (const xmlChar *)list);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023345 desret_xmlChar_ptr(ret_val);
23346 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023347 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
23348 des_const_xmlChar_ptr(n_list, (const xmlChar *)list, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023349 xmlResetLastError();
23350 if (mem_base != xmlMemBlocks()) {
23351 printf("Leak of %d blocks found in xmlURIEscapeStr",
23352 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023353 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023354 printf(" %d", n_str);
23355 printf(" %d", n_list);
23356 printf("\n");
23357 }
23358 }
23359 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023360 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023361
Daniel Veillard42595322004-11-08 10:52:06 +000023362 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023363}
23364
23365
23366static int
23367test_xmlURIUnescapeString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023368 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023369
23370
23371 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023372 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023373}
23374
23375static int
23376test_uri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023377 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023378
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023379 if (quiet == 0) printf("Testing uri : 9 of 13 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000023380 test_ret += test_xmlBuildRelativeURI();
23381 test_ret += test_xmlBuildURI();
23382 test_ret += test_xmlCanonicPath();
23383 test_ret += test_xmlCreateURI();
23384 test_ret += test_xmlNormalizeURIPath();
23385 test_ret += test_xmlParseURI();
23386 test_ret += test_xmlParseURIReference();
23387 test_ret += test_xmlPrintURI();
23388 test_ret += test_xmlSaveUri();
23389 test_ret += test_xmlURIEscape();
23390 test_ret += test_xmlURIEscapeStr();
23391 test_ret += test_xmlURIUnescapeString();
Daniel Veillardd93f6252004-11-02 15:53:51 +000023392
Daniel Veillard42595322004-11-08 10:52:06 +000023393 if (test_ret != 0)
23394 printf("Module uri: %d errors\n", test_ret);
23395 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023396}
23397
23398static int
23399test_xmlAddAttributeDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023400 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023401
Daniel Veillard42595322004-11-08 10:52:06 +000023402 int mem_base;
23403 xmlAttributePtr ret_val;
23404 xmlValidCtxtPtr ctxt; /* the validation context */
23405 int n_ctxt;
23406 xmlDtdPtr dtd; /* pointer to the DTD */
23407 int n_dtd;
23408 xmlChar * elem; /* the element name */
23409 int n_elem;
23410 xmlChar * name; /* the attribute name */
23411 int n_name;
23412 xmlChar * ns; /* the attribute namespace prefix */
23413 int n_ns;
23414 xmlAttributeType type; /* the attribute type */
23415 int n_type;
23416 xmlAttributeDefault def; /* the attribute default type */
23417 int n_def;
23418 xmlChar * defaultValue; /* the attribute default value */
23419 int n_defaultValue;
23420 xmlEnumerationPtr tree; /* if it's an enumeration, the associated list */
23421 int n_tree;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023422
Daniel Veillard42595322004-11-08 10:52:06 +000023423 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
23424 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
23425 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
23426 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
23427 for (n_ns = 0;n_ns < gen_nb_const_xmlChar_ptr;n_ns++) {
23428 for (n_type = 0;n_type < gen_nb_xmlAttributeType;n_type++) {
23429 for (n_def = 0;n_def < gen_nb_xmlAttributeDefault;n_def++) {
23430 for (n_defaultValue = 0;n_defaultValue < gen_nb_const_xmlChar_ptr;n_defaultValue++) {
23431 for (n_tree = 0;n_tree < gen_nb_xmlEnumerationPtr;n_tree++) {
23432 mem_base = xmlMemBlocks();
23433 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
23434 dtd = gen_xmlDtdPtr(n_dtd, 1);
23435 elem = gen_const_xmlChar_ptr(n_elem, 2);
23436 name = gen_const_xmlChar_ptr(n_name, 3);
23437 ns = gen_const_xmlChar_ptr(n_ns, 4);
23438 type = gen_xmlAttributeType(n_type, 5);
23439 def = gen_xmlAttributeDefault(n_def, 6);
23440 defaultValue = gen_const_xmlChar_ptr(n_defaultValue, 7);
23441 tree = gen_xmlEnumerationPtr(n_tree, 8);
23442
William M. Brackf13f77f2004-11-12 16:03:48 +000023443 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 +000023444 desret_xmlAttributePtr(ret_val);
23445 call_tests++;
23446 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
23447 des_xmlDtdPtr(n_dtd, dtd, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000023448 des_const_xmlChar_ptr(n_elem, (const xmlChar *)elem, 2);
23449 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 3);
23450 des_const_xmlChar_ptr(n_ns, (const xmlChar *)ns, 4);
Daniel Veillard42595322004-11-08 10:52:06 +000023451 des_xmlAttributeType(n_type, type, 5);
23452 des_xmlAttributeDefault(n_def, def, 6);
William M. Brackf13f77f2004-11-12 16:03:48 +000023453 des_const_xmlChar_ptr(n_defaultValue, (const xmlChar *)defaultValue, 7);
Daniel Veillard42595322004-11-08 10:52:06 +000023454 des_xmlEnumerationPtr(n_tree, tree, 8);
23455 xmlResetLastError();
23456 if (mem_base != xmlMemBlocks()) {
23457 printf("Leak of %d blocks found in xmlAddAttributeDecl",
23458 xmlMemBlocks() - mem_base);
23459 test_ret++;
23460 printf(" %d", n_ctxt);
23461 printf(" %d", n_dtd);
23462 printf(" %d", n_elem);
23463 printf(" %d", n_name);
23464 printf(" %d", n_ns);
23465 printf(" %d", n_type);
23466 printf(" %d", n_def);
23467 printf(" %d", n_defaultValue);
23468 printf(" %d", n_tree);
23469 printf("\n");
23470 }
23471 }
23472 }
23473 }
23474 }
23475 }
23476 }
23477 }
23478 }
23479 }
Daniel Veillard42595322004-11-08 10:52:06 +000023480 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023481
Daniel Veillard42595322004-11-08 10:52:06 +000023482 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023483}
23484
23485
23486static int
23487test_xmlAddElementDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023488 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023489
Daniel Veillard42595322004-11-08 10:52:06 +000023490 int mem_base;
23491 xmlElementPtr ret_val;
23492 xmlValidCtxtPtr ctxt; /* the validation context */
23493 int n_ctxt;
23494 xmlDtdPtr dtd; /* pointer to the DTD */
23495 int n_dtd;
23496 xmlChar * name; /* the entity name */
23497 int n_name;
23498 xmlElementTypeVal type; /* the element type */
23499 int n_type;
23500 xmlElementContentPtr content; /* the element content tree or NULL */
23501 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023502
Daniel Veillard42595322004-11-08 10:52:06 +000023503 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
23504 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
23505 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
23506 for (n_type = 0;n_type < gen_nb_xmlElementTypeVal;n_type++) {
23507 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
23508 mem_base = xmlMemBlocks();
23509 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
23510 dtd = gen_xmlDtdPtr(n_dtd, 1);
23511 name = gen_const_xmlChar_ptr(n_name, 2);
23512 type = gen_xmlElementTypeVal(n_type, 3);
23513 content = gen_xmlElementContentPtr(n_content, 4);
23514
William M. Brackf13f77f2004-11-12 16:03:48 +000023515 ret_val = xmlAddElementDecl(ctxt, dtd, (const xmlChar *)name, type, content);
Daniel Veillard42595322004-11-08 10:52:06 +000023516 desret_xmlElementPtr(ret_val);
23517 call_tests++;
23518 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
23519 des_xmlDtdPtr(n_dtd, dtd, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000023520 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillard42595322004-11-08 10:52:06 +000023521 des_xmlElementTypeVal(n_type, type, 3);
23522 des_xmlElementContentPtr(n_content, content, 4);
23523 xmlResetLastError();
23524 if (mem_base != xmlMemBlocks()) {
23525 printf("Leak of %d blocks found in xmlAddElementDecl",
23526 xmlMemBlocks() - mem_base);
23527 test_ret++;
23528 printf(" %d", n_ctxt);
23529 printf(" %d", n_dtd);
23530 printf(" %d", n_name);
23531 printf(" %d", n_type);
23532 printf(" %d", n_content);
23533 printf("\n");
23534 }
23535 }
23536 }
23537 }
23538 }
23539 }
Daniel Veillard42595322004-11-08 10:52:06 +000023540 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023541
Daniel Veillard42595322004-11-08 10:52:06 +000023542 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023543}
23544
23545
23546static int
23547test_xmlAddID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023548 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023549
23550
23551 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023552 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023553}
23554
23555
23556static int
23557test_xmlAddNotationDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023558 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023559
23560
23561 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023562 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023563}
23564
23565
23566static int
23567test_xmlAddRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023568 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023569
23570
23571 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023572 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023573}
23574
23575
Daniel Veillardce682bc2004-11-05 17:22:25 +000023576#define gen_nb_xmlAttributeTablePtr 1
23577static xmlAttributeTablePtr gen_xmlAttributeTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23578 return(NULL);
23579}
23580static void des_xmlAttributeTablePtr(int no ATTRIBUTE_UNUSED, xmlAttributeTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23581}
23582
Daniel Veillardd93f6252004-11-02 15:53:51 +000023583static int
23584test_xmlCopyAttributeTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023585 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023586
23587
23588 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023589 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023590}
23591
23592
23593static int
23594test_xmlCopyElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023595 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023596
William M. Brack094dd862004-11-14 14:28:34 +000023597 int mem_base;
23598 xmlElementContentPtr ret_val;
23599 xmlElementContentPtr cur; /* An element content pointer. */
23600 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023601
William M. Brack094dd862004-11-14 14:28:34 +000023602 for (n_cur = 0;n_cur < gen_nb_xmlElementContentPtr;n_cur++) {
23603 mem_base = xmlMemBlocks();
23604 cur = gen_xmlElementContentPtr(n_cur, 0);
23605
23606 ret_val = xmlCopyElementContent(cur);
23607 desret_xmlElementContentPtr(ret_val);
23608 call_tests++;
23609 des_xmlElementContentPtr(n_cur, cur, 0);
23610 xmlResetLastError();
23611 if (mem_base != xmlMemBlocks()) {
23612 printf("Leak of %d blocks found in xmlCopyElementContent",
23613 xmlMemBlocks() - mem_base);
23614 test_ret++;
23615 printf(" %d", n_cur);
23616 printf("\n");
23617 }
23618 }
23619 function_tests++;
23620
Daniel Veillard42595322004-11-08 10:52:06 +000023621 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023622}
23623
23624
Daniel Veillardce682bc2004-11-05 17:22:25 +000023625#define gen_nb_xmlElementTablePtr 1
23626static xmlElementTablePtr gen_xmlElementTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23627 return(NULL);
23628}
23629static void des_xmlElementTablePtr(int no ATTRIBUTE_UNUSED, xmlElementTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23630}
23631
Daniel Veillardd93f6252004-11-02 15:53:51 +000023632static int
23633test_xmlCopyElementTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023634 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023635
23636
23637 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023638 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023639}
23640
23641
23642static int
23643test_xmlCopyEnumeration(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023644 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023645
23646
23647 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023648 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023649}
23650
23651
Daniel Veillardce682bc2004-11-05 17:22:25 +000023652#define gen_nb_xmlNotationTablePtr 1
23653static xmlNotationTablePtr gen_xmlNotationTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23654 return(NULL);
23655}
23656static void des_xmlNotationTablePtr(int no ATTRIBUTE_UNUSED, xmlNotationTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23657}
23658
Daniel Veillardd93f6252004-11-02 15:53:51 +000023659static int
23660test_xmlCopyNotationTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023661 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023662
23663
23664 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023665 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023666}
23667
23668
23669static int
23670test_xmlCreateEnumeration(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023671 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023672
23673
23674 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023675 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023676}
23677
23678
Daniel Veillardce682bc2004-11-05 17:22:25 +000023679#define gen_nb_xmlAttributePtr 1
23680static xmlAttributePtr gen_xmlAttributePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23681 return(NULL);
23682}
23683static void des_xmlAttributePtr(int no ATTRIBUTE_UNUSED, xmlAttributePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23684}
23685
Daniel Veillardd93f6252004-11-02 15:53:51 +000023686static int
23687test_xmlDumpAttributeDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023688 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023689
William M. Brack21e4ef22005-01-02 09:53:13 +000023690#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000023691 int mem_base;
23692 xmlBufferPtr buf; /* the XML buffer output */
23693 int n_buf;
23694 xmlAttributePtr attr; /* An attribute declaration */
23695 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023696
Daniel Veillardce682bc2004-11-05 17:22:25 +000023697 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23698 for (n_attr = 0;n_attr < gen_nb_xmlAttributePtr;n_attr++) {
23699 mem_base = xmlMemBlocks();
23700 buf = gen_xmlBufferPtr(n_buf, 0);
23701 attr = gen_xmlAttributePtr(n_attr, 1);
23702
23703 xmlDumpAttributeDecl(buf, attr);
23704 call_tests++;
23705 des_xmlBufferPtr(n_buf, buf, 0);
23706 des_xmlAttributePtr(n_attr, attr, 1);
23707 xmlResetLastError();
23708 if (mem_base != xmlMemBlocks()) {
23709 printf("Leak of %d blocks found in xmlDumpAttributeDecl",
23710 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023711 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023712 printf(" %d", n_buf);
23713 printf(" %d", n_attr);
23714 printf("\n");
23715 }
23716 }
23717 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023718 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023719#endif
23720
Daniel Veillard42595322004-11-08 10:52:06 +000023721 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023722}
23723
23724
23725static int
23726test_xmlDumpAttributeTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023727 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023728
William M. Brack21e4ef22005-01-02 09:53:13 +000023729#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000023730 int mem_base;
23731 xmlBufferPtr buf; /* the XML buffer output */
23732 int n_buf;
23733 xmlAttributeTablePtr table; /* An attribute table */
23734 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023735
Daniel Veillardce682bc2004-11-05 17:22:25 +000023736 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23737 for (n_table = 0;n_table < gen_nb_xmlAttributeTablePtr;n_table++) {
23738 mem_base = xmlMemBlocks();
23739 buf = gen_xmlBufferPtr(n_buf, 0);
23740 table = gen_xmlAttributeTablePtr(n_table, 1);
23741
23742 xmlDumpAttributeTable(buf, table);
23743 call_tests++;
23744 des_xmlBufferPtr(n_buf, buf, 0);
23745 des_xmlAttributeTablePtr(n_table, table, 1);
23746 xmlResetLastError();
23747 if (mem_base != xmlMemBlocks()) {
23748 printf("Leak of %d blocks found in xmlDumpAttributeTable",
23749 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023750 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023751 printf(" %d", n_buf);
23752 printf(" %d", n_table);
23753 printf("\n");
23754 }
23755 }
23756 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023757 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023758#endif
23759
Daniel Veillard42595322004-11-08 10:52:06 +000023760 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023761}
23762
23763
Daniel Veillardce682bc2004-11-05 17:22:25 +000023764#define gen_nb_xmlElementPtr 1
23765static xmlElementPtr gen_xmlElementPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23766 return(NULL);
23767}
23768static void des_xmlElementPtr(int no ATTRIBUTE_UNUSED, xmlElementPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23769}
23770
Daniel Veillardd93f6252004-11-02 15:53:51 +000023771static int
23772test_xmlDumpElementDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023773 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023774
William M. Brack21e4ef22005-01-02 09:53:13 +000023775#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000023776 int mem_base;
23777 xmlBufferPtr buf; /* the XML buffer output */
23778 int n_buf;
23779 xmlElementPtr elem; /* An element table */
23780 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023781
Daniel Veillardce682bc2004-11-05 17:22:25 +000023782 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23783 for (n_elem = 0;n_elem < gen_nb_xmlElementPtr;n_elem++) {
23784 mem_base = xmlMemBlocks();
23785 buf = gen_xmlBufferPtr(n_buf, 0);
23786 elem = gen_xmlElementPtr(n_elem, 1);
23787
23788 xmlDumpElementDecl(buf, elem);
23789 call_tests++;
23790 des_xmlBufferPtr(n_buf, buf, 0);
23791 des_xmlElementPtr(n_elem, elem, 1);
23792 xmlResetLastError();
23793 if (mem_base != xmlMemBlocks()) {
23794 printf("Leak of %d blocks found in xmlDumpElementDecl",
23795 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023796 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023797 printf(" %d", n_buf);
23798 printf(" %d", n_elem);
23799 printf("\n");
23800 }
23801 }
23802 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023803 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023804#endif
23805
Daniel Veillard42595322004-11-08 10:52:06 +000023806 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023807}
23808
23809
23810static int
23811test_xmlDumpElementTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023812 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023813
William M. Brack21e4ef22005-01-02 09:53:13 +000023814#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000023815 int mem_base;
23816 xmlBufferPtr buf; /* the XML buffer output */
23817 int n_buf;
23818 xmlElementTablePtr table; /* An element table */
23819 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023820
Daniel Veillardce682bc2004-11-05 17:22:25 +000023821 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23822 for (n_table = 0;n_table < gen_nb_xmlElementTablePtr;n_table++) {
23823 mem_base = xmlMemBlocks();
23824 buf = gen_xmlBufferPtr(n_buf, 0);
23825 table = gen_xmlElementTablePtr(n_table, 1);
23826
23827 xmlDumpElementTable(buf, table);
23828 call_tests++;
23829 des_xmlBufferPtr(n_buf, buf, 0);
23830 des_xmlElementTablePtr(n_table, table, 1);
23831 xmlResetLastError();
23832 if (mem_base != xmlMemBlocks()) {
23833 printf("Leak of %d blocks found in xmlDumpElementTable",
23834 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023835 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023836 printf(" %d", n_buf);
23837 printf(" %d", n_table);
23838 printf("\n");
23839 }
23840 }
23841 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023842 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023843#endif
23844
Daniel Veillard42595322004-11-08 10:52:06 +000023845 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023846}
23847
23848
Daniel Veillardce682bc2004-11-05 17:22:25 +000023849#define gen_nb_xmlNotationPtr 1
23850static xmlNotationPtr gen_xmlNotationPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23851 return(NULL);
23852}
23853static void des_xmlNotationPtr(int no ATTRIBUTE_UNUSED, xmlNotationPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23854}
23855
Daniel Veillardd93f6252004-11-02 15:53:51 +000023856static int
23857test_xmlDumpNotationDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023858 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023859
William M. Brack21e4ef22005-01-02 09:53:13 +000023860#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000023861 int mem_base;
23862 xmlBufferPtr buf; /* the XML buffer output */
23863 int n_buf;
23864 xmlNotationPtr nota; /* A notation declaration */
23865 int n_nota;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023866
Daniel Veillardce682bc2004-11-05 17:22:25 +000023867 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23868 for (n_nota = 0;n_nota < gen_nb_xmlNotationPtr;n_nota++) {
23869 mem_base = xmlMemBlocks();
23870 buf = gen_xmlBufferPtr(n_buf, 0);
23871 nota = gen_xmlNotationPtr(n_nota, 1);
23872
23873 xmlDumpNotationDecl(buf, nota);
23874 call_tests++;
23875 des_xmlBufferPtr(n_buf, buf, 0);
23876 des_xmlNotationPtr(n_nota, nota, 1);
23877 xmlResetLastError();
23878 if (mem_base != xmlMemBlocks()) {
23879 printf("Leak of %d blocks found in xmlDumpNotationDecl",
23880 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023881 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023882 printf(" %d", n_buf);
23883 printf(" %d", n_nota);
23884 printf("\n");
23885 }
23886 }
23887 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023888 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023889#endif
23890
Daniel Veillard42595322004-11-08 10:52:06 +000023891 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023892}
23893
23894
23895static int
23896test_xmlDumpNotationTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023897 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023898
William M. Brack21e4ef22005-01-02 09:53:13 +000023899#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000023900 int mem_base;
23901 xmlBufferPtr buf; /* the XML buffer output */
23902 int n_buf;
23903 xmlNotationTablePtr table; /* A notation table */
23904 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023905
Daniel Veillardce682bc2004-11-05 17:22:25 +000023906 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23907 for (n_table = 0;n_table < gen_nb_xmlNotationTablePtr;n_table++) {
23908 mem_base = xmlMemBlocks();
23909 buf = gen_xmlBufferPtr(n_buf, 0);
23910 table = gen_xmlNotationTablePtr(n_table, 1);
23911
23912 xmlDumpNotationTable(buf, table);
23913 call_tests++;
23914 des_xmlBufferPtr(n_buf, buf, 0);
23915 des_xmlNotationTablePtr(n_table, table, 1);
23916 xmlResetLastError();
23917 if (mem_base != xmlMemBlocks()) {
23918 printf("Leak of %d blocks found in xmlDumpNotationTable",
23919 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023920 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023921 printf(" %d", n_buf);
23922 printf(" %d", n_table);
23923 printf("\n");
23924 }
23925 }
23926 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023927 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023928#endif
23929
Daniel Veillard42595322004-11-08 10:52:06 +000023930 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023931}
23932
23933
23934static int
23935test_xmlGetDtdAttrDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023936 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023937
Daniel Veillard42595322004-11-08 10:52:06 +000023938 int mem_base;
23939 xmlAttributePtr ret_val;
23940 xmlDtdPtr dtd; /* a pointer to the DtD to search */
23941 int n_dtd;
23942 xmlChar * elem; /* the element name */
23943 int n_elem;
23944 xmlChar * name; /* the attribute name */
23945 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023946
Daniel Veillard42595322004-11-08 10:52:06 +000023947 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
23948 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
23949 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
23950 mem_base = xmlMemBlocks();
23951 dtd = gen_xmlDtdPtr(n_dtd, 0);
23952 elem = gen_const_xmlChar_ptr(n_elem, 1);
23953 name = gen_const_xmlChar_ptr(n_name, 2);
23954
William M. Brackf13f77f2004-11-12 16:03:48 +000023955 ret_val = xmlGetDtdAttrDesc(dtd, (const xmlChar *)elem, (const xmlChar *)name);
Daniel Veillard42595322004-11-08 10:52:06 +000023956 desret_xmlAttributePtr(ret_val);
23957 call_tests++;
23958 des_xmlDtdPtr(n_dtd, dtd, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000023959 des_const_xmlChar_ptr(n_elem, (const xmlChar *)elem, 1);
23960 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillard42595322004-11-08 10:52:06 +000023961 xmlResetLastError();
23962 if (mem_base != xmlMemBlocks()) {
23963 printf("Leak of %d blocks found in xmlGetDtdAttrDesc",
23964 xmlMemBlocks() - mem_base);
23965 test_ret++;
23966 printf(" %d", n_dtd);
23967 printf(" %d", n_elem);
23968 printf(" %d", n_name);
23969 printf("\n");
23970 }
23971 }
23972 }
23973 }
Daniel Veillard42595322004-11-08 10:52:06 +000023974 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023975
Daniel Veillard42595322004-11-08 10:52:06 +000023976 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023977}
23978
23979
23980static int
23981test_xmlGetDtdElementDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023982 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023983
Daniel Veillard42595322004-11-08 10:52:06 +000023984 int mem_base;
23985 xmlElementPtr ret_val;
23986 xmlDtdPtr dtd; /* a pointer to the DtD to search */
23987 int n_dtd;
23988 xmlChar * name; /* the element name */
23989 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023990
Daniel Veillard42595322004-11-08 10:52:06 +000023991 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
23992 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
23993 mem_base = xmlMemBlocks();
23994 dtd = gen_xmlDtdPtr(n_dtd, 0);
23995 name = gen_const_xmlChar_ptr(n_name, 1);
23996
William M. Brackf13f77f2004-11-12 16:03:48 +000023997 ret_val = xmlGetDtdElementDesc(dtd, (const xmlChar *)name);
Daniel Veillard42595322004-11-08 10:52:06 +000023998 desret_xmlElementPtr(ret_val);
23999 call_tests++;
24000 des_xmlDtdPtr(n_dtd, dtd, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024001 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000024002 xmlResetLastError();
24003 if (mem_base != xmlMemBlocks()) {
24004 printf("Leak of %d blocks found in xmlGetDtdElementDesc",
24005 xmlMemBlocks() - mem_base);
24006 test_ret++;
24007 printf(" %d", n_dtd);
24008 printf(" %d", n_name);
24009 printf("\n");
24010 }
24011 }
24012 }
Daniel Veillard42595322004-11-08 10:52:06 +000024013 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024014
Daniel Veillard42595322004-11-08 10:52:06 +000024015 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024016}
24017
24018
24019static int
24020test_xmlGetDtdNotationDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024021 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024022
24023
24024 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000024025 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024026}
24027
24028
24029static int
24030test_xmlGetDtdQAttrDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024031 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024032
Daniel Veillard42595322004-11-08 10:52:06 +000024033 int mem_base;
24034 xmlAttributePtr ret_val;
24035 xmlDtdPtr dtd; /* a pointer to the DtD to search */
24036 int n_dtd;
24037 xmlChar * elem; /* the element name */
24038 int n_elem;
24039 xmlChar * name; /* the attribute name */
24040 int n_name;
24041 xmlChar * prefix; /* the attribute namespace prefix */
24042 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024043
Daniel Veillard42595322004-11-08 10:52:06 +000024044 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
24045 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
24046 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24047 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
24048 mem_base = xmlMemBlocks();
24049 dtd = gen_xmlDtdPtr(n_dtd, 0);
24050 elem = gen_const_xmlChar_ptr(n_elem, 1);
24051 name = gen_const_xmlChar_ptr(n_name, 2);
24052 prefix = gen_const_xmlChar_ptr(n_prefix, 3);
24053
William M. Brackf13f77f2004-11-12 16:03:48 +000024054 ret_val = xmlGetDtdQAttrDesc(dtd, (const xmlChar *)elem, (const xmlChar *)name, (const xmlChar *)prefix);
Daniel Veillard42595322004-11-08 10:52:06 +000024055 desret_xmlAttributePtr(ret_val);
24056 call_tests++;
24057 des_xmlDtdPtr(n_dtd, dtd, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024058 des_const_xmlChar_ptr(n_elem, (const xmlChar *)elem, 1);
24059 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
24060 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000024061 xmlResetLastError();
24062 if (mem_base != xmlMemBlocks()) {
24063 printf("Leak of %d blocks found in xmlGetDtdQAttrDesc",
24064 xmlMemBlocks() - mem_base);
24065 test_ret++;
24066 printf(" %d", n_dtd);
24067 printf(" %d", n_elem);
24068 printf(" %d", n_name);
24069 printf(" %d", n_prefix);
24070 printf("\n");
24071 }
24072 }
24073 }
24074 }
24075 }
Daniel Veillard42595322004-11-08 10:52:06 +000024076 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024077
Daniel Veillard42595322004-11-08 10:52:06 +000024078 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024079}
24080
24081
24082static int
24083test_xmlGetDtdQElementDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024084 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024085
Daniel Veillard42595322004-11-08 10:52:06 +000024086 int mem_base;
24087 xmlElementPtr ret_val;
24088 xmlDtdPtr dtd; /* a pointer to the DtD to search */
24089 int n_dtd;
24090 xmlChar * name; /* the element name */
24091 int n_name;
24092 xmlChar * prefix; /* the element namespace prefix */
24093 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024094
Daniel Veillard42595322004-11-08 10:52:06 +000024095 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
24096 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24097 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
24098 mem_base = xmlMemBlocks();
24099 dtd = gen_xmlDtdPtr(n_dtd, 0);
24100 name = gen_const_xmlChar_ptr(n_name, 1);
24101 prefix = gen_const_xmlChar_ptr(n_prefix, 2);
24102
William M. Brackf13f77f2004-11-12 16:03:48 +000024103 ret_val = xmlGetDtdQElementDesc(dtd, (const xmlChar *)name, (const xmlChar *)prefix);
Daniel Veillard42595322004-11-08 10:52:06 +000024104 desret_xmlElementPtr(ret_val);
24105 call_tests++;
24106 des_xmlDtdPtr(n_dtd, dtd, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024107 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
24108 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 2);
Daniel Veillard42595322004-11-08 10:52:06 +000024109 xmlResetLastError();
24110 if (mem_base != xmlMemBlocks()) {
24111 printf("Leak of %d blocks found in xmlGetDtdQElementDesc",
24112 xmlMemBlocks() - mem_base);
24113 test_ret++;
24114 printf(" %d", n_dtd);
24115 printf(" %d", n_name);
24116 printf(" %d", n_prefix);
24117 printf("\n");
24118 }
24119 }
24120 }
24121 }
Daniel Veillard42595322004-11-08 10:52:06 +000024122 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024123
Daniel Veillard42595322004-11-08 10:52:06 +000024124 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024125}
24126
24127
24128static int
24129test_xmlGetID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024130 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024131
Daniel Veillard57b25162004-11-06 14:50:18 +000024132 int mem_base;
24133 xmlAttrPtr ret_val;
24134 xmlDocPtr doc; /* pointer to the document */
24135 int n_doc;
24136 xmlChar * ID; /* the ID value */
24137 int n_ID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024138
Daniel Veillard57b25162004-11-06 14:50:18 +000024139 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24140 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
24141 mem_base = xmlMemBlocks();
24142 doc = gen_xmlDocPtr(n_doc, 0);
24143 ID = gen_const_xmlChar_ptr(n_ID, 1);
24144
William M. Brackf13f77f2004-11-12 16:03:48 +000024145 ret_val = xmlGetID(doc, (const xmlChar *)ID);
Daniel Veillard57b25162004-11-06 14:50:18 +000024146 desret_xmlAttrPtr(ret_val);
24147 call_tests++;
24148 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024149 des_const_xmlChar_ptr(n_ID, (const xmlChar *)ID, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +000024150 xmlResetLastError();
24151 if (mem_base != xmlMemBlocks()) {
24152 printf("Leak of %d blocks found in xmlGetID",
24153 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024154 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000024155 printf(" %d", n_doc);
24156 printf(" %d", n_ID);
24157 printf("\n");
24158 }
24159 }
24160 }
Daniel Veillard57b25162004-11-06 14:50:18 +000024161 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024162
Daniel Veillard42595322004-11-08 10:52:06 +000024163 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024164}
24165
24166
24167static int
24168test_xmlGetRefs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024169 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024170
24171
24172 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000024173 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024174}
24175
24176
24177static int
24178test_xmlIsID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024179 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024180
Daniel Veillardce244ad2004-11-05 10:03:46 +000024181 int mem_base;
24182 int ret_val;
24183 xmlDocPtr doc; /* the document */
24184 int n_doc;
24185 xmlNodePtr elem; /* the element carrying the attribute */
24186 int n_elem;
24187 xmlAttrPtr attr; /* the attribute */
24188 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024189
Daniel Veillardce244ad2004-11-05 10:03:46 +000024190 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24191 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
24192 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
24193 mem_base = xmlMemBlocks();
24194 doc = gen_xmlDocPtr(n_doc, 0);
24195 elem = gen_xmlNodePtr(n_elem, 1);
24196 attr = gen_xmlAttrPtr(n_attr, 2);
24197
24198 ret_val = xmlIsID(doc, elem, attr);
24199 desret_int(ret_val);
24200 call_tests++;
24201 des_xmlDocPtr(n_doc, doc, 0);
24202 des_xmlNodePtr(n_elem, elem, 1);
24203 des_xmlAttrPtr(n_attr, attr, 2);
24204 xmlResetLastError();
24205 if (mem_base != xmlMemBlocks()) {
24206 printf("Leak of %d blocks found in xmlIsID",
24207 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024208 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000024209 printf(" %d", n_doc);
24210 printf(" %d", n_elem);
24211 printf(" %d", n_attr);
24212 printf("\n");
24213 }
24214 }
24215 }
24216 }
Daniel Veillardce244ad2004-11-05 10:03:46 +000024217 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024218
Daniel Veillard42595322004-11-08 10:52:06 +000024219 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024220}
24221
24222
24223static int
24224test_xmlIsMixedElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024225 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024226
24227 int mem_base;
24228 int ret_val;
24229 xmlDocPtr doc; /* the document */
24230 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024231 xmlChar * name; /* the element name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000024232 int n_name;
24233
24234 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24235 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24236 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024237 doc = gen_xmlDocPtr(n_doc, 0);
24238 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024239
William M. Brackf13f77f2004-11-12 16:03:48 +000024240 ret_val = xmlIsMixedElement(doc, (const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024241 desret_int(ret_val);
24242 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024243 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024244 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024245 xmlResetLastError();
24246 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000024247 printf("Leak of %d blocks found in xmlIsMixedElement",
Daniel Veillardd93f6252004-11-02 15:53:51 +000024248 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024249 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000024250 printf(" %d", n_doc);
24251 printf(" %d", n_name);
24252 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000024253 }
24254 }
24255 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000024256 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024257
Daniel Veillard42595322004-11-08 10:52:06 +000024258 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024259}
24260
24261
24262static int
24263test_xmlIsRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024264 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024265
Daniel Veillardce244ad2004-11-05 10:03:46 +000024266 int mem_base;
24267 int ret_val;
24268 xmlDocPtr doc; /* the document */
24269 int n_doc;
24270 xmlNodePtr elem; /* the element carrying the attribute */
24271 int n_elem;
24272 xmlAttrPtr attr; /* the attribute */
24273 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024274
Daniel Veillardce244ad2004-11-05 10:03:46 +000024275 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24276 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
24277 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
24278 mem_base = xmlMemBlocks();
24279 doc = gen_xmlDocPtr(n_doc, 0);
24280 elem = gen_xmlNodePtr(n_elem, 1);
24281 attr = gen_xmlAttrPtr(n_attr, 2);
24282
24283 ret_val = xmlIsRef(doc, elem, attr);
24284 desret_int(ret_val);
24285 call_tests++;
24286 des_xmlDocPtr(n_doc, doc, 0);
24287 des_xmlNodePtr(n_elem, elem, 1);
24288 des_xmlAttrPtr(n_attr, attr, 2);
24289 xmlResetLastError();
24290 if (mem_base != xmlMemBlocks()) {
24291 printf("Leak of %d blocks found in xmlIsRef",
24292 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024293 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000024294 printf(" %d", n_doc);
24295 printf(" %d", n_elem);
24296 printf(" %d", n_attr);
24297 printf("\n");
24298 }
24299 }
24300 }
24301 }
Daniel Veillardce244ad2004-11-05 10:03:46 +000024302 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024303
Daniel Veillard42595322004-11-08 10:52:06 +000024304 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024305}
24306
24307
24308static int
24309test_xmlNewElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024310 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024311
William M. Brack094dd862004-11-14 14:28:34 +000024312 int mem_base;
24313 xmlElementContentPtr ret_val;
24314 xmlChar * name; /* the subelement name or NULL */
24315 int n_name;
24316 xmlElementContentType type; /* the type of element content decl */
24317 int n_type;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024318
William M. Brack094dd862004-11-14 14:28:34 +000024319 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24320 for (n_type = 0;n_type < gen_nb_xmlElementContentType;n_type++) {
24321 mem_base = xmlMemBlocks();
24322 name = gen_const_xmlChar_ptr(n_name, 0);
24323 type = gen_xmlElementContentType(n_type, 1);
24324
24325 ret_val = xmlNewElementContent((const xmlChar *)name, type);
24326 desret_xmlElementContentPtr(ret_val);
24327 call_tests++;
24328 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
24329 des_xmlElementContentType(n_type, type, 1);
24330 xmlResetLastError();
24331 if (mem_base != xmlMemBlocks()) {
24332 printf("Leak of %d blocks found in xmlNewElementContent",
24333 xmlMemBlocks() - mem_base);
24334 test_ret++;
24335 printf(" %d", n_name);
24336 printf(" %d", n_type);
24337 printf("\n");
24338 }
24339 }
24340 }
24341 function_tests++;
24342
Daniel Veillard42595322004-11-08 10:52:06 +000024343 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024344}
24345
24346
24347static int
24348test_xmlNewValidCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024349 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024350
24351
24352 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000024353 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024354}
24355
24356
24357static int
24358test_xmlRemoveID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024359 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024360
Daniel Veillardce244ad2004-11-05 10:03:46 +000024361 int mem_base;
24362 int ret_val;
24363 xmlDocPtr doc; /* the document */
24364 int n_doc;
24365 xmlAttrPtr attr; /* the attribute */
24366 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024367
Daniel Veillardce244ad2004-11-05 10:03:46 +000024368 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24369 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
24370 mem_base = xmlMemBlocks();
24371 doc = gen_xmlDocPtr(n_doc, 0);
24372 attr = gen_xmlAttrPtr(n_attr, 1);
24373
24374 ret_val = xmlRemoveID(doc, attr);
24375 desret_int(ret_val);
24376 call_tests++;
24377 des_xmlDocPtr(n_doc, doc, 0);
24378 des_xmlAttrPtr(n_attr, attr, 1);
24379 xmlResetLastError();
24380 if (mem_base != xmlMemBlocks()) {
24381 printf("Leak of %d blocks found in xmlRemoveID",
24382 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024383 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000024384 printf(" %d", n_doc);
24385 printf(" %d", n_attr);
24386 printf("\n");
24387 }
24388 }
24389 }
Daniel Veillardce244ad2004-11-05 10:03:46 +000024390 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024391
Daniel Veillard42595322004-11-08 10:52:06 +000024392 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024393}
24394
24395
24396static int
24397test_xmlRemoveRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024398 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024399
Daniel Veillardce244ad2004-11-05 10:03:46 +000024400 int mem_base;
24401 int ret_val;
24402 xmlDocPtr doc; /* the document */
24403 int n_doc;
24404 xmlAttrPtr attr; /* the attribute */
24405 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024406
Daniel Veillardce244ad2004-11-05 10:03:46 +000024407 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24408 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
24409 mem_base = xmlMemBlocks();
24410 doc = gen_xmlDocPtr(n_doc, 0);
24411 attr = gen_xmlAttrPtr(n_attr, 1);
24412
24413 ret_val = xmlRemoveRef(doc, attr);
24414 desret_int(ret_val);
24415 call_tests++;
24416 des_xmlDocPtr(n_doc, doc, 0);
24417 des_xmlAttrPtr(n_attr, attr, 1);
24418 xmlResetLastError();
24419 if (mem_base != xmlMemBlocks()) {
24420 printf("Leak of %d blocks found in xmlRemoveRef",
24421 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024422 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000024423 printf(" %d", n_doc);
24424 printf(" %d", n_attr);
24425 printf("\n");
24426 }
24427 }
24428 }
Daniel Veillardce244ad2004-11-05 10:03:46 +000024429 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024430
Daniel Veillard42595322004-11-08 10:52:06 +000024431 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024432}
24433
24434
24435static int
24436test_xmlSnprintfElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024437 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024438
Daniel Veillardce682bc2004-11-05 17:22:25 +000024439 int mem_base;
24440 char * buf; /* an output buffer */
24441 int n_buf;
24442 int size; /* the buffer size */
24443 int n_size;
24444 xmlElementContentPtr content; /* An element table */
24445 int n_content;
24446 int glob; /* 1 if one must print the englobing parenthesis, 0 otherwise */
24447 int n_glob;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024448
Daniel Veillardce682bc2004-11-05 17:22:25 +000024449 for (n_buf = 0;n_buf < gen_nb_char_ptr;n_buf++) {
24450 for (n_size = 0;n_size < gen_nb_int;n_size++) {
24451 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
24452 for (n_glob = 0;n_glob < gen_nb_int;n_glob++) {
24453 mem_base = xmlMemBlocks();
24454 buf = gen_char_ptr(n_buf, 0);
24455 size = gen_int(n_size, 1);
24456 content = gen_xmlElementContentPtr(n_content, 2);
24457 glob = gen_int(n_glob, 3);
24458
24459 xmlSnprintfElementContent(buf, size, content, glob);
24460 call_tests++;
24461 des_char_ptr(n_buf, buf, 0);
24462 des_int(n_size, size, 1);
24463 des_xmlElementContentPtr(n_content, content, 2);
24464 des_int(n_glob, glob, 3);
24465 xmlResetLastError();
24466 if (mem_base != xmlMemBlocks()) {
24467 printf("Leak of %d blocks found in xmlSnprintfElementContent",
24468 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024469 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024470 printf(" %d", n_buf);
24471 printf(" %d", n_size);
24472 printf(" %d", n_content);
24473 printf(" %d", n_glob);
24474 printf("\n");
24475 }
24476 }
24477 }
24478 }
24479 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000024480 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024481
Daniel Veillard42595322004-11-08 10:52:06 +000024482 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024483}
24484
24485
24486static int
24487test_xmlSprintfElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024488 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024489
William M. Brack21e4ef22005-01-02 09:53:13 +000024490#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000024491#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000024492 int mem_base;
24493 char * buf; /* an output buffer */
24494 int n_buf;
24495 xmlElementContentPtr content; /* An element table */
24496 int n_content;
24497 int glob; /* 1 if one must print the englobing parenthesis, 0 otherwise */
24498 int n_glob;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024499
Daniel Veillardce682bc2004-11-05 17:22:25 +000024500 for (n_buf = 0;n_buf < gen_nb_char_ptr;n_buf++) {
24501 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
24502 for (n_glob = 0;n_glob < gen_nb_int;n_glob++) {
24503 mem_base = xmlMemBlocks();
24504 buf = gen_char_ptr(n_buf, 0);
24505 content = gen_xmlElementContentPtr(n_content, 1);
24506 glob = gen_int(n_glob, 2);
24507
24508 xmlSprintfElementContent(buf, content, glob);
24509 call_tests++;
24510 des_char_ptr(n_buf, buf, 0);
24511 des_xmlElementContentPtr(n_content, content, 1);
24512 des_int(n_glob, glob, 2);
24513 xmlResetLastError();
24514 if (mem_base != xmlMemBlocks()) {
24515 printf("Leak of %d blocks found in xmlSprintfElementContent",
24516 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024517 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024518 printf(" %d", n_buf);
24519 printf(" %d", n_content);
24520 printf(" %d", n_glob);
24521 printf("\n");
24522 }
24523 }
24524 }
24525 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024526 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000024527#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000024528#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000024529
Daniel Veillard42595322004-11-08 10:52:06 +000024530 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024531}
24532
24533
24534static int
24535test_xmlValidBuildContentModel(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024536 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024537
William M. Brack21e4ef22005-01-02 09:53:13 +000024538#if defined(LIBXML_VALID_ENABLED) && defined(LIBXML_REGEXP_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000024539 int mem_base;
24540 int ret_val;
24541 xmlValidCtxtPtr ctxt; /* a validation context */
24542 int n_ctxt;
24543 xmlElementPtr elem; /* an element declaration node */
24544 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024545
Daniel Veillardce682bc2004-11-05 17:22:25 +000024546 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
24547 for (n_elem = 0;n_elem < gen_nb_xmlElementPtr;n_elem++) {
24548 mem_base = xmlMemBlocks();
24549 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
24550 elem = gen_xmlElementPtr(n_elem, 1);
24551
24552 ret_val = xmlValidBuildContentModel(ctxt, elem);
24553 desret_int(ret_val);
24554 call_tests++;
24555 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
24556 des_xmlElementPtr(n_elem, elem, 1);
24557 xmlResetLastError();
24558 if (mem_base != xmlMemBlocks()) {
24559 printf("Leak of %d blocks found in xmlValidBuildContentModel",
24560 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024561 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024562 printf(" %d", n_ctxt);
24563 printf(" %d", n_elem);
24564 printf("\n");
24565 }
24566 }
24567 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024568 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024569#endif
24570
Daniel Veillard42595322004-11-08 10:52:06 +000024571 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024572}
24573
24574
24575static int
24576test_xmlValidCtxtNormalizeAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024577 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024578
William M. Brack21e4ef22005-01-02 09:53:13 +000024579#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024580 int mem_base;
24581 xmlChar * ret_val;
24582 xmlValidCtxtPtr ctxt; /* the validation context or NULL */
24583 int n_ctxt;
24584 xmlDocPtr doc; /* the document */
24585 int n_doc;
24586 xmlNodePtr elem; /* the parent */
24587 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024588 xmlChar * name; /* the attribute name */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024589 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024590 xmlChar * value; /* the attribute value */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024591 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024592
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024593 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
24594 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24595 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
24596 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24597 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
24598 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024599 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
24600 doc = gen_xmlDocPtr(n_doc, 1);
24601 elem = gen_xmlNodePtr(n_elem, 2);
24602 name = gen_const_xmlChar_ptr(n_name, 3);
24603 value = gen_const_xmlChar_ptr(n_value, 4);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024604
William M. Brackf13f77f2004-11-12 16:03:48 +000024605 ret_val = xmlValidCtxtNormalizeAttributeValue(ctxt, doc, elem, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024606 desret_xmlChar_ptr(ret_val);
24607 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024608 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
24609 des_xmlDocPtr(n_doc, doc, 1);
24610 des_xmlNodePtr(n_elem, elem, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000024611 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 3);
24612 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 4);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024613 xmlResetLastError();
24614 if (mem_base != xmlMemBlocks()) {
24615 printf("Leak of %d blocks found in xmlValidCtxtNormalizeAttributeValue",
24616 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024617 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024618 printf(" %d", n_ctxt);
24619 printf(" %d", n_doc);
24620 printf(" %d", n_elem);
24621 printf(" %d", n_name);
24622 printf(" %d", n_value);
24623 printf("\n");
24624 }
24625 }
24626 }
24627 }
24628 }
24629 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024630 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024631#endif
24632
Daniel Veillard42595322004-11-08 10:52:06 +000024633 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024634}
24635
24636
Daniel Veillardce682bc2004-11-05 17:22:25 +000024637#define gen_nb_xmlElementContent_ptr 1
24638static xmlElementContent * gen_xmlElementContent_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
24639 return(NULL);
24640}
24641static void des_xmlElementContent_ptr(int no ATTRIBUTE_UNUSED, xmlElementContent * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
24642}
24643
Daniel Veillardd93f6252004-11-02 15:53:51 +000024644static int
24645test_xmlValidGetPotentialChildren(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024646 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024647
William M. Brack21e4ef22005-01-02 09:53:13 +000024648#if defined(LIBXML_VALID_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000024649#ifdef LIBXML_VALID_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024650 int mem_base;
24651 int ret_val;
24652 xmlElementContent * ctree; /* an element content tree */
24653 int n_ctree;
24654 xmlChar ** list; /* an array to store the list of child names */
24655 int n_list;
24656 int * len; /* a pointer to the number of element in the list */
24657 int n_len;
24658 int max; /* the size of the array */
24659 int n_max;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024660
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024661 for (n_ctree = 0;n_ctree < gen_nb_xmlElementContent_ptr;n_ctree++) {
24662 for (n_list = 0;n_list < gen_nb_const_xmlChar_ptr_ptr;n_list++) {
24663 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
24664 for (n_max = 0;n_max < gen_nb_int;n_max++) {
24665 mem_base = xmlMemBlocks();
24666 ctree = gen_xmlElementContent_ptr(n_ctree, 0);
24667 list = gen_const_xmlChar_ptr_ptr(n_list, 1);
24668 len = gen_int_ptr(n_len, 2);
24669 max = gen_int(n_max, 3);
24670
William M. Brackf13f77f2004-11-12 16:03:48 +000024671 ret_val = xmlValidGetPotentialChildren(ctree, (const xmlChar **)list, len, max);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024672 desret_int(ret_val);
24673 call_tests++;
24674 des_xmlElementContent_ptr(n_ctree, ctree, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024675 des_const_xmlChar_ptr_ptr(n_list, (const xmlChar **)list, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024676 des_int_ptr(n_len, len, 2);
24677 des_int(n_max, max, 3);
24678 xmlResetLastError();
24679 if (mem_base != xmlMemBlocks()) {
24680 printf("Leak of %d blocks found in xmlValidGetPotentialChildren",
24681 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024682 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024683 printf(" %d", n_ctree);
24684 printf(" %d", n_list);
24685 printf(" %d", n_len);
24686 printf(" %d", n_max);
24687 printf("\n");
24688 }
24689 }
24690 }
24691 }
24692 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024693 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000024694#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000024695#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024696
Daniel Veillard42595322004-11-08 10:52:06 +000024697 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024698}
24699
24700
24701static int
24702test_xmlValidGetValidElements(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024703 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024704
William M. Brack21e4ef22005-01-02 09:53:13 +000024705#if defined(LIBXML_VALID_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000024706#ifdef LIBXML_VALID_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024707 int mem_base;
24708 int ret_val;
24709 xmlNode * prev; /* an element to insert after */
24710 int n_prev;
24711 xmlNode * next; /* an element to insert next */
24712 int n_next;
24713 xmlChar ** names; /* an array to store the list of child names */
24714 int n_names;
24715 int max; /* the size of the array */
24716 int n_max;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024717
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024718 for (n_prev = 0;n_prev < gen_nb_xmlNodePtr;n_prev++) {
24719 for (n_next = 0;n_next < gen_nb_xmlNodePtr;n_next++) {
24720 for (n_names = 0;n_names < gen_nb_const_xmlChar_ptr_ptr;n_names++) {
24721 for (n_max = 0;n_max < gen_nb_int;n_max++) {
24722 mem_base = xmlMemBlocks();
24723 prev = gen_xmlNodePtr(n_prev, 0);
24724 next = gen_xmlNodePtr(n_next, 1);
24725 names = gen_const_xmlChar_ptr_ptr(n_names, 2);
24726 max = gen_int(n_max, 3);
24727
William M. Brackf13f77f2004-11-12 16:03:48 +000024728 ret_val = xmlValidGetValidElements(prev, next, (const xmlChar **)names, max);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024729 desret_int(ret_val);
24730 call_tests++;
24731 des_xmlNodePtr(n_prev, prev, 0);
24732 des_xmlNodePtr(n_next, next, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000024733 des_const_xmlChar_ptr_ptr(n_names, (const xmlChar **)names, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024734 des_int(n_max, max, 3);
24735 xmlResetLastError();
24736 if (mem_base != xmlMemBlocks()) {
24737 printf("Leak of %d blocks found in xmlValidGetValidElements",
24738 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024739 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024740 printf(" %d", n_prev);
24741 printf(" %d", n_next);
24742 printf(" %d", n_names);
24743 printf(" %d", n_max);
24744 printf("\n");
24745 }
24746 }
24747 }
24748 }
24749 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024750 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000024751#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000024752#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024753
Daniel Veillard42595322004-11-08 10:52:06 +000024754 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024755}
24756
24757
24758static int
24759test_xmlValidNormalizeAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024760 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024761
William M. Brack21e4ef22005-01-02 09:53:13 +000024762#if defined(LIBXML_VALID_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024763 int mem_base;
24764 xmlChar * ret_val;
24765 xmlDocPtr doc; /* the document */
24766 int n_doc;
24767 xmlNodePtr elem; /* the parent */
24768 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024769 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024770 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024771 xmlChar * value; /* the attribute value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024772 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024773
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024774 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24775 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
24776 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24777 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
24778 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024779 doc = gen_xmlDocPtr(n_doc, 0);
24780 elem = gen_xmlNodePtr(n_elem, 1);
24781 name = gen_const_xmlChar_ptr(n_name, 2);
24782 value = gen_const_xmlChar_ptr(n_value, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024783
William M. Brackf13f77f2004-11-12 16:03:48 +000024784 ret_val = xmlValidNormalizeAttributeValue(doc, elem, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024785 desret_xmlChar_ptr(ret_val);
24786 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024787 des_xmlDocPtr(n_doc, doc, 0);
24788 des_xmlNodePtr(n_elem, elem, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000024789 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
24790 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024791 xmlResetLastError();
24792 if (mem_base != xmlMemBlocks()) {
24793 printf("Leak of %d blocks found in xmlValidNormalizeAttributeValue",
24794 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024795 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024796 printf(" %d", n_doc);
24797 printf(" %d", n_elem);
24798 printf(" %d", n_name);
24799 printf(" %d", n_value);
24800 printf("\n");
24801 }
24802 }
24803 }
24804 }
24805 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024806 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024807#endif
24808
Daniel Veillard42595322004-11-08 10:52:06 +000024809 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024810}
24811
24812
24813static int
24814test_xmlValidateAttributeDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024815 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024816
William M. Brack21e4ef22005-01-02 09:53:13 +000024817#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000024818 int mem_base;
24819 int ret_val;
24820 xmlValidCtxtPtr ctxt; /* the validation context */
24821 int n_ctxt;
24822 xmlDocPtr doc; /* a document instance */
24823 int n_doc;
24824 xmlAttributePtr attr; /* an attribute definition */
24825 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024826
Daniel Veillardce682bc2004-11-05 17:22:25 +000024827 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
24828 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24829 for (n_attr = 0;n_attr < gen_nb_xmlAttributePtr;n_attr++) {
24830 mem_base = xmlMemBlocks();
24831 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
24832 doc = gen_xmlDocPtr(n_doc, 1);
24833 attr = gen_xmlAttributePtr(n_attr, 2);
24834
24835 ret_val = xmlValidateAttributeDecl(ctxt, doc, attr);
24836 desret_int(ret_val);
24837 call_tests++;
24838 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
24839 des_xmlDocPtr(n_doc, doc, 1);
24840 des_xmlAttributePtr(n_attr, attr, 2);
24841 xmlResetLastError();
24842 if (mem_base != xmlMemBlocks()) {
24843 printf("Leak of %d blocks found in xmlValidateAttributeDecl",
24844 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024845 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024846 printf(" %d", n_ctxt);
24847 printf(" %d", n_doc);
24848 printf(" %d", n_attr);
24849 printf("\n");
24850 }
24851 }
24852 }
24853 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024854 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024855#endif
24856
Daniel Veillard42595322004-11-08 10:52:06 +000024857 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024858}
24859
24860
24861static int
24862test_xmlValidateAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024863 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024864
William M. Brack21e4ef22005-01-02 09:53:13 +000024865#if defined(LIBXML_VALID_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +000024866 int mem_base;
24867 int ret_val;
24868 xmlAttributeType type; /* an attribute type */
24869 int n_type;
24870 xmlChar * value; /* an attribute value */
24871 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024872
Daniel Veillard57b25162004-11-06 14:50:18 +000024873 for (n_type = 0;n_type < gen_nb_xmlAttributeType;n_type++) {
24874 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
24875 mem_base = xmlMemBlocks();
24876 type = gen_xmlAttributeType(n_type, 0);
24877 value = gen_const_xmlChar_ptr(n_value, 1);
24878
William M. Brackf13f77f2004-11-12 16:03:48 +000024879 ret_val = xmlValidateAttributeValue(type, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000024880 desret_int(ret_val);
24881 call_tests++;
24882 des_xmlAttributeType(n_type, type, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024883 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +000024884 xmlResetLastError();
24885 if (mem_base != xmlMemBlocks()) {
24886 printf("Leak of %d blocks found in xmlValidateAttributeValue",
24887 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024888 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000024889 printf(" %d", n_type);
24890 printf(" %d", n_value);
24891 printf("\n");
24892 }
24893 }
24894 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024895 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +000024896#endif
24897
Daniel Veillard42595322004-11-08 10:52:06 +000024898 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024899}
24900
24901
24902static int
24903test_xmlValidateDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024904 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024905
William M. Brack21e4ef22005-01-02 09:53:13 +000024906#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024907 int mem_base;
24908 int ret_val;
24909 xmlValidCtxtPtr ctxt; /* the validation context */
24910 int n_ctxt;
24911 xmlDocPtr doc; /* a document instance */
24912 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024913
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024914 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
24915 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24916 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024917 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
24918 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024919
24920 ret_val = xmlValidateDocument(ctxt, doc);
24921 desret_int(ret_val);
24922 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024923 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
24924 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024925 xmlResetLastError();
24926 if (mem_base != xmlMemBlocks()) {
24927 printf("Leak of %d blocks found in xmlValidateDocument",
24928 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024929 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024930 printf(" %d", n_ctxt);
24931 printf(" %d", n_doc);
24932 printf("\n");
24933 }
24934 }
24935 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024936 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024937#endif
24938
Daniel Veillard42595322004-11-08 10:52:06 +000024939 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024940}
24941
24942
24943static int
24944test_xmlValidateDocumentFinal(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024945 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024946
William M. Brack21e4ef22005-01-02 09:53:13 +000024947#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024948 int mem_base;
24949 int ret_val;
24950 xmlValidCtxtPtr ctxt; /* the validation context */
24951 int n_ctxt;
24952 xmlDocPtr doc; /* a document instance */
24953 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024954
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024955 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
24956 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24957 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024958 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
24959 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024960
24961 ret_val = xmlValidateDocumentFinal(ctxt, doc);
24962 desret_int(ret_val);
24963 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024964 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
24965 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024966 xmlResetLastError();
24967 if (mem_base != xmlMemBlocks()) {
24968 printf("Leak of %d blocks found in xmlValidateDocumentFinal",
24969 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024970 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024971 printf(" %d", n_ctxt);
24972 printf(" %d", n_doc);
24973 printf("\n");
24974 }
24975 }
24976 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024977 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024978#endif
24979
Daniel Veillard42595322004-11-08 10:52:06 +000024980 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024981}
24982
24983
24984static int
24985test_xmlValidateDtd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024986 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024987
William M. Brack21e4ef22005-01-02 09:53:13 +000024988#if defined(LIBXML_VALID_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000024989 int mem_base;
24990 int ret_val;
24991 xmlValidCtxtPtr ctxt; /* the validation context */
24992 int n_ctxt;
24993 xmlDocPtr doc; /* a document instance */
24994 int n_doc;
24995 xmlDtdPtr dtd; /* a dtd instance */
24996 int n_dtd;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024997
Daniel Veillard27f20102004-11-05 11:50:11 +000024998 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
24999 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25000 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
25001 mem_base = xmlMemBlocks();
25002 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25003 doc = gen_xmlDocPtr(n_doc, 1);
25004 dtd = gen_xmlDtdPtr(n_dtd, 2);
25005
25006 ret_val = xmlValidateDtd(ctxt, doc, dtd);
25007 desret_int(ret_val);
25008 call_tests++;
25009 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25010 des_xmlDocPtr(n_doc, doc, 1);
25011 des_xmlDtdPtr(n_dtd, dtd, 2);
25012 xmlResetLastError();
25013 if (mem_base != xmlMemBlocks()) {
25014 printf("Leak of %d blocks found in xmlValidateDtd",
25015 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025016 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000025017 printf(" %d", n_ctxt);
25018 printf(" %d", n_doc);
25019 printf(" %d", n_dtd);
25020 printf("\n");
25021 }
25022 }
25023 }
25024 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025025 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000025026#endif
25027
Daniel Veillard42595322004-11-08 10:52:06 +000025028 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025029}
25030
25031
25032static int
25033test_xmlValidateDtdFinal(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025034 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025035
William M. Brack21e4ef22005-01-02 09:53:13 +000025036#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025037 int mem_base;
25038 int ret_val;
25039 xmlValidCtxtPtr ctxt; /* the validation context */
25040 int n_ctxt;
25041 xmlDocPtr doc; /* a document instance */
25042 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025043
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025044 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25045 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25046 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025047 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25048 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025049
25050 ret_val = xmlValidateDtdFinal(ctxt, doc);
25051 desret_int(ret_val);
25052 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025053 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25054 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025055 xmlResetLastError();
25056 if (mem_base != xmlMemBlocks()) {
25057 printf("Leak of %d blocks found in xmlValidateDtdFinal",
25058 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025059 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025060 printf(" %d", n_ctxt);
25061 printf(" %d", n_doc);
25062 printf("\n");
25063 }
25064 }
25065 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025066 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025067#endif
25068
Daniel Veillard42595322004-11-08 10:52:06 +000025069 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025070}
25071
25072
25073static int
25074test_xmlValidateElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025075 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025076
William M. Brack21e4ef22005-01-02 09:53:13 +000025077#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025078 int mem_base;
25079 int ret_val;
25080 xmlValidCtxtPtr ctxt; /* the validation context */
25081 int n_ctxt;
25082 xmlDocPtr doc; /* a document instance */
25083 int n_doc;
25084 xmlNodePtr elem; /* an element instance */
25085 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025086
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025087 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25088 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25089 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25090 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025091 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25092 doc = gen_xmlDocPtr(n_doc, 1);
25093 elem = gen_xmlNodePtr(n_elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025094
25095 ret_val = xmlValidateElement(ctxt, doc, elem);
25096 desret_int(ret_val);
25097 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025098 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25099 des_xmlDocPtr(n_doc, doc, 1);
25100 des_xmlNodePtr(n_elem, elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025101 xmlResetLastError();
25102 if (mem_base != xmlMemBlocks()) {
25103 printf("Leak of %d blocks found in xmlValidateElement",
25104 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025105 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025106 printf(" %d", n_ctxt);
25107 printf(" %d", n_doc);
25108 printf(" %d", n_elem);
25109 printf("\n");
25110 }
25111 }
25112 }
25113 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025114 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025115#endif
25116
Daniel Veillard42595322004-11-08 10:52:06 +000025117 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025118}
25119
25120
25121static int
25122test_xmlValidateElementDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025123 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025124
William M. Brack21e4ef22005-01-02 09:53:13 +000025125#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000025126 int mem_base;
25127 int ret_val;
25128 xmlValidCtxtPtr ctxt; /* the validation context */
25129 int n_ctxt;
25130 xmlDocPtr doc; /* a document instance */
25131 int n_doc;
25132 xmlElementPtr elem; /* an element definition */
25133 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025134
Daniel Veillardce682bc2004-11-05 17:22:25 +000025135 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25136 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25137 for (n_elem = 0;n_elem < gen_nb_xmlElementPtr;n_elem++) {
25138 mem_base = xmlMemBlocks();
25139 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25140 doc = gen_xmlDocPtr(n_doc, 1);
25141 elem = gen_xmlElementPtr(n_elem, 2);
25142
25143 ret_val = xmlValidateElementDecl(ctxt, doc, elem);
25144 desret_int(ret_val);
25145 call_tests++;
25146 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25147 des_xmlDocPtr(n_doc, doc, 1);
25148 des_xmlElementPtr(n_elem, elem, 2);
25149 xmlResetLastError();
25150 if (mem_base != xmlMemBlocks()) {
25151 printf("Leak of %d blocks found in xmlValidateElementDecl",
25152 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025153 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025154 printf(" %d", n_ctxt);
25155 printf(" %d", n_doc);
25156 printf(" %d", n_elem);
25157 printf("\n");
25158 }
25159 }
25160 }
25161 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025162 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025163#endif
25164
Daniel Veillard42595322004-11-08 10:52:06 +000025165 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025166}
25167
25168
25169static int
25170test_xmlValidateNameValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025171 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025172
William M. Brack21e4ef22005-01-02 09:53:13 +000025173#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000025174 int mem_base;
25175 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025176 xmlChar * value; /* an Name value */
Daniel Veillardd93f6252004-11-02 15:53:51 +000025177 int n_value;
25178
25179 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25180 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025181 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025182
William M. Brackf13f77f2004-11-12 16:03:48 +000025183 ret_val = xmlValidateNameValue((const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025184 desret_int(ret_val);
25185 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000025186 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025187 xmlResetLastError();
25188 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025189 printf("Leak of %d blocks found in xmlValidateNameValue",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025190 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025191 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025192 printf(" %d", n_value);
25193 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025194 }
25195 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025196 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025197#endif
25198
Daniel Veillard42595322004-11-08 10:52:06 +000025199 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025200}
25201
25202
25203static int
25204test_xmlValidateNamesValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025205 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025206
William M. Brack21e4ef22005-01-02 09:53:13 +000025207#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000025208 int mem_base;
25209 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025210 xmlChar * value; /* an Names value */
Daniel Veillardd93f6252004-11-02 15:53:51 +000025211 int n_value;
25212
25213 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25214 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025215 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025216
William M. Brackf13f77f2004-11-12 16:03:48 +000025217 ret_val = xmlValidateNamesValue((const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025218 desret_int(ret_val);
25219 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000025220 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025221 xmlResetLastError();
25222 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025223 printf("Leak of %d blocks found in xmlValidateNamesValue",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025224 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025225 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025226 printf(" %d", n_value);
25227 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025228 }
25229 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025230 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025231#endif
25232
Daniel Veillard42595322004-11-08 10:52:06 +000025233 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025234}
25235
25236
25237static int
25238test_xmlValidateNmtokenValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025239 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025240
William M. Brack21e4ef22005-01-02 09:53:13 +000025241#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000025242 int mem_base;
25243 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025244 xmlChar * value; /* an Nmtoken value */
Daniel Veillardd93f6252004-11-02 15:53:51 +000025245 int n_value;
25246
25247 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25248 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025249 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025250
William M. Brackf13f77f2004-11-12 16:03:48 +000025251 ret_val = xmlValidateNmtokenValue((const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025252 desret_int(ret_val);
25253 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000025254 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025255 xmlResetLastError();
25256 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025257 printf("Leak of %d blocks found in xmlValidateNmtokenValue",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025258 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025259 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025260 printf(" %d", n_value);
25261 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025262 }
25263 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025264 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025265#endif
25266
Daniel Veillard42595322004-11-08 10:52:06 +000025267 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025268}
25269
25270
25271static int
25272test_xmlValidateNmtokensValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025273 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025274
William M. Brack21e4ef22005-01-02 09:53:13 +000025275#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000025276 int mem_base;
25277 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025278 xmlChar * value; /* an Nmtokens value */
Daniel Veillardd93f6252004-11-02 15:53:51 +000025279 int n_value;
25280
25281 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25282 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025283 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025284
William M. Brackf13f77f2004-11-12 16:03:48 +000025285 ret_val = xmlValidateNmtokensValue((const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025286 desret_int(ret_val);
25287 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000025288 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025289 xmlResetLastError();
25290 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025291 printf("Leak of %d blocks found in xmlValidateNmtokensValue",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025292 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025293 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025294 printf(" %d", n_value);
25295 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025296 }
25297 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025298 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025299#endif
25300
Daniel Veillard42595322004-11-08 10:52:06 +000025301 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025302}
25303
25304
25305static int
25306test_xmlValidateNotationDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025307 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025308
William M. Brack21e4ef22005-01-02 09:53:13 +000025309#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000025310 int mem_base;
25311 int ret_val;
25312 xmlValidCtxtPtr ctxt; /* the validation context */
25313 int n_ctxt;
25314 xmlDocPtr doc; /* a document instance */
25315 int n_doc;
25316 xmlNotationPtr nota; /* a notation definition */
25317 int n_nota;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025318
Daniel Veillardce682bc2004-11-05 17:22:25 +000025319 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25320 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25321 for (n_nota = 0;n_nota < gen_nb_xmlNotationPtr;n_nota++) {
25322 mem_base = xmlMemBlocks();
25323 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25324 doc = gen_xmlDocPtr(n_doc, 1);
25325 nota = gen_xmlNotationPtr(n_nota, 2);
25326
25327 ret_val = xmlValidateNotationDecl(ctxt, doc, nota);
25328 desret_int(ret_val);
25329 call_tests++;
25330 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25331 des_xmlDocPtr(n_doc, doc, 1);
25332 des_xmlNotationPtr(n_nota, nota, 2);
25333 xmlResetLastError();
25334 if (mem_base != xmlMemBlocks()) {
25335 printf("Leak of %d blocks found in xmlValidateNotationDecl",
25336 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025337 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025338 printf(" %d", n_ctxt);
25339 printf(" %d", n_doc);
25340 printf(" %d", n_nota);
25341 printf("\n");
25342 }
25343 }
25344 }
25345 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025346 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025347#endif
25348
Daniel Veillard42595322004-11-08 10:52:06 +000025349 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025350}
25351
25352
25353static int
25354test_xmlValidateNotationUse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025355 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025356
William M. Brack21e4ef22005-01-02 09:53:13 +000025357#if defined(LIBXML_VALID_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025358 int mem_base;
25359 int ret_val;
25360 xmlValidCtxtPtr ctxt; /* the validation context */
25361 int n_ctxt;
25362 xmlDocPtr doc; /* the document */
25363 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025364 xmlChar * notationName; /* the notation name to check */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025365 int n_notationName;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025366
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025367 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25368 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25369 for (n_notationName = 0;n_notationName < gen_nb_const_xmlChar_ptr;n_notationName++) {
25370 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025371 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25372 doc = gen_xmlDocPtr(n_doc, 1);
25373 notationName = gen_const_xmlChar_ptr(n_notationName, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025374
William M. Brackf13f77f2004-11-12 16:03:48 +000025375 ret_val = xmlValidateNotationUse(ctxt, doc, (const xmlChar *)notationName);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025376 desret_int(ret_val);
25377 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025378 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25379 des_xmlDocPtr(n_doc, doc, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000025380 des_const_xmlChar_ptr(n_notationName, (const xmlChar *)notationName, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025381 xmlResetLastError();
25382 if (mem_base != xmlMemBlocks()) {
25383 printf("Leak of %d blocks found in xmlValidateNotationUse",
25384 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025385 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025386 printf(" %d", n_ctxt);
25387 printf(" %d", n_doc);
25388 printf(" %d", n_notationName);
25389 printf("\n");
25390 }
25391 }
25392 }
25393 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025394 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025395#endif
25396
Daniel Veillard42595322004-11-08 10:52:06 +000025397 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025398}
25399
25400
25401static int
25402test_xmlValidateOneAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025403 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025404
William M. Brack21e4ef22005-01-02 09:53:13 +000025405#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardce244ad2004-11-05 10:03:46 +000025406 int mem_base;
25407 int ret_val;
25408 xmlValidCtxtPtr ctxt; /* the validation context */
25409 int n_ctxt;
25410 xmlDocPtr doc; /* a document instance */
25411 int n_doc;
25412 xmlNodePtr elem; /* an element instance */
25413 int n_elem;
25414 xmlAttrPtr attr; /* an attribute instance */
25415 int n_attr;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025416 xmlChar * value; /* the attribute value (without entities processing) */
Daniel Veillardce244ad2004-11-05 10:03:46 +000025417 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025418
Daniel Veillardce244ad2004-11-05 10:03:46 +000025419 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25420 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25421 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25422 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
25423 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25424 mem_base = xmlMemBlocks();
25425 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25426 doc = gen_xmlDocPtr(n_doc, 1);
25427 elem = gen_xmlNodePtr(n_elem, 2);
25428 attr = gen_xmlAttrPtr(n_attr, 3);
25429 value = gen_const_xmlChar_ptr(n_value, 4);
25430
William M. Brackf13f77f2004-11-12 16:03:48 +000025431 ret_val = xmlValidateOneAttribute(ctxt, doc, elem, attr, (const xmlChar *)value);
Daniel Veillardce244ad2004-11-05 10:03:46 +000025432 desret_int(ret_val);
25433 call_tests++;
25434 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25435 des_xmlDocPtr(n_doc, doc, 1);
25436 des_xmlNodePtr(n_elem, elem, 2);
25437 des_xmlAttrPtr(n_attr, attr, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000025438 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 4);
Daniel Veillardce244ad2004-11-05 10:03:46 +000025439 xmlResetLastError();
25440 if (mem_base != xmlMemBlocks()) {
25441 printf("Leak of %d blocks found in xmlValidateOneAttribute",
25442 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025443 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000025444 printf(" %d", n_ctxt);
25445 printf(" %d", n_doc);
25446 printf(" %d", n_elem);
25447 printf(" %d", n_attr);
25448 printf(" %d", n_value);
25449 printf("\n");
25450 }
25451 }
25452 }
25453 }
25454 }
25455 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025456 function_tests++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000025457#endif
25458
Daniel Veillard42595322004-11-08 10:52:06 +000025459 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025460}
25461
25462
25463static int
25464test_xmlValidateOneElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025465 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025466
William M. Brack21e4ef22005-01-02 09:53:13 +000025467#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025468 int mem_base;
25469 int ret_val;
25470 xmlValidCtxtPtr ctxt; /* the validation context */
25471 int n_ctxt;
25472 xmlDocPtr doc; /* a document instance */
25473 int n_doc;
25474 xmlNodePtr elem; /* an element instance */
25475 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025476
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025477 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25478 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25479 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25480 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025481 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25482 doc = gen_xmlDocPtr(n_doc, 1);
25483 elem = gen_xmlNodePtr(n_elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025484
25485 ret_val = xmlValidateOneElement(ctxt, doc, elem);
25486 desret_int(ret_val);
25487 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025488 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25489 des_xmlDocPtr(n_doc, doc, 1);
25490 des_xmlNodePtr(n_elem, elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025491 xmlResetLastError();
25492 if (mem_base != xmlMemBlocks()) {
25493 printf("Leak of %d blocks found in xmlValidateOneElement",
25494 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025495 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025496 printf(" %d", n_ctxt);
25497 printf(" %d", n_doc);
25498 printf(" %d", n_elem);
25499 printf("\n");
25500 }
25501 }
25502 }
25503 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025504 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025505#endif
25506
Daniel Veillard42595322004-11-08 10:52:06 +000025507 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025508}
25509
25510
25511static int
25512test_xmlValidateOneNamespace(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025513 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025514
William M. Brack21e4ef22005-01-02 09:53:13 +000025515#if defined(LIBXML_VALID_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000025516 int mem_base;
25517 int ret_val;
25518 xmlValidCtxtPtr ctxt; /* the validation context */
25519 int n_ctxt;
25520 xmlDocPtr doc; /* a document instance */
25521 int n_doc;
25522 xmlNodePtr elem; /* an element instance */
25523 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025524 xmlChar * prefix; /* the namespace prefix */
Daniel Veillard27f20102004-11-05 11:50:11 +000025525 int n_prefix;
25526 xmlNsPtr ns; /* an namespace declaration instance */
25527 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025528 xmlChar * value; /* the attribute value (without entities processing) */
Daniel Veillard27f20102004-11-05 11:50:11 +000025529 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025530
Daniel Veillard27f20102004-11-05 11:50:11 +000025531 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25532 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25533 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25534 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
25535 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
25536 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25537 mem_base = xmlMemBlocks();
25538 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25539 doc = gen_xmlDocPtr(n_doc, 1);
25540 elem = gen_xmlNodePtr(n_elem, 2);
25541 prefix = gen_const_xmlChar_ptr(n_prefix, 3);
25542 ns = gen_xmlNsPtr(n_ns, 4);
25543 value = gen_const_xmlChar_ptr(n_value, 5);
25544
William M. Brackf13f77f2004-11-12 16:03:48 +000025545 ret_val = xmlValidateOneNamespace(ctxt, doc, elem, (const xmlChar *)prefix, ns, (const xmlChar *)value);
Daniel Veillard27f20102004-11-05 11:50:11 +000025546 desret_int(ret_val);
25547 call_tests++;
25548 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25549 des_xmlDocPtr(n_doc, doc, 1);
25550 des_xmlNodePtr(n_elem, elem, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000025551 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000025552 des_xmlNsPtr(n_ns, ns, 4);
William M. Brackf13f77f2004-11-12 16:03:48 +000025553 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 5);
Daniel Veillard27f20102004-11-05 11:50:11 +000025554 xmlResetLastError();
25555 if (mem_base != xmlMemBlocks()) {
25556 printf("Leak of %d blocks found in xmlValidateOneNamespace",
25557 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025558 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000025559 printf(" %d", n_ctxt);
25560 printf(" %d", n_doc);
25561 printf(" %d", n_elem);
25562 printf(" %d", n_prefix);
25563 printf(" %d", n_ns);
25564 printf(" %d", n_value);
25565 printf("\n");
25566 }
25567 }
25568 }
25569 }
25570 }
25571 }
25572 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025573 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000025574#endif
25575
Daniel Veillard42595322004-11-08 10:52:06 +000025576 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025577}
25578
25579
25580static int
25581test_xmlValidatePopElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025582 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025583
William M. Brack21e4ef22005-01-02 09:53:13 +000025584#if defined(LIBXML_VALID_ENABLED) && defined(LIBXML_REGEXP_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025585 int mem_base;
25586 int ret_val;
25587 xmlValidCtxtPtr ctxt; /* the validation context */
25588 int n_ctxt;
25589 xmlDocPtr doc; /* a document instance */
25590 int n_doc;
25591 xmlNodePtr elem; /* an element instance */
25592 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025593 xmlChar * qname; /* the qualified name as appearing in the serialization */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025594 int n_qname;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025595
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025596 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25597 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25598 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25599 for (n_qname = 0;n_qname < gen_nb_const_xmlChar_ptr;n_qname++) {
25600 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025601 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25602 doc = gen_xmlDocPtr(n_doc, 1);
25603 elem = gen_xmlNodePtr(n_elem, 2);
25604 qname = gen_const_xmlChar_ptr(n_qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025605
William M. Brackf13f77f2004-11-12 16:03:48 +000025606 ret_val = xmlValidatePopElement(ctxt, doc, elem, (const xmlChar *)qname);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025607 desret_int(ret_val);
25608 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025609 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25610 des_xmlDocPtr(n_doc, doc, 1);
25611 des_xmlNodePtr(n_elem, elem, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000025612 des_const_xmlChar_ptr(n_qname, (const xmlChar *)qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025613 xmlResetLastError();
25614 if (mem_base != xmlMemBlocks()) {
25615 printf("Leak of %d blocks found in xmlValidatePopElement",
25616 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025617 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025618 printf(" %d", n_ctxt);
25619 printf(" %d", n_doc);
25620 printf(" %d", n_elem);
25621 printf(" %d", n_qname);
25622 printf("\n");
25623 }
25624 }
25625 }
25626 }
25627 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025628 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025629#endif
25630
Daniel Veillard42595322004-11-08 10:52:06 +000025631 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025632}
25633
25634
25635static int
25636test_xmlValidatePushCData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025637 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025638
William M. Brack21e4ef22005-01-02 09:53:13 +000025639#if defined(LIBXML_VALID_ENABLED) && defined(LIBXML_REGEXP_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025640 int mem_base;
25641 int ret_val;
25642 xmlValidCtxtPtr ctxt; /* the validation context */
25643 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025644 xmlChar * data; /* some character data read */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025645 int n_data;
25646 int len; /* the lenght of the data */
25647 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025648
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025649 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25650 for (n_data = 0;n_data < gen_nb_const_xmlChar_ptr;n_data++) {
25651 for (n_len = 0;n_len < gen_nb_int;n_len++) {
25652 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025653 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25654 data = gen_const_xmlChar_ptr(n_data, 1);
25655 len = gen_int(n_len, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025656
William M. Brackf13f77f2004-11-12 16:03:48 +000025657 ret_val = xmlValidatePushCData(ctxt, (const xmlChar *)data, len);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025658 desret_int(ret_val);
25659 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025660 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000025661 des_const_xmlChar_ptr(n_data, (const xmlChar *)data, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000025662 des_int(n_len, len, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025663 xmlResetLastError();
25664 if (mem_base != xmlMemBlocks()) {
25665 printf("Leak of %d blocks found in xmlValidatePushCData",
25666 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025667 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025668 printf(" %d", n_ctxt);
25669 printf(" %d", n_data);
25670 printf(" %d", n_len);
25671 printf("\n");
25672 }
25673 }
25674 }
25675 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025676 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025677#endif
25678
Daniel Veillard42595322004-11-08 10:52:06 +000025679 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025680}
25681
25682
25683static int
25684test_xmlValidatePushElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025685 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025686
William M. Brack21e4ef22005-01-02 09:53:13 +000025687#if defined(LIBXML_VALID_ENABLED) && defined(LIBXML_REGEXP_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025688 int mem_base;
25689 int ret_val;
25690 xmlValidCtxtPtr ctxt; /* the validation context */
25691 int n_ctxt;
25692 xmlDocPtr doc; /* a document instance */
25693 int n_doc;
25694 xmlNodePtr elem; /* an element instance */
25695 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025696 xmlChar * qname; /* the qualified name as appearing in the serialization */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025697 int n_qname;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025698
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025699 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25700 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25701 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25702 for (n_qname = 0;n_qname < gen_nb_const_xmlChar_ptr;n_qname++) {
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);
25707 qname = gen_const_xmlChar_ptr(n_qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025708
William M. Brackf13f77f2004-11-12 16:03:48 +000025709 ret_val = xmlValidatePushElement(ctxt, doc, elem, (const xmlChar *)qname);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025710 desret_int(ret_val);
25711 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025712 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25713 des_xmlDocPtr(n_doc, doc, 1);
25714 des_xmlNodePtr(n_elem, elem, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000025715 des_const_xmlChar_ptr(n_qname, (const xmlChar *)qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025716 xmlResetLastError();
25717 if (mem_base != xmlMemBlocks()) {
25718 printf("Leak of %d blocks found in xmlValidatePushElement",
25719 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025720 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025721 printf(" %d", n_ctxt);
25722 printf(" %d", n_doc);
25723 printf(" %d", n_elem);
25724 printf(" %d", n_qname);
25725 printf("\n");
25726 }
25727 }
25728 }
25729 }
25730 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025731 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025732#endif
25733
Daniel Veillard42595322004-11-08 10:52:06 +000025734 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025735}
25736
25737
25738static int
25739test_xmlValidateRoot(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025740 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025741
William M. Brack21e4ef22005-01-02 09:53:13 +000025742#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025743 int mem_base;
25744 int ret_val;
25745 xmlValidCtxtPtr ctxt; /* the validation context */
25746 int n_ctxt;
25747 xmlDocPtr doc; /* a document instance */
25748 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025749
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025750 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25751 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25752 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025753 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25754 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025755
25756 ret_val = xmlValidateRoot(ctxt, doc);
25757 desret_int(ret_val);
25758 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025759 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25760 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025761 xmlResetLastError();
25762 if (mem_base != xmlMemBlocks()) {
25763 printf("Leak of %d blocks found in xmlValidateRoot",
25764 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025765 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025766 printf(" %d", n_ctxt);
25767 printf(" %d", n_doc);
25768 printf("\n");
25769 }
25770 }
25771 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025772 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025773#endif
25774
Daniel Veillard42595322004-11-08 10:52:06 +000025775 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025776}
25777
25778static int
25779test_valid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025780 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025781
William M. Brack094dd862004-11-14 14:28:34 +000025782 if (quiet == 0) printf("Testing valid : 48 of 67 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000025783 test_ret += test_xmlAddAttributeDecl();
25784 test_ret += test_xmlAddElementDecl();
25785 test_ret += test_xmlAddID();
25786 test_ret += test_xmlAddNotationDecl();
25787 test_ret += test_xmlAddRef();
25788 test_ret += test_xmlCopyAttributeTable();
25789 test_ret += test_xmlCopyElementContent();
25790 test_ret += test_xmlCopyElementTable();
25791 test_ret += test_xmlCopyEnumeration();
25792 test_ret += test_xmlCopyNotationTable();
25793 test_ret += test_xmlCreateEnumeration();
25794 test_ret += test_xmlDumpAttributeDecl();
25795 test_ret += test_xmlDumpAttributeTable();
25796 test_ret += test_xmlDumpElementDecl();
25797 test_ret += test_xmlDumpElementTable();
25798 test_ret += test_xmlDumpNotationDecl();
25799 test_ret += test_xmlDumpNotationTable();
25800 test_ret += test_xmlGetDtdAttrDesc();
25801 test_ret += test_xmlGetDtdElementDesc();
25802 test_ret += test_xmlGetDtdNotationDesc();
25803 test_ret += test_xmlGetDtdQAttrDesc();
25804 test_ret += test_xmlGetDtdQElementDesc();
25805 test_ret += test_xmlGetID();
25806 test_ret += test_xmlGetRefs();
25807 test_ret += test_xmlIsID();
25808 test_ret += test_xmlIsMixedElement();
25809 test_ret += test_xmlIsRef();
25810 test_ret += test_xmlNewElementContent();
25811 test_ret += test_xmlNewValidCtxt();
25812 test_ret += test_xmlRemoveID();
25813 test_ret += test_xmlRemoveRef();
25814 test_ret += test_xmlSnprintfElementContent();
25815 test_ret += test_xmlSprintfElementContent();
25816 test_ret += test_xmlValidBuildContentModel();
25817 test_ret += test_xmlValidCtxtNormalizeAttributeValue();
25818 test_ret += test_xmlValidGetPotentialChildren();
25819 test_ret += test_xmlValidGetValidElements();
25820 test_ret += test_xmlValidNormalizeAttributeValue();
25821 test_ret += test_xmlValidateAttributeDecl();
25822 test_ret += test_xmlValidateAttributeValue();
25823 test_ret += test_xmlValidateDocument();
25824 test_ret += test_xmlValidateDocumentFinal();
25825 test_ret += test_xmlValidateDtd();
25826 test_ret += test_xmlValidateDtdFinal();
25827 test_ret += test_xmlValidateElement();
25828 test_ret += test_xmlValidateElementDecl();
25829 test_ret += test_xmlValidateNameValue();
25830 test_ret += test_xmlValidateNamesValue();
25831 test_ret += test_xmlValidateNmtokenValue();
25832 test_ret += test_xmlValidateNmtokensValue();
25833 test_ret += test_xmlValidateNotationDecl();
25834 test_ret += test_xmlValidateNotationUse();
25835 test_ret += test_xmlValidateOneAttribute();
25836 test_ret += test_xmlValidateOneElement();
25837 test_ret += test_xmlValidateOneNamespace();
25838 test_ret += test_xmlValidatePopElement();
25839 test_ret += test_xmlValidatePushCData();
25840 test_ret += test_xmlValidatePushElement();
25841 test_ret += test_xmlValidateRoot();
Daniel Veillardd93f6252004-11-02 15:53:51 +000025842
Daniel Veillard42595322004-11-08 10:52:06 +000025843 if (test_ret != 0)
25844 printf("Module valid: %d errors\n", test_ret);
25845 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025846}
25847
25848static int
25849test_xmlXIncludeNewContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025850 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025851
25852
25853 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000025854 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025855}
25856
25857
25858static int
25859test_xmlXIncludeProcess(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_XINCLUDE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000025863 int mem_base;
25864 int ret_val;
25865 xmlDocPtr doc; /* an XML document */
25866 int n_doc;
25867
25868 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25869 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025870 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025871
25872 ret_val = xmlXIncludeProcess(doc);
25873 desret_int(ret_val);
25874 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025875 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025876 xmlResetLastError();
25877 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025878 printf("Leak of %d blocks found in xmlXIncludeProcess",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025879 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025880 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025881 printf(" %d", n_doc);
25882 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025883 }
25884 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025885 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025886#endif
25887
Daniel Veillard42595322004-11-08 10:52:06 +000025888 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025889}
25890
25891
25892static int
25893test_xmlXIncludeProcessFlags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025894 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025895
William M. Brack21e4ef22005-01-02 09:53:13 +000025896#if defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000025897 int mem_base;
25898 int ret_val;
25899 xmlDocPtr doc; /* an XML document */
25900 int n_doc;
25901 int flags; /* a set of xmlParserOption used for parsing XML includes */
25902 int n_flags;
25903
25904 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25905 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
25906 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025907 doc = gen_xmlDocPtr(n_doc, 0);
25908 flags = gen_int(n_flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025909
25910 ret_val = xmlXIncludeProcessFlags(doc, flags);
25911 desret_int(ret_val);
25912 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025913 des_xmlDocPtr(n_doc, doc, 0);
25914 des_int(n_flags, flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025915 xmlResetLastError();
25916 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025917 printf("Leak of %d blocks found in xmlXIncludeProcessFlags",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025918 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025919 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025920 printf(" %d", n_doc);
25921 printf(" %d", n_flags);
25922 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025923 }
25924 }
25925 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025926 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025927#endif
25928
Daniel Veillard42595322004-11-08 10:52:06 +000025929 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025930}
25931
Daniel Veillarda521d282004-11-09 14:59:59 +000025932#ifdef LIBXML_XINCLUDE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000025933
Daniel Veillardce682bc2004-11-05 17:22:25 +000025934#define gen_nb_xmlXIncludeCtxtPtr 1
25935static xmlXIncludeCtxtPtr gen_xmlXIncludeCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
25936 return(NULL);
25937}
25938static void des_xmlXIncludeCtxtPtr(int no ATTRIBUTE_UNUSED, xmlXIncludeCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
25939}
Daniel Veillarda521d282004-11-09 14:59:59 +000025940#endif
25941
Daniel Veillardce682bc2004-11-05 17:22:25 +000025942
Daniel Veillardd93f6252004-11-02 15:53:51 +000025943static int
25944test_xmlXIncludeProcessNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025945 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025946
William M. Brack21e4ef22005-01-02 09:53:13 +000025947#if defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000025948 int mem_base;
25949 int ret_val;
25950 xmlXIncludeCtxtPtr ctxt; /* an existing XInclude context */
25951 int n_ctxt;
25952 xmlNodePtr node; /* a node in an XML document */
25953 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025954
Daniel Veillardce682bc2004-11-05 17:22:25 +000025955 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXIncludeCtxtPtr;n_ctxt++) {
25956 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
25957 mem_base = xmlMemBlocks();
25958 ctxt = gen_xmlXIncludeCtxtPtr(n_ctxt, 0);
25959 node = gen_xmlNodePtr(n_node, 1);
25960
25961 ret_val = xmlXIncludeProcessNode(ctxt, node);
25962 desret_int(ret_val);
25963 call_tests++;
25964 des_xmlXIncludeCtxtPtr(n_ctxt, ctxt, 0);
25965 des_xmlNodePtr(n_node, node, 1);
25966 xmlResetLastError();
25967 if (mem_base != xmlMemBlocks()) {
25968 printf("Leak of %d blocks found in xmlXIncludeProcessNode",
25969 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025970 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025971 printf(" %d", n_ctxt);
25972 printf(" %d", n_node);
25973 printf("\n");
25974 }
25975 }
25976 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025977 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025978#endif
25979
Daniel Veillard42595322004-11-08 10:52:06 +000025980 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025981}
25982
25983
25984static int
25985test_xmlXIncludeProcessTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025986 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025987
William M. Brack21e4ef22005-01-02 09:53:13 +000025988#if defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000025989 int mem_base;
25990 int ret_val;
25991 xmlNodePtr tree; /* a node in an XML document */
25992 int n_tree;
25993
25994 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
25995 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025996 tree = gen_xmlNodePtr(n_tree, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025997
25998 ret_val = xmlXIncludeProcessTree(tree);
25999 desret_int(ret_val);
26000 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026001 des_xmlNodePtr(n_tree, tree, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026002 xmlResetLastError();
26003 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026004 printf("Leak of %d blocks found in xmlXIncludeProcessTree",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026005 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026006 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026007 printf(" %d", n_tree);
26008 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026009 }
26010 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026011 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026012#endif
26013
Daniel Veillard42595322004-11-08 10:52:06 +000026014 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026015}
26016
26017
26018static int
26019test_xmlXIncludeProcessTreeFlags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026020 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026021
William M. Brack21e4ef22005-01-02 09:53:13 +000026022#if defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000026023 int mem_base;
26024 int ret_val;
26025 xmlNodePtr tree; /* a node in an XML document */
26026 int n_tree;
26027 int flags; /* a set of xmlParserOption used for parsing XML includes */
26028 int n_flags;
26029
26030 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
26031 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
26032 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026033 tree = gen_xmlNodePtr(n_tree, 0);
26034 flags = gen_int(n_flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026035
26036 ret_val = xmlXIncludeProcessTreeFlags(tree, flags);
26037 desret_int(ret_val);
26038 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026039 des_xmlNodePtr(n_tree, tree, 0);
26040 des_int(n_flags, flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026041 xmlResetLastError();
26042 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026043 printf("Leak of %d blocks found in xmlXIncludeProcessTreeFlags",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026044 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026045 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026046 printf(" %d", n_tree);
26047 printf(" %d", n_flags);
26048 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026049 }
26050 }
26051 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026052 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026053#endif
26054
Daniel Veillard42595322004-11-08 10:52:06 +000026055 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026056}
26057
26058
26059static int
26060test_xmlXIncludeSetFlags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026061 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026062
William M. Brack21e4ef22005-01-02 09:53:13 +000026063#if defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000026064 int mem_base;
26065 int ret_val;
26066 xmlXIncludeCtxtPtr ctxt; /* an XInclude processing context */
26067 int n_ctxt;
26068 int flags; /* a set of xmlParserOption used for parsing XML includes */
26069 int n_flags;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026070
Daniel Veillardce682bc2004-11-05 17:22:25 +000026071 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXIncludeCtxtPtr;n_ctxt++) {
26072 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
26073 mem_base = xmlMemBlocks();
26074 ctxt = gen_xmlXIncludeCtxtPtr(n_ctxt, 0);
26075 flags = gen_int(n_flags, 1);
26076
26077 ret_val = xmlXIncludeSetFlags(ctxt, flags);
26078 desret_int(ret_val);
26079 call_tests++;
26080 des_xmlXIncludeCtxtPtr(n_ctxt, ctxt, 0);
26081 des_int(n_flags, flags, 1);
26082 xmlResetLastError();
26083 if (mem_base != xmlMemBlocks()) {
26084 printf("Leak of %d blocks found in xmlXIncludeSetFlags",
26085 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026086 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026087 printf(" %d", n_ctxt);
26088 printf(" %d", n_flags);
26089 printf("\n");
26090 }
26091 }
26092 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026093 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026094#endif
26095
Daniel Veillard42595322004-11-08 10:52:06 +000026096 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026097}
26098
26099static int
26100test_xinclude(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026101 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026102
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026103 if (quiet == 0) printf("Testing xinclude : 6 of 8 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000026104 test_ret += test_xmlXIncludeNewContext();
26105 test_ret += test_xmlXIncludeProcess();
26106 test_ret += test_xmlXIncludeProcessFlags();
26107 test_ret += test_xmlXIncludeProcessNode();
26108 test_ret += test_xmlXIncludeProcessTree();
26109 test_ret += test_xmlXIncludeProcessTreeFlags();
26110 test_ret += test_xmlXIncludeSetFlags();
Daniel Veillardd93f6252004-11-02 15:53:51 +000026111
Daniel Veillard42595322004-11-08 10:52:06 +000026112 if (test_ret != 0)
26113 printf("Module xinclude: %d errors\n", test_ret);
26114 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026115}
26116
26117static int
26118test_xmlAllocOutputBuffer(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_OUTPUT_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000026122 int mem_base;
26123 xmlOutputBufferPtr ret_val;
26124 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
26125 int n_encoder;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026126
Daniel Veillard3d95c732004-11-06 22:25:14 +000026127 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
26128 mem_base = xmlMemBlocks();
26129 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 0);
26130
26131 ret_val = xmlAllocOutputBuffer(encoder);
26132 desret_xmlOutputBufferPtr(ret_val);
26133 call_tests++;
26134 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 0);
26135 xmlResetLastError();
26136 if (mem_base != xmlMemBlocks()) {
26137 printf("Leak of %d blocks found in xmlAllocOutputBuffer",
26138 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026139 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000026140 printf(" %d", n_encoder);
26141 printf("\n");
26142 }
26143 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026144 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000026145#endif
26146
Daniel Veillard42595322004-11-08 10:52:06 +000026147 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026148}
26149
26150
26151static int
26152test_xmlAllocParserInputBuffer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026153 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026154
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026155 int mem_base;
26156 xmlParserInputBufferPtr ret_val;
26157 xmlCharEncoding enc; /* the charset encoding if known */
26158 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026159
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026160 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
26161 mem_base = xmlMemBlocks();
26162 enc = gen_xmlCharEncoding(n_enc, 0);
26163
26164 ret_val = xmlAllocParserInputBuffer(enc);
26165 desret_xmlParserInputBufferPtr(ret_val);
26166 call_tests++;
26167 des_xmlCharEncoding(n_enc, enc, 0);
26168 xmlResetLastError();
26169 if (mem_base != xmlMemBlocks()) {
26170 printf("Leak of %d blocks found in xmlAllocParserInputBuffer",
26171 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026172 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026173 printf(" %d", n_enc);
26174 printf("\n");
26175 }
26176 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026177 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026178
Daniel Veillard42595322004-11-08 10:52:06 +000026179 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026180}
26181
26182
26183static int
26184test_xmlCheckFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026185 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026186
26187 int mem_base;
26188 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026189 char * path; /* the path to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000026190 int n_path;
26191
26192 for (n_path = 0;n_path < gen_nb_const_char_ptr;n_path++) {
26193 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026194 path = gen_const_char_ptr(n_path, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026195
William M. Brackf13f77f2004-11-12 16:03:48 +000026196 ret_val = xmlCheckFilename((const char *)path);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026197 desret_int(ret_val);
26198 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000026199 des_const_char_ptr(n_path, (const char *)path, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026200 xmlResetLastError();
26201 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026202 printf("Leak of %d blocks found in xmlCheckFilename",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026203 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026204 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026205 printf(" %d", n_path);
26206 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026207 }
26208 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026209 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026210
Daniel Veillard42595322004-11-08 10:52:06 +000026211 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026212}
26213
26214
26215static int
26216test_xmlCheckHTTPInput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026217 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026218
Daniel Veillard42595322004-11-08 10:52:06 +000026219 int mem_base;
26220 xmlParserInputPtr ret_val;
26221 xmlParserCtxtPtr ctxt; /* an XML parser context */
26222 int n_ctxt;
26223 xmlParserInputPtr ret; /* an XML parser input */
26224 int n_ret;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026225
Daniel Veillard42595322004-11-08 10:52:06 +000026226 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
26227 for (n_ret = 0;n_ret < gen_nb_xmlParserInputPtr;n_ret++) {
26228 mem_base = xmlMemBlocks();
26229 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
26230 ret = gen_xmlParserInputPtr(n_ret, 1);
26231
26232 ret_val = xmlCheckHTTPInput(ctxt, ret);
26233 desret_xmlParserInputPtr(ret_val);
26234 call_tests++;
26235 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
26236 des_xmlParserInputPtr(n_ret, ret, 1);
26237 xmlResetLastError();
26238 if (mem_base != xmlMemBlocks()) {
26239 printf("Leak of %d blocks found in xmlCheckHTTPInput",
26240 xmlMemBlocks() - mem_base);
26241 test_ret++;
26242 printf(" %d", n_ctxt);
26243 printf(" %d", n_ret);
26244 printf("\n");
26245 }
26246 }
26247 }
Daniel Veillard42595322004-11-08 10:52:06 +000026248 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026249
Daniel Veillard42595322004-11-08 10:52:06 +000026250 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026251}
26252
26253
26254static int
26255test_xmlCleanupInputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026256 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026257
26258 int mem_base;
26259
26260 mem_base = xmlMemBlocks();
26261
26262 xmlCleanupInputCallbacks();
26263 call_tests++;
26264 xmlResetLastError();
26265 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026266 printf("Leak of %d blocks found in xmlCleanupInputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026267 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026268 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026269 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026270 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026271 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026272
Daniel Veillard42595322004-11-08 10:52:06 +000026273 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026274}
26275
26276
26277static int
26278test_xmlCleanupOutputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026279 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026280
William M. Brack21e4ef22005-01-02 09:53:13 +000026281#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000026282 int mem_base;
26283
26284 mem_base = xmlMemBlocks();
26285
26286 xmlCleanupOutputCallbacks();
26287 call_tests++;
26288 xmlResetLastError();
26289 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026290 printf("Leak of %d blocks found in xmlCleanupOutputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026291 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026292 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026293 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026294 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026295 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026296#endif
26297
Daniel Veillard42595322004-11-08 10:52:06 +000026298 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026299}
26300
26301
26302static int
26303test_xmlFileClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026304 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026305
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026306 int mem_base;
26307 int ret_val;
26308 void * context; /* the I/O context */
26309 int n_context;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026310
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026311 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26312 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026313 context = gen_void_ptr(n_context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026314
26315 ret_val = xmlFileClose(context);
26316 desret_int(ret_val);
26317 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026318 des_void_ptr(n_context, context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026319 xmlResetLastError();
26320 if (mem_base != xmlMemBlocks()) {
26321 printf("Leak of %d blocks found in xmlFileClose",
26322 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026323 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026324 printf(" %d", n_context);
26325 printf("\n");
26326 }
26327 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026328 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026329
Daniel Veillard42595322004-11-08 10:52:06 +000026330 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026331}
26332
26333
26334static int
26335test_xmlFileMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026336 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026337
26338 int mem_base;
26339 int ret_val;
26340 const char * filename; /* the URI for matching */
26341 int n_filename;
26342
26343 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26344 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026345 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026346
26347 ret_val = xmlFileMatch(filename);
26348 desret_int(ret_val);
26349 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026350 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026351 xmlResetLastError();
26352 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026353 printf("Leak of %d blocks found in xmlFileMatch",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026354 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026355 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026356 printf(" %d", n_filename);
26357 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026358 }
26359 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026360 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026361
Daniel Veillard42595322004-11-08 10:52:06 +000026362 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026363}
26364
26365
26366static int
26367test_xmlFileOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026368 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026369
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026370 int mem_base;
26371 void * ret_val;
26372 const char * filename; /* the URI for matching */
26373 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026374
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026375 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26376 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026377 filename = gen_filepath(n_filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026378
26379 ret_val = xmlFileOpen(filename);
26380 desret_void_ptr(ret_val);
26381 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026382 des_filepath(n_filename, filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026383 xmlResetLastError();
26384 if (mem_base != xmlMemBlocks()) {
26385 printf("Leak of %d blocks found in xmlFileOpen",
26386 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026387 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026388 printf(" %d", n_filename);
26389 printf("\n");
26390 }
26391 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026392 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026393
Daniel Veillard42595322004-11-08 10:52:06 +000026394 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026395}
26396
26397
26398static int
26399test_xmlFileRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026400 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026401
Daniel Veillardce682bc2004-11-05 17:22:25 +000026402 int mem_base;
26403 int ret_val;
26404 void * context; /* the I/O context */
26405 int n_context;
26406 char * buffer; /* where to drop data */
26407 int n_buffer;
26408 int len; /* number of bytes to write */
26409 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026410
Daniel Veillardce682bc2004-11-05 17:22:25 +000026411 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26412 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
26413 for (n_len = 0;n_len < gen_nb_int;n_len++) {
26414 mem_base = xmlMemBlocks();
26415 context = gen_void_ptr(n_context, 0);
26416 buffer = gen_char_ptr(n_buffer, 1);
26417 len = gen_int(n_len, 2);
26418
26419 ret_val = xmlFileRead(context, buffer, len);
26420 desret_int(ret_val);
26421 call_tests++;
26422 des_void_ptr(n_context, context, 0);
26423 des_char_ptr(n_buffer, buffer, 1);
26424 des_int(n_len, len, 2);
26425 xmlResetLastError();
26426 if (mem_base != xmlMemBlocks()) {
26427 printf("Leak of %d blocks found in xmlFileRead",
26428 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026429 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026430 printf(" %d", n_context);
26431 printf(" %d", n_buffer);
26432 printf(" %d", n_len);
26433 printf("\n");
26434 }
26435 }
26436 }
26437 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000026438 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026439
Daniel Veillard42595322004-11-08 10:52:06 +000026440 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026441}
26442
26443
26444static int
26445test_xmlIOFTPClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026446 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026447
William M. Brack21e4ef22005-01-02 09:53:13 +000026448#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026449 int mem_base;
26450 int ret_val;
26451 void * context; /* the I/O context */
26452 int n_context;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026453
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026454 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26455 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026456 context = gen_void_ptr(n_context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026457
26458 ret_val = xmlIOFTPClose(context);
26459 desret_int(ret_val);
26460 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026461 des_void_ptr(n_context, context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026462 xmlResetLastError();
26463 if (mem_base != xmlMemBlocks()) {
26464 printf("Leak of %d blocks found in xmlIOFTPClose",
26465 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026466 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026467 printf(" %d", n_context);
26468 printf("\n");
26469 }
26470 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026471 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026472#endif
26473
Daniel Veillard42595322004-11-08 10:52:06 +000026474 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026475}
26476
26477
26478static int
26479test_xmlIOFTPMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026480 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026481
William M. Brack21e4ef22005-01-02 09:53:13 +000026482#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000026483 int mem_base;
26484 int ret_val;
26485 const char * filename; /* the URI for matching */
26486 int n_filename;
26487
26488 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26489 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026490 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026491
26492 ret_val = xmlIOFTPMatch(filename);
26493 desret_int(ret_val);
26494 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026495 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026496 xmlResetLastError();
26497 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026498 printf("Leak of %d blocks found in xmlIOFTPMatch",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026499 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026500 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026501 printf(" %d", n_filename);
26502 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026503 }
26504 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026505 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026506#endif
26507
Daniel Veillard42595322004-11-08 10:52:06 +000026508 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026509}
26510
26511
26512static int
26513test_xmlIOFTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026514 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026515
William M. Brack21e4ef22005-01-02 09:53:13 +000026516#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026517 int mem_base;
26518 void * ret_val;
26519 const char * filename; /* the URI for matching */
26520 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026521
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026522 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26523 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026524 filename = gen_filepath(n_filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026525
26526 ret_val = xmlIOFTPOpen(filename);
26527 desret_void_ptr(ret_val);
26528 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026529 des_filepath(n_filename, filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026530 xmlResetLastError();
26531 if (mem_base != xmlMemBlocks()) {
26532 printf("Leak of %d blocks found in xmlIOFTPOpen",
26533 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026534 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026535 printf(" %d", n_filename);
26536 printf("\n");
26537 }
26538 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026539 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026540#endif
26541
Daniel Veillard42595322004-11-08 10:52:06 +000026542 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026543}
26544
26545
26546static int
26547test_xmlIOFTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026548 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026549
William M. Brack21e4ef22005-01-02 09:53:13 +000026550#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000026551 int mem_base;
26552 int ret_val;
26553 void * context; /* the I/O context */
26554 int n_context;
26555 char * buffer; /* where to drop data */
26556 int n_buffer;
26557 int len; /* number of bytes to write */
26558 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026559
Daniel Veillardce682bc2004-11-05 17:22:25 +000026560 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26561 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
26562 for (n_len = 0;n_len < gen_nb_int;n_len++) {
26563 mem_base = xmlMemBlocks();
26564 context = gen_void_ptr(n_context, 0);
26565 buffer = gen_char_ptr(n_buffer, 1);
26566 len = gen_int(n_len, 2);
26567
26568 ret_val = xmlIOFTPRead(context, buffer, len);
26569 desret_int(ret_val);
26570 call_tests++;
26571 des_void_ptr(n_context, context, 0);
26572 des_char_ptr(n_buffer, buffer, 1);
26573 des_int(n_len, len, 2);
26574 xmlResetLastError();
26575 if (mem_base != xmlMemBlocks()) {
26576 printf("Leak of %d blocks found in xmlIOFTPRead",
26577 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026578 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026579 printf(" %d", n_context);
26580 printf(" %d", n_buffer);
26581 printf(" %d", n_len);
26582 printf("\n");
26583 }
26584 }
26585 }
26586 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026587 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026588#endif
26589
Daniel Veillard42595322004-11-08 10:52:06 +000026590 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026591}
26592
26593
26594static int
26595test_xmlIOHTTPClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026596 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026597
William M. Brack21e4ef22005-01-02 09:53:13 +000026598#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026599 int mem_base;
26600 int ret_val;
26601 void * context; /* the I/O context */
26602 int n_context;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026603
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026604 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26605 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026606 context = gen_void_ptr(n_context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026607
26608 ret_val = xmlIOHTTPClose(context);
26609 desret_int(ret_val);
26610 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026611 des_void_ptr(n_context, context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026612 xmlResetLastError();
26613 if (mem_base != xmlMemBlocks()) {
26614 printf("Leak of %d blocks found in xmlIOHTTPClose",
26615 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026616 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026617 printf(" %d", n_context);
26618 printf("\n");
26619 }
26620 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026621 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026622#endif
26623
Daniel Veillard42595322004-11-08 10:52:06 +000026624 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026625}
26626
26627
26628static int
26629test_xmlIOHTTPMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026630 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026631
William M. Brack21e4ef22005-01-02 09:53:13 +000026632#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000026633 int mem_base;
26634 int ret_val;
26635 const char * filename; /* the URI for matching */
26636 int n_filename;
26637
26638 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26639 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026640 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026641
26642 ret_val = xmlIOHTTPMatch(filename);
26643 desret_int(ret_val);
26644 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026645 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026646 xmlResetLastError();
26647 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026648 printf("Leak of %d blocks found in xmlIOHTTPMatch",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026649 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026650 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026651 printf(" %d", n_filename);
26652 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026653 }
26654 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026655 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026656#endif
26657
Daniel Veillard42595322004-11-08 10:52:06 +000026658 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026659}
26660
26661
26662static int
26663test_xmlIOHTTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026664 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026665
William M. Brack21e4ef22005-01-02 09:53:13 +000026666#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026667 int mem_base;
26668 void * ret_val;
26669 const char * filename; /* the URI for matching */
26670 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026671
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026672 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26673 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026674 filename = gen_filepath(n_filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026675
26676 ret_val = xmlIOHTTPOpen(filename);
26677 desret_void_ptr(ret_val);
26678 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026679 des_filepath(n_filename, filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026680 xmlResetLastError();
26681 if (mem_base != xmlMemBlocks()) {
26682 printf("Leak of %d blocks found in xmlIOHTTPOpen",
26683 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026684 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026685 printf(" %d", n_filename);
26686 printf("\n");
26687 }
26688 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026689 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026690#endif
26691
Daniel Veillard42595322004-11-08 10:52:06 +000026692 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026693}
26694
26695
26696static int
26697test_xmlIOHTTPOpenW(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026698 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026699
26700
26701 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000026702 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026703}
26704
26705
26706static int
26707test_xmlIOHTTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026708 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026709
William M. Brack21e4ef22005-01-02 09:53:13 +000026710#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000026711 int mem_base;
26712 int ret_val;
26713 void * context; /* the I/O context */
26714 int n_context;
26715 char * buffer; /* where to drop data */
26716 int n_buffer;
26717 int len; /* number of bytes to write */
26718 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026719
Daniel Veillardce682bc2004-11-05 17:22:25 +000026720 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26721 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
26722 for (n_len = 0;n_len < gen_nb_int;n_len++) {
26723 mem_base = xmlMemBlocks();
26724 context = gen_void_ptr(n_context, 0);
26725 buffer = gen_char_ptr(n_buffer, 1);
26726 len = gen_int(n_len, 2);
26727
26728 ret_val = xmlIOHTTPRead(context, buffer, len);
26729 desret_int(ret_val);
26730 call_tests++;
26731 des_void_ptr(n_context, context, 0);
26732 des_char_ptr(n_buffer, buffer, 1);
26733 des_int(n_len, len, 2);
26734 xmlResetLastError();
26735 if (mem_base != xmlMemBlocks()) {
26736 printf("Leak of %d blocks found in xmlIOHTTPRead",
26737 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026738 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026739 printf(" %d", n_context);
26740 printf(" %d", n_buffer);
26741 printf(" %d", n_len);
26742 printf("\n");
26743 }
26744 }
26745 }
26746 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026747 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026748#endif
26749
Daniel Veillard42595322004-11-08 10:52:06 +000026750 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026751}
26752
26753
26754static int
26755test_xmlNoNetExternalEntityLoader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026756 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026757
Daniel Veillard42595322004-11-08 10:52:06 +000026758 int mem_base;
26759 xmlParserInputPtr ret_val;
26760 const char * URL; /* the URL for the entity to load */
26761 int n_URL;
26762 char * ID; /* the System ID for the entity to load */
26763 int n_ID;
26764 xmlParserCtxtPtr ctxt; /* the context in which the entity is called or NULL */
26765 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026766
Daniel Veillard42595322004-11-08 10:52:06 +000026767 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
26768 for (n_ID = 0;n_ID < gen_nb_const_char_ptr;n_ID++) {
26769 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
26770 mem_base = xmlMemBlocks();
26771 URL = gen_filepath(n_URL, 0);
26772 ID = gen_const_char_ptr(n_ID, 1);
26773 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 2);
26774
William M. Brackf13f77f2004-11-12 16:03:48 +000026775 ret_val = xmlNoNetExternalEntityLoader(URL, (const char *)ID, ctxt);
Daniel Veillard42595322004-11-08 10:52:06 +000026776 desret_xmlParserInputPtr(ret_val);
26777 call_tests++;
26778 des_filepath(n_URL, URL, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000026779 des_const_char_ptr(n_ID, (const char *)ID, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000026780 des_xmlParserCtxtPtr(n_ctxt, ctxt, 2);
26781 xmlResetLastError();
26782 if (mem_base != xmlMemBlocks()) {
26783 printf("Leak of %d blocks found in xmlNoNetExternalEntityLoader",
26784 xmlMemBlocks() - mem_base);
26785 test_ret++;
26786 printf(" %d", n_URL);
26787 printf(" %d", n_ID);
26788 printf(" %d", n_ctxt);
26789 printf("\n");
26790 }
26791 }
26792 }
26793 }
Daniel Veillard42595322004-11-08 10:52:06 +000026794 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026795
Daniel Veillard42595322004-11-08 10:52:06 +000026796 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026797}
26798
26799
26800static int
26801test_xmlNormalizeWindowsPath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026802 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026803
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026804 int mem_base;
26805 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026806 xmlChar * path; /* the input file path */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026807 int n_path;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026808
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026809 for (n_path = 0;n_path < gen_nb_const_xmlChar_ptr;n_path++) {
26810 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026811 path = gen_const_xmlChar_ptr(n_path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026812
William M. Brackf13f77f2004-11-12 16:03:48 +000026813 ret_val = xmlNormalizeWindowsPath((const xmlChar *)path);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026814 desret_xmlChar_ptr(ret_val);
26815 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000026816 des_const_xmlChar_ptr(n_path, (const xmlChar *)path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026817 xmlResetLastError();
26818 if (mem_base != xmlMemBlocks()) {
26819 printf("Leak of %d blocks found in xmlNormalizeWindowsPath",
26820 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026821 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026822 printf(" %d", n_path);
26823 printf("\n");
26824 }
26825 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026826 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026827
Daniel Veillard42595322004-11-08 10:52:06 +000026828 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026829}
26830
26831
26832static int
26833test_xmlOutputBufferCreateFd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026834 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026835
William M. Brack21e4ef22005-01-02 09:53:13 +000026836#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000026837 int mem_base;
26838 xmlOutputBufferPtr ret_val;
26839 int fd; /* a file descriptor number */
26840 int n_fd;
26841 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
26842 int n_encoder;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026843
Daniel Veillard3d95c732004-11-06 22:25:14 +000026844 for (n_fd = 0;n_fd < gen_nb_int;n_fd++) {
26845 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
26846 mem_base = xmlMemBlocks();
26847 fd = gen_int(n_fd, 0);
26848 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 1);
26849
26850 ret_val = xmlOutputBufferCreateFd(fd, encoder);
26851 desret_xmlOutputBufferPtr(ret_val);
26852 call_tests++;
26853 des_int(n_fd, fd, 0);
26854 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 1);
26855 xmlResetLastError();
26856 if (mem_base != xmlMemBlocks()) {
26857 printf("Leak of %d blocks found in xmlOutputBufferCreateFd",
26858 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026859 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000026860 printf(" %d", n_fd);
26861 printf(" %d", n_encoder);
26862 printf("\n");
26863 }
26864 }
26865 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026866 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000026867#endif
26868
Daniel Veillard42595322004-11-08 10:52:06 +000026869 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026870}
26871
26872
26873static int
26874test_xmlOutputBufferCreateFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026875 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026876
William M. Brack21e4ef22005-01-02 09:53:13 +000026877#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000026878 int mem_base;
26879 xmlOutputBufferPtr ret_val;
26880 FILE * file; /* a FILE* */
26881 int n_file;
26882 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
26883 int n_encoder;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026884
Daniel Veillard3d95c732004-11-06 22:25:14 +000026885 for (n_file = 0;n_file < gen_nb_FILE_ptr;n_file++) {
26886 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
26887 mem_base = xmlMemBlocks();
26888 file = gen_FILE_ptr(n_file, 0);
26889 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 1);
26890
26891 ret_val = xmlOutputBufferCreateFile(file, encoder);
26892 desret_xmlOutputBufferPtr(ret_val);
26893 call_tests++;
26894 des_FILE_ptr(n_file, file, 0);
26895 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 1);
26896 xmlResetLastError();
26897 if (mem_base != xmlMemBlocks()) {
26898 printf("Leak of %d blocks found in xmlOutputBufferCreateFile",
26899 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026900 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000026901 printf(" %d", n_file);
26902 printf(" %d", n_encoder);
26903 printf("\n");
26904 }
26905 }
26906 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026907 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000026908#endif
26909
Daniel Veillard42595322004-11-08 10:52:06 +000026910 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026911}
26912
26913
26914static int
26915test_xmlOutputBufferCreateFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026916 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026917
William M. Brack21e4ef22005-01-02 09:53:13 +000026918#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000026919 int mem_base;
26920 xmlOutputBufferPtr ret_val;
26921 const char * URI; /* a C string containing the URI or filename */
26922 int n_URI;
26923 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
26924 int n_encoder;
26925 int compression; /* the compression ration (0 none, 9 max). */
26926 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026927
Daniel Veillard42595322004-11-08 10:52:06 +000026928 for (n_URI = 0;n_URI < gen_nb_fileoutput;n_URI++) {
Daniel Veillard3d95c732004-11-06 22:25:14 +000026929 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
26930 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
26931 mem_base = xmlMemBlocks();
Daniel Veillard42595322004-11-08 10:52:06 +000026932 URI = gen_fileoutput(n_URI, 0);
Daniel Veillard3d95c732004-11-06 22:25:14 +000026933 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 1);
26934 compression = gen_int(n_compression, 2);
26935
26936 ret_val = xmlOutputBufferCreateFilename(URI, encoder, compression);
26937 desret_xmlOutputBufferPtr(ret_val);
26938 call_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026939 des_fileoutput(n_URI, URI, 0);
Daniel Veillard3d95c732004-11-06 22:25:14 +000026940 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 1);
26941 des_int(n_compression, compression, 2);
26942 xmlResetLastError();
26943 if (mem_base != xmlMemBlocks()) {
26944 printf("Leak of %d blocks found in xmlOutputBufferCreateFilename",
26945 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026946 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000026947 printf(" %d", n_URI);
26948 printf(" %d", n_encoder);
26949 printf(" %d", n_compression);
26950 printf("\n");
26951 }
26952 }
26953 }
26954 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026955 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000026956#endif
26957
Daniel Veillard42595322004-11-08 10:52:06 +000026958 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026959}
26960
26961
26962static int
26963test_xmlOutputBufferFlush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026964 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026965
William M. Brack21e4ef22005-01-02 09:53:13 +000026966#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000026967 int mem_base;
26968 int ret_val;
26969 xmlOutputBufferPtr out; /* a buffered output */
26970 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026971
Daniel Veillard3d97e662004-11-04 10:49:00 +000026972 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
26973 mem_base = xmlMemBlocks();
26974 out = gen_xmlOutputBufferPtr(n_out, 0);
26975
26976 ret_val = xmlOutputBufferFlush(out);
26977 desret_int(ret_val);
26978 call_tests++;
26979 des_xmlOutputBufferPtr(n_out, out, 0);
26980 xmlResetLastError();
26981 if (mem_base != xmlMemBlocks()) {
26982 printf("Leak of %d blocks found in xmlOutputBufferFlush",
26983 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026984 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026985 printf(" %d", n_out);
26986 printf("\n");
26987 }
26988 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026989 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026990#endif
26991
Daniel Veillard42595322004-11-08 10:52:06 +000026992 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026993}
26994
26995
26996static int
26997test_xmlOutputBufferWrite(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026998 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026999
William M. Brack21e4ef22005-01-02 09:53:13 +000027000#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000027001 int mem_base;
27002 int ret_val;
27003 xmlOutputBufferPtr out; /* a buffered parser output */
27004 int n_out;
27005 int len; /* the size in bytes of the array. */
27006 int n_len;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027007 char * buf; /* an char array */
Daniel Veillard3d97e662004-11-04 10:49:00 +000027008 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027009
Daniel Veillard3d97e662004-11-04 10:49:00 +000027010 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
27011 for (n_len = 0;n_len < gen_nb_int;n_len++) {
27012 for (n_buf = 0;n_buf < gen_nb_const_char_ptr;n_buf++) {
27013 mem_base = xmlMemBlocks();
27014 out = gen_xmlOutputBufferPtr(n_out, 0);
27015 len = gen_int(n_len, 1);
27016 buf = gen_const_char_ptr(n_buf, 2);
27017
William M. Brackf13f77f2004-11-12 16:03:48 +000027018 ret_val = xmlOutputBufferWrite(out, len, (const char *)buf);
Daniel Veillard3d97e662004-11-04 10:49:00 +000027019 desret_int(ret_val);
27020 call_tests++;
27021 des_xmlOutputBufferPtr(n_out, out, 0);
27022 des_int(n_len, len, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000027023 des_const_char_ptr(n_buf, (const char *)buf, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +000027024 xmlResetLastError();
27025 if (mem_base != xmlMemBlocks()) {
27026 printf("Leak of %d blocks found in xmlOutputBufferWrite",
27027 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027028 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027029 printf(" %d", n_out);
27030 printf(" %d", n_len);
27031 printf(" %d", n_buf);
27032 printf("\n");
27033 }
27034 }
27035 }
27036 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027037 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027038#endif
27039
Daniel Veillard42595322004-11-08 10:52:06 +000027040 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027041}
27042
27043
27044static int
27045test_xmlOutputBufferWriteEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027046 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027047
27048
27049 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000027050 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027051}
27052
27053
27054static int
27055test_xmlOutputBufferWriteString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027056 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027057
William M. Brack21e4ef22005-01-02 09:53:13 +000027058#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000027059 int mem_base;
27060 int ret_val;
27061 xmlOutputBufferPtr out; /* a buffered parser output */
27062 int n_out;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027063 char * str; /* a zero terminated C string */
Daniel Veillard3d97e662004-11-04 10:49:00 +000027064 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027065
Daniel Veillard3d97e662004-11-04 10:49:00 +000027066 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
27067 for (n_str = 0;n_str < gen_nb_const_char_ptr;n_str++) {
27068 mem_base = xmlMemBlocks();
27069 out = gen_xmlOutputBufferPtr(n_out, 0);
27070 str = gen_const_char_ptr(n_str, 1);
27071
William M. Brackf13f77f2004-11-12 16:03:48 +000027072 ret_val = xmlOutputBufferWriteString(out, (const char *)str);
Daniel Veillard3d97e662004-11-04 10:49:00 +000027073 desret_int(ret_val);
27074 call_tests++;
27075 des_xmlOutputBufferPtr(n_out, out, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000027076 des_const_char_ptr(n_str, (const char *)str, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000027077 xmlResetLastError();
27078 if (mem_base != xmlMemBlocks()) {
27079 printf("Leak of %d blocks found in xmlOutputBufferWriteString",
27080 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027081 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027082 printf(" %d", n_out);
27083 printf(" %d", n_str);
27084 printf("\n");
27085 }
27086 }
27087 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027088 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027089#endif
27090
Daniel Veillard42595322004-11-08 10:52:06 +000027091 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027092}
27093
27094
27095static int
27096test_xmlParserGetDirectory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027097 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027098
27099
27100 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000027101 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027102}
27103
27104
27105static int
27106test_xmlParserInputBufferCreateFd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027107 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027108
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027109 int mem_base;
27110 xmlParserInputBufferPtr ret_val;
27111 int fd; /* a file descriptor number */
27112 int n_fd;
27113 xmlCharEncoding enc; /* the charset encoding if known */
27114 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027115
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027116 for (n_fd = 0;n_fd < gen_nb_int;n_fd++) {
27117 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27118 mem_base = xmlMemBlocks();
27119 fd = gen_int(n_fd, 0);
27120 enc = gen_xmlCharEncoding(n_enc, 1);
27121 if (fd >= 0) fd = -1;
27122
27123 ret_val = xmlParserInputBufferCreateFd(fd, enc);
27124 desret_xmlParserInputBufferPtr(ret_val);
27125 call_tests++;
27126 des_int(n_fd, fd, 0);
27127 des_xmlCharEncoding(n_enc, enc, 1);
27128 xmlResetLastError();
27129 if (mem_base != xmlMemBlocks()) {
27130 printf("Leak of %d blocks found in xmlParserInputBufferCreateFd",
27131 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027132 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027133 printf(" %d", n_fd);
27134 printf(" %d", n_enc);
27135 printf("\n");
27136 }
27137 }
27138 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027139 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027140
Daniel Veillard42595322004-11-08 10:52:06 +000027141 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027142}
27143
27144
27145static int
27146test_xmlParserInputBufferCreateFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027147 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027148
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027149 int mem_base;
27150 xmlParserInputBufferPtr ret_val;
27151 FILE * file; /* a FILE* */
27152 int n_file;
27153 xmlCharEncoding enc; /* the charset encoding if known */
27154 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027155
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027156 for (n_file = 0;n_file < gen_nb_FILE_ptr;n_file++) {
27157 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27158 mem_base = xmlMemBlocks();
27159 file = gen_FILE_ptr(n_file, 0);
27160 enc = gen_xmlCharEncoding(n_enc, 1);
27161
27162 ret_val = xmlParserInputBufferCreateFile(file, enc);
27163 desret_xmlParserInputBufferPtr(ret_val);
27164 call_tests++;
27165 des_FILE_ptr(n_file, file, 0);
27166 des_xmlCharEncoding(n_enc, enc, 1);
27167 xmlResetLastError();
27168 if (mem_base != xmlMemBlocks()) {
27169 printf("Leak of %d blocks found in xmlParserInputBufferCreateFile",
27170 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027171 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027172 printf(" %d", n_file);
27173 printf(" %d", n_enc);
27174 printf("\n");
27175 }
27176 }
27177 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027178 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027179
Daniel Veillard42595322004-11-08 10:52:06 +000027180 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027181}
27182
27183
27184static int
27185test_xmlParserInputBufferCreateFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027186 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027187
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027188 int mem_base;
27189 xmlParserInputBufferPtr ret_val;
27190 const char * URI; /* a C string containing the URI or filename */
27191 int n_URI;
27192 xmlCharEncoding enc; /* the charset encoding if known */
27193 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027194
Daniel Veillard42595322004-11-08 10:52:06 +000027195 for (n_URI = 0;n_URI < gen_nb_fileoutput;n_URI++) {
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027196 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27197 mem_base = xmlMemBlocks();
Daniel Veillard42595322004-11-08 10:52:06 +000027198 URI = gen_fileoutput(n_URI, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027199 enc = gen_xmlCharEncoding(n_enc, 1);
27200
27201 ret_val = xmlParserInputBufferCreateFilename(URI, enc);
27202 desret_xmlParserInputBufferPtr(ret_val);
27203 call_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027204 des_fileoutput(n_URI, URI, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027205 des_xmlCharEncoding(n_enc, enc, 1);
27206 xmlResetLastError();
27207 if (mem_base != xmlMemBlocks()) {
27208 printf("Leak of %d blocks found in xmlParserInputBufferCreateFilename",
27209 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027210 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027211 printf(" %d", n_URI);
27212 printf(" %d", n_enc);
27213 printf("\n");
27214 }
27215 }
27216 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027217 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027218
Daniel Veillard42595322004-11-08 10:52:06 +000027219 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027220}
27221
27222
27223static int
27224test_xmlParserInputBufferCreateMem(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027225 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027226
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027227 int mem_base;
27228 xmlParserInputBufferPtr ret_val;
27229 char * mem; /* the memory input */
27230 int n_mem;
27231 int size; /* the length of the memory block */
27232 int n_size;
27233 xmlCharEncoding enc; /* the charset encoding if known */
27234 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027235
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027236 for (n_mem = 0;n_mem < gen_nb_const_char_ptr;n_mem++) {
27237 for (n_size = 0;n_size < gen_nb_int;n_size++) {
27238 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27239 mem_base = xmlMemBlocks();
27240 mem = gen_const_char_ptr(n_mem, 0);
27241 size = gen_int(n_size, 1);
27242 enc = gen_xmlCharEncoding(n_enc, 2);
27243
William M. Brackf13f77f2004-11-12 16:03:48 +000027244 ret_val = xmlParserInputBufferCreateMem((const char *)mem, size, enc);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027245 desret_xmlParserInputBufferPtr(ret_val);
27246 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000027247 des_const_char_ptr(n_mem, (const char *)mem, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027248 des_int(n_size, size, 1);
27249 des_xmlCharEncoding(n_enc, enc, 2);
27250 xmlResetLastError();
27251 if (mem_base != xmlMemBlocks()) {
27252 printf("Leak of %d blocks found in xmlParserInputBufferCreateMem",
27253 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027254 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027255 printf(" %d", n_mem);
27256 printf(" %d", n_size);
27257 printf(" %d", n_enc);
27258 printf("\n");
27259 }
27260 }
27261 }
27262 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027263 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027264
Daniel Veillard42595322004-11-08 10:52:06 +000027265 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027266}
27267
27268
27269static int
27270test_xmlParserInputBufferCreateStatic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027271 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027272
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027273 int mem_base;
27274 xmlParserInputBufferPtr ret_val;
27275 char * mem; /* the memory input */
27276 int n_mem;
27277 int size; /* the length of the memory block */
27278 int n_size;
27279 xmlCharEncoding enc; /* the charset encoding if known */
27280 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027281
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027282 for (n_mem = 0;n_mem < gen_nb_const_char_ptr;n_mem++) {
27283 for (n_size = 0;n_size < gen_nb_int;n_size++) {
27284 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27285 mem_base = xmlMemBlocks();
27286 mem = gen_const_char_ptr(n_mem, 0);
27287 size = gen_int(n_size, 1);
27288 enc = gen_xmlCharEncoding(n_enc, 2);
27289
William M. Brackf13f77f2004-11-12 16:03:48 +000027290 ret_val = xmlParserInputBufferCreateStatic((const char *)mem, size, enc);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027291 desret_xmlParserInputBufferPtr(ret_val);
27292 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000027293 des_const_char_ptr(n_mem, (const char *)mem, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027294 des_int(n_size, size, 1);
27295 des_xmlCharEncoding(n_enc, enc, 2);
27296 xmlResetLastError();
27297 if (mem_base != xmlMemBlocks()) {
27298 printf("Leak of %d blocks found in xmlParserInputBufferCreateStatic",
27299 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027300 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027301 printf(" %d", n_mem);
27302 printf(" %d", n_size);
27303 printf(" %d", n_enc);
27304 printf("\n");
27305 }
27306 }
27307 }
27308 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027309 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027310
Daniel Veillard42595322004-11-08 10:52:06 +000027311 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027312}
27313
27314
27315static int
27316test_xmlParserInputBufferGrow(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027317 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027318
Daniel Veillard34099b42004-11-04 17:34:35 +000027319 int mem_base;
27320 int ret_val;
27321 xmlParserInputBufferPtr in; /* a buffered parser input */
27322 int n_in;
27323 int len; /* indicative value of the amount of chars to read */
27324 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027325
Daniel Veillard34099b42004-11-04 17:34:35 +000027326 for (n_in = 0;n_in < gen_nb_xmlParserInputBufferPtr;n_in++) {
27327 for (n_len = 0;n_len < gen_nb_int;n_len++) {
27328 mem_base = xmlMemBlocks();
27329 in = gen_xmlParserInputBufferPtr(n_in, 0);
27330 len = gen_int(n_len, 1);
27331
27332 ret_val = xmlParserInputBufferGrow(in, len);
27333 desret_int(ret_val);
27334 call_tests++;
27335 des_xmlParserInputBufferPtr(n_in, in, 0);
27336 des_int(n_len, len, 1);
27337 xmlResetLastError();
27338 if (mem_base != xmlMemBlocks()) {
27339 printf("Leak of %d blocks found in xmlParserInputBufferGrow",
27340 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027341 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000027342 printf(" %d", n_in);
27343 printf(" %d", n_len);
27344 printf("\n");
27345 }
27346 }
27347 }
Daniel Veillard34099b42004-11-04 17:34:35 +000027348 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027349
Daniel Veillard42595322004-11-08 10:52:06 +000027350 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027351}
27352
27353
27354static int
27355test_xmlParserInputBufferPush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027356 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027357
Daniel Veillard34099b42004-11-04 17:34:35 +000027358 int mem_base;
27359 int ret_val;
27360 xmlParserInputBufferPtr in; /* a buffered parser input */
27361 int n_in;
27362 int len; /* the size in bytes of the array. */
27363 int n_len;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027364 char * buf; /* an char array */
Daniel Veillard34099b42004-11-04 17:34:35 +000027365 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027366
Daniel Veillard34099b42004-11-04 17:34:35 +000027367 for (n_in = 0;n_in < gen_nb_xmlParserInputBufferPtr;n_in++) {
27368 for (n_len = 0;n_len < gen_nb_int;n_len++) {
27369 for (n_buf = 0;n_buf < gen_nb_const_char_ptr;n_buf++) {
27370 mem_base = xmlMemBlocks();
27371 in = gen_xmlParserInputBufferPtr(n_in, 0);
27372 len = gen_int(n_len, 1);
27373 buf = gen_const_char_ptr(n_buf, 2);
27374
William M. Brackf13f77f2004-11-12 16:03:48 +000027375 ret_val = xmlParserInputBufferPush(in, len, (const char *)buf);
Daniel Veillard34099b42004-11-04 17:34:35 +000027376 desret_int(ret_val);
27377 call_tests++;
27378 des_xmlParserInputBufferPtr(n_in, in, 0);
27379 des_int(n_len, len, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000027380 des_const_char_ptr(n_buf, (const char *)buf, 2);
Daniel Veillard34099b42004-11-04 17:34:35 +000027381 xmlResetLastError();
27382 if (mem_base != xmlMemBlocks()) {
27383 printf("Leak of %d blocks found in xmlParserInputBufferPush",
27384 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027385 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000027386 printf(" %d", n_in);
27387 printf(" %d", n_len);
27388 printf(" %d", n_buf);
27389 printf("\n");
27390 }
27391 }
27392 }
27393 }
Daniel Veillard34099b42004-11-04 17:34:35 +000027394 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027395
Daniel Veillard42595322004-11-08 10:52:06 +000027396 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027397}
27398
27399
27400static int
27401test_xmlParserInputBufferRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027402 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027403
Daniel Veillard34099b42004-11-04 17:34:35 +000027404 int mem_base;
27405 int ret_val;
27406 xmlParserInputBufferPtr in; /* a buffered parser input */
27407 int n_in;
27408 int len; /* indicative value of the amount of chars to read */
27409 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027410
Daniel Veillard34099b42004-11-04 17:34:35 +000027411 for (n_in = 0;n_in < gen_nb_xmlParserInputBufferPtr;n_in++) {
27412 for (n_len = 0;n_len < gen_nb_int;n_len++) {
27413 mem_base = xmlMemBlocks();
27414 in = gen_xmlParserInputBufferPtr(n_in, 0);
27415 len = gen_int(n_len, 1);
27416
27417 ret_val = xmlParserInputBufferRead(in, len);
27418 desret_int(ret_val);
27419 call_tests++;
27420 des_xmlParserInputBufferPtr(n_in, in, 0);
27421 des_int(n_len, len, 1);
27422 xmlResetLastError();
27423 if (mem_base != xmlMemBlocks()) {
27424 printf("Leak of %d blocks found in xmlParserInputBufferRead",
27425 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027426 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000027427 printf(" %d", n_in);
27428 printf(" %d", n_len);
27429 printf("\n");
27430 }
27431 }
27432 }
Daniel Veillard34099b42004-11-04 17:34:35 +000027433 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027434
Daniel Veillard42595322004-11-08 10:52:06 +000027435 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027436}
27437
27438
27439static int
27440test_xmlPopInputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027441 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027442
27443 int mem_base;
27444 int ret_val;
27445
27446 mem_base = xmlMemBlocks();
27447
27448 ret_val = xmlPopInputCallbacks();
27449 desret_int(ret_val);
27450 call_tests++;
27451 xmlResetLastError();
27452 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027453 printf("Leak of %d blocks found in xmlPopInputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027454 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027455 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027456 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027457 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000027458 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027459
Daniel Veillard42595322004-11-08 10:52:06 +000027460 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027461}
27462
27463
27464static int
27465test_xmlRegisterDefaultInputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027466 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027467
27468 int mem_base;
27469
27470 mem_base = xmlMemBlocks();
27471
27472 xmlRegisterDefaultInputCallbacks();
27473 call_tests++;
27474 xmlResetLastError();
27475 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027476 printf("Leak of %d blocks found in xmlRegisterDefaultInputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027477 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027478 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027479 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027480 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000027481 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027482
Daniel Veillard42595322004-11-08 10:52:06 +000027483 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027484}
27485
27486
27487static int
27488test_xmlRegisterDefaultOutputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027489 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027490
William M. Brack21e4ef22005-01-02 09:53:13 +000027491#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000027492 int mem_base;
27493
27494 mem_base = xmlMemBlocks();
27495
27496 xmlRegisterDefaultOutputCallbacks();
27497 call_tests++;
27498 xmlResetLastError();
27499 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027500 printf("Leak of %d blocks found in xmlRegisterDefaultOutputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027501 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027502 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027503 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027504 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027505 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027506#endif
27507
Daniel Veillard42595322004-11-08 10:52:06 +000027508 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027509}
27510
27511
27512static int
27513test_xmlRegisterHTTPPostCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027514 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027515
William M. Brack21e4ef22005-01-02 09:53:13 +000027516#if defined(LIBXML_OUTPUT_ENABLED) && defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000027517 int mem_base;
27518
27519 mem_base = xmlMemBlocks();
27520
27521 xmlRegisterHTTPPostCallbacks();
27522 call_tests++;
27523 xmlResetLastError();
27524 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027525 printf("Leak of %d blocks found in xmlRegisterHTTPPostCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027526 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027527 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027528 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027529 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027530 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027531#endif
27532
Daniel Veillard42595322004-11-08 10:52:06 +000027533 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027534}
27535
27536static int
27537test_xmlIO(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027538 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027539
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027540 if (quiet == 0) printf("Testing xmlIO : 38 of 47 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000027541 test_ret += test_xmlAllocOutputBuffer();
27542 test_ret += test_xmlAllocParserInputBuffer();
27543 test_ret += test_xmlCheckFilename();
27544 test_ret += test_xmlCheckHTTPInput();
27545 test_ret += test_xmlCleanupInputCallbacks();
27546 test_ret += test_xmlCleanupOutputCallbacks();
27547 test_ret += test_xmlFileClose();
27548 test_ret += test_xmlFileMatch();
27549 test_ret += test_xmlFileOpen();
27550 test_ret += test_xmlFileRead();
27551 test_ret += test_xmlIOFTPClose();
27552 test_ret += test_xmlIOFTPMatch();
27553 test_ret += test_xmlIOFTPOpen();
27554 test_ret += test_xmlIOFTPRead();
27555 test_ret += test_xmlIOHTTPClose();
27556 test_ret += test_xmlIOHTTPMatch();
27557 test_ret += test_xmlIOHTTPOpen();
27558 test_ret += test_xmlIOHTTPOpenW();
27559 test_ret += test_xmlIOHTTPRead();
27560 test_ret += test_xmlNoNetExternalEntityLoader();
27561 test_ret += test_xmlNormalizeWindowsPath();
27562 test_ret += test_xmlOutputBufferCreateFd();
27563 test_ret += test_xmlOutputBufferCreateFile();
27564 test_ret += test_xmlOutputBufferCreateFilename();
27565 test_ret += test_xmlOutputBufferFlush();
27566 test_ret += test_xmlOutputBufferWrite();
27567 test_ret += test_xmlOutputBufferWriteEscape();
27568 test_ret += test_xmlOutputBufferWriteString();
27569 test_ret += test_xmlParserGetDirectory();
27570 test_ret += test_xmlParserInputBufferCreateFd();
27571 test_ret += test_xmlParserInputBufferCreateFile();
27572 test_ret += test_xmlParserInputBufferCreateFilename();
27573 test_ret += test_xmlParserInputBufferCreateMem();
27574 test_ret += test_xmlParserInputBufferCreateStatic();
27575 test_ret += test_xmlParserInputBufferGrow();
27576 test_ret += test_xmlParserInputBufferPush();
27577 test_ret += test_xmlParserInputBufferRead();
27578 test_ret += test_xmlPopInputCallbacks();
27579 test_ret += test_xmlRegisterDefaultInputCallbacks();
27580 test_ret += test_xmlRegisterDefaultOutputCallbacks();
27581 test_ret += test_xmlRegisterHTTPPostCallbacks();
Daniel Veillardd93f6252004-11-02 15:53:51 +000027582
Daniel Veillard42595322004-11-08 10:52:06 +000027583 if (test_ret != 0)
27584 printf("Module xmlIO: %d errors\n", test_ret);
27585 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027586}
Daniel Veillarda521d282004-11-09 14:59:59 +000027587#ifdef LIBXML_AUTOMATA_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000027588
Daniel Veillarda82b1822004-11-08 16:24:57 +000027589#define gen_nb_xmlAutomataPtr 1
27590static xmlAutomataPtr gen_xmlAutomataPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27591 return(NULL);
27592}
27593static void des_xmlAutomataPtr(int no ATTRIBUTE_UNUSED, xmlAutomataPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27594}
Daniel Veillarda521d282004-11-09 14:59:59 +000027595#endif
27596
Daniel Veillarda82b1822004-11-08 16:24:57 +000027597
27598static int
27599test_xmlAutomataCompile(void) {
27600 int test_ret = 0;
27601
27602
27603 /* missing type support */
27604 return(test_ret);
27605}
27606
27607
27608static int
27609test_xmlAutomataGetInitState(void) {
27610 int test_ret = 0;
27611
27612
27613 /* missing type support */
27614 return(test_ret);
27615}
27616
27617
27618static int
27619test_xmlAutomataIsDeterminist(void) {
27620 int test_ret = 0;
27621
William M. Brack21e4ef22005-01-02 09:53:13 +000027622#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_AUTOMATA_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000027623 int mem_base;
27624 int ret_val;
27625 xmlAutomataPtr am; /* an automata */
27626 int n_am;
27627
27628 for (n_am = 0;n_am < gen_nb_xmlAutomataPtr;n_am++) {
27629 mem_base = xmlMemBlocks();
27630 am = gen_xmlAutomataPtr(n_am, 0);
27631
27632 ret_val = xmlAutomataIsDeterminist(am);
27633 desret_int(ret_val);
27634 call_tests++;
27635 des_xmlAutomataPtr(n_am, am, 0);
27636 xmlResetLastError();
27637 if (mem_base != xmlMemBlocks()) {
27638 printf("Leak of %d blocks found in xmlAutomataIsDeterminist",
27639 xmlMemBlocks() - mem_base);
27640 test_ret++;
27641 printf(" %d", n_am);
27642 printf("\n");
27643 }
27644 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027645 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000027646#endif
27647
Daniel Veillarda82b1822004-11-08 16:24:57 +000027648 return(test_ret);
27649}
27650
Daniel Veillarda521d282004-11-09 14:59:59 +000027651#ifdef LIBXML_AUTOMATA_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +000027652
27653#define gen_nb_xmlAutomataStatePtr 1
27654static xmlAutomataStatePtr gen_xmlAutomataStatePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27655 return(NULL);
27656}
27657static void des_xmlAutomataStatePtr(int no ATTRIBUTE_UNUSED, xmlAutomataStatePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27658}
Daniel Veillarda521d282004-11-09 14:59:59 +000027659#endif
27660
Daniel Veillarda82b1822004-11-08 16:24:57 +000027661
27662static int
27663test_xmlAutomataNewAllTrans(void) {
27664 int test_ret = 0;
27665
27666
27667 /* missing type support */
27668 return(test_ret);
27669}
27670
27671
27672static int
27673test_xmlAutomataNewCountTrans(void) {
27674 int test_ret = 0;
27675
27676
27677 /* missing type support */
27678 return(test_ret);
27679}
27680
27681
27682static int
27683test_xmlAutomataNewCountTrans2(void) {
27684 int test_ret = 0;
27685
27686
27687 /* missing type support */
27688 return(test_ret);
27689}
27690
27691
27692static int
27693test_xmlAutomataNewCountedTrans(void) {
27694 int test_ret = 0;
27695
27696
27697 /* missing type support */
27698 return(test_ret);
27699}
27700
27701
27702static int
27703test_xmlAutomataNewCounter(void) {
27704 int test_ret = 0;
27705
William M. Brack21e4ef22005-01-02 09:53:13 +000027706#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_AUTOMATA_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000027707 int mem_base;
27708 int ret_val;
27709 xmlAutomataPtr am; /* an automata */
27710 int n_am;
27711 int min; /* the minimal value on the counter */
27712 int n_min;
27713 int max; /* the maximal value on the counter */
27714 int n_max;
27715
27716 for (n_am = 0;n_am < gen_nb_xmlAutomataPtr;n_am++) {
27717 for (n_min = 0;n_min < gen_nb_int;n_min++) {
27718 for (n_max = 0;n_max < gen_nb_int;n_max++) {
27719 mem_base = xmlMemBlocks();
27720 am = gen_xmlAutomataPtr(n_am, 0);
27721 min = gen_int(n_min, 1);
27722 max = gen_int(n_max, 2);
27723
27724 ret_val = xmlAutomataNewCounter(am, min, max);
27725 desret_int(ret_val);
27726 call_tests++;
27727 des_xmlAutomataPtr(n_am, am, 0);
27728 des_int(n_min, min, 1);
27729 des_int(n_max, max, 2);
27730 xmlResetLastError();
27731 if (mem_base != xmlMemBlocks()) {
27732 printf("Leak of %d blocks found in xmlAutomataNewCounter",
27733 xmlMemBlocks() - mem_base);
27734 test_ret++;
27735 printf(" %d", n_am);
27736 printf(" %d", n_min);
27737 printf(" %d", n_max);
27738 printf("\n");
27739 }
27740 }
27741 }
27742 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027743 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000027744#endif
27745
Daniel Veillarda82b1822004-11-08 16:24:57 +000027746 return(test_ret);
27747}
27748
27749
27750static int
27751test_xmlAutomataNewCounterTrans(void) {
27752 int test_ret = 0;
27753
27754
27755 /* missing type support */
27756 return(test_ret);
27757}
27758
27759
27760static int
27761test_xmlAutomataNewEpsilon(void) {
27762 int test_ret = 0;
27763
27764
27765 /* missing type support */
27766 return(test_ret);
27767}
27768
27769
27770static int
27771test_xmlAutomataNewOnceTrans(void) {
27772 int test_ret = 0;
27773
27774
27775 /* missing type support */
27776 return(test_ret);
27777}
27778
27779
27780static int
27781test_xmlAutomataNewOnceTrans2(void) {
27782 int test_ret = 0;
27783
27784
27785 /* missing type support */
27786 return(test_ret);
27787}
27788
27789
27790static int
27791test_xmlAutomataNewState(void) {
27792 int test_ret = 0;
27793
27794
27795 /* missing type support */
27796 return(test_ret);
27797}
27798
27799
27800static int
27801test_xmlAutomataNewTransition(void) {
27802 int test_ret = 0;
27803
27804
27805 /* missing type support */
27806 return(test_ret);
27807}
27808
27809
27810static int
27811test_xmlAutomataNewTransition2(void) {
27812 int test_ret = 0;
27813
27814
27815 /* missing type support */
27816 return(test_ret);
27817}
27818
27819
27820static int
27821test_xmlAutomataSetFinalState(void) {
27822 int test_ret = 0;
27823
William M. Brack21e4ef22005-01-02 09:53:13 +000027824#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_AUTOMATA_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000027825 int mem_base;
27826 int ret_val;
27827 xmlAutomataPtr am; /* an automata */
27828 int n_am;
27829 xmlAutomataStatePtr state; /* a state in this automata */
27830 int n_state;
27831
27832 for (n_am = 0;n_am < gen_nb_xmlAutomataPtr;n_am++) {
27833 for (n_state = 0;n_state < gen_nb_xmlAutomataStatePtr;n_state++) {
27834 mem_base = xmlMemBlocks();
27835 am = gen_xmlAutomataPtr(n_am, 0);
27836 state = gen_xmlAutomataStatePtr(n_state, 1);
27837
27838 ret_val = xmlAutomataSetFinalState(am, state);
27839 desret_int(ret_val);
27840 call_tests++;
27841 des_xmlAutomataPtr(n_am, am, 0);
27842 des_xmlAutomataStatePtr(n_state, state, 1);
27843 xmlResetLastError();
27844 if (mem_base != xmlMemBlocks()) {
27845 printf("Leak of %d blocks found in xmlAutomataSetFinalState",
27846 xmlMemBlocks() - mem_base);
27847 test_ret++;
27848 printf(" %d", n_am);
27849 printf(" %d", n_state);
27850 printf("\n");
27851 }
27852 }
27853 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027854 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000027855#endif
27856
Daniel Veillarda82b1822004-11-08 16:24:57 +000027857 return(test_ret);
27858}
27859
27860
27861static int
27862test_xmlNewAutomata(void) {
27863 int test_ret = 0;
27864
27865
27866 /* missing type support */
27867 return(test_ret);
27868}
27869
27870static int
27871test_xmlautomata(void) {
27872 int test_ret = 0;
27873
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027874 if (quiet == 0) printf("Testing xmlautomata : 3 of 18 functions ...\n");
Daniel Veillarda82b1822004-11-08 16:24:57 +000027875 test_ret += test_xmlAutomataCompile();
27876 test_ret += test_xmlAutomataGetInitState();
27877 test_ret += test_xmlAutomataIsDeterminist();
27878 test_ret += test_xmlAutomataNewAllTrans();
27879 test_ret += test_xmlAutomataNewCountTrans();
27880 test_ret += test_xmlAutomataNewCountTrans2();
27881 test_ret += test_xmlAutomataNewCountedTrans();
27882 test_ret += test_xmlAutomataNewCounter();
27883 test_ret += test_xmlAutomataNewCounterTrans();
27884 test_ret += test_xmlAutomataNewEpsilon();
27885 test_ret += test_xmlAutomataNewOnceTrans();
27886 test_ret += test_xmlAutomataNewOnceTrans2();
27887 test_ret += test_xmlAutomataNewState();
27888 test_ret += test_xmlAutomataNewTransition();
27889 test_ret += test_xmlAutomataNewTransition2();
27890 test_ret += test_xmlAutomataSetFinalState();
27891 test_ret += test_xmlNewAutomata();
27892
27893 if (test_ret != 0)
27894 printf("Module xmlautomata: %d errors\n", test_ret);
27895 return(test_ret);
27896}
27897
Daniel Veillardce682bc2004-11-05 17:22:25 +000027898#define gen_nb_xmlGenericErrorFunc_ptr 1
27899static xmlGenericErrorFunc * gen_xmlGenericErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27900 return(NULL);
27901}
27902static void des_xmlGenericErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlGenericErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27903}
27904
Daniel Veillardd93f6252004-11-02 15:53:51 +000027905static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000027906test_initGenericErrorDefaultFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027907 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027908
Daniel Veillardce682bc2004-11-05 17:22:25 +000027909 int mem_base;
27910 xmlGenericErrorFunc * handler; /* the handler */
27911 int n_handler;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027912
Daniel Veillardce682bc2004-11-05 17:22:25 +000027913 for (n_handler = 0;n_handler < gen_nb_xmlGenericErrorFunc_ptr;n_handler++) {
27914 mem_base = xmlMemBlocks();
27915 handler = gen_xmlGenericErrorFunc_ptr(n_handler, 0);
27916
27917 initGenericErrorDefaultFunc(handler);
27918 call_tests++;
27919 des_xmlGenericErrorFunc_ptr(n_handler, handler, 0);
27920 xmlResetLastError();
27921 if (mem_base != xmlMemBlocks()) {
27922 printf("Leak of %d blocks found in initGenericErrorDefaultFunc",
27923 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027924 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027925 printf(" %d", n_handler);
27926 printf("\n");
27927 }
27928 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000027929 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027930
Daniel Veillard42595322004-11-08 10:52:06 +000027931 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027932}
27933
27934
Daniel Veillardce682bc2004-11-05 17:22:25 +000027935#define gen_nb_xmlErrorPtr 1
27936static xmlErrorPtr gen_xmlErrorPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27937 return(NULL);
27938}
27939static void des_xmlErrorPtr(int no ATTRIBUTE_UNUSED, xmlErrorPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27940}
27941
Daniel Veillardd93f6252004-11-02 15:53:51 +000027942static int
27943test_xmlCopyError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027944 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027945
Daniel Veillardce682bc2004-11-05 17:22:25 +000027946 int mem_base;
27947 int ret_val;
27948 xmlErrorPtr from; /* a source error */
27949 int n_from;
27950 xmlErrorPtr to; /* a target error */
27951 int n_to;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027952
Daniel Veillardce682bc2004-11-05 17:22:25 +000027953 for (n_from = 0;n_from < gen_nb_xmlErrorPtr;n_from++) {
27954 for (n_to = 0;n_to < gen_nb_xmlErrorPtr;n_to++) {
27955 mem_base = xmlMemBlocks();
27956 from = gen_xmlErrorPtr(n_from, 0);
27957 to = gen_xmlErrorPtr(n_to, 1);
27958
27959 ret_val = xmlCopyError(from, to);
27960 desret_int(ret_val);
27961 call_tests++;
27962 des_xmlErrorPtr(n_from, from, 0);
27963 des_xmlErrorPtr(n_to, to, 1);
27964 xmlResetLastError();
27965 if (mem_base != xmlMemBlocks()) {
27966 printf("Leak of %d blocks found in xmlCopyError",
27967 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027968 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027969 printf(" %d", n_from);
27970 printf(" %d", n_to);
27971 printf("\n");
27972 }
27973 }
27974 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000027975 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027976
Daniel Veillard42595322004-11-08 10:52:06 +000027977 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027978}
27979
27980
27981static int
27982test_xmlCtxtGetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027983 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027984
27985
27986 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000027987 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027988}
27989
27990
27991static int
27992test_xmlCtxtResetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027993 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027994
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000027995 int mem_base;
27996 void * ctx; /* an XML parser context */
27997 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027998
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000027999 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
28000 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028001 ctx = gen_void_ptr(n_ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000028002
28003 xmlCtxtResetLastError(ctx);
28004 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028005 des_void_ptr(n_ctx, ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000028006 xmlResetLastError();
28007 if (mem_base != xmlMemBlocks()) {
28008 printf("Leak of %d blocks found in xmlCtxtResetLastError",
28009 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028010 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000028011 printf(" %d", n_ctx);
28012 printf("\n");
28013 }
28014 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000028015 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028016
Daniel Veillard42595322004-11-08 10:52:06 +000028017 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028018}
28019
28020
28021static int
28022test_xmlGetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028023 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028024
28025
28026 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028027 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028028}
28029
28030
28031static int
28032test_xmlParserError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028033 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028034
28035
28036 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028037 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028038}
28039
28040
28041static int
28042test_xmlParserPrintFileContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028043 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028044
Daniel Veillardce682bc2004-11-05 17:22:25 +000028045 int mem_base;
28046 xmlParserInputPtr input; /* an xmlParserInputPtr input */
28047 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028048
Daniel Veillardce682bc2004-11-05 17:22:25 +000028049 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
28050 mem_base = xmlMemBlocks();
28051 input = gen_xmlParserInputPtr(n_input, 0);
28052
28053 xmlParserPrintFileContext(input);
28054 call_tests++;
28055 des_xmlParserInputPtr(n_input, input, 0);
28056 xmlResetLastError();
28057 if (mem_base != xmlMemBlocks()) {
28058 printf("Leak of %d blocks found in xmlParserPrintFileContext",
28059 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028060 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028061 printf(" %d", n_input);
28062 printf("\n");
28063 }
28064 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000028065 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028066
Daniel Veillard42595322004-11-08 10:52:06 +000028067 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028068}
28069
28070
28071static int
28072test_xmlParserPrintFileInfo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028073 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028074
Daniel Veillardce682bc2004-11-05 17:22:25 +000028075 int mem_base;
28076 xmlParserInputPtr input; /* an xmlParserInputPtr input */
28077 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028078
Daniel Veillardce682bc2004-11-05 17:22:25 +000028079 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
28080 mem_base = xmlMemBlocks();
28081 input = gen_xmlParserInputPtr(n_input, 0);
28082
28083 xmlParserPrintFileInfo(input);
28084 call_tests++;
28085 des_xmlParserInputPtr(n_input, input, 0);
28086 xmlResetLastError();
28087 if (mem_base != xmlMemBlocks()) {
28088 printf("Leak of %d blocks found in xmlParserPrintFileInfo",
28089 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028090 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028091 printf(" %d", n_input);
28092 printf("\n");
28093 }
28094 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000028095 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028096
Daniel Veillard42595322004-11-08 10:52:06 +000028097 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028098}
28099
28100
28101static int
28102test_xmlParserValidityError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028103 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028104
28105
28106 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028107 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028108}
28109
28110
28111static int
28112test_xmlParserValidityWarning(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028113 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028114
28115
28116 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028117 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028118}
28119
28120
28121static int
28122test_xmlParserWarning(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028123 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028124
28125
28126 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028127 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028128}
28129
28130
28131static int
28132test_xmlResetError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028133 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028134
Daniel Veillardce682bc2004-11-05 17:22:25 +000028135 int mem_base;
28136 xmlErrorPtr err; /* pointer to the error. */
28137 int n_err;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028138
Daniel Veillardce682bc2004-11-05 17:22:25 +000028139 for (n_err = 0;n_err < gen_nb_xmlErrorPtr;n_err++) {
28140 mem_base = xmlMemBlocks();
28141 err = gen_xmlErrorPtr(n_err, 0);
28142
28143 xmlResetError(err);
28144 call_tests++;
28145 des_xmlErrorPtr(n_err, err, 0);
28146 xmlResetLastError();
28147 if (mem_base != xmlMemBlocks()) {
28148 printf("Leak of %d blocks found in xmlResetError",
28149 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028150 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028151 printf(" %d", n_err);
28152 printf("\n");
28153 }
28154 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000028155 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028156
Daniel Veillard42595322004-11-08 10:52:06 +000028157 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028158}
28159
28160
28161static int
28162test_xmlResetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028163 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028164
28165
28166
28167 xmlResetLastError();
28168 call_tests++;
28169 xmlResetLastError();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028170 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028171
Daniel Veillard42595322004-11-08 10:52:06 +000028172 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028173}
28174
28175
28176static int
28177test_xmlSetGenericErrorFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028178 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028179
28180
28181 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028182 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028183}
28184
28185
28186static int
28187test_xmlSetStructuredErrorFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028188 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028189
28190
28191 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028192 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028193}
28194
28195static int
28196test_xmlerror(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028197 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028198
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028199 if (quiet == 0) printf("Testing xmlerror : 7 of 15 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000028200 test_ret += test_initGenericErrorDefaultFunc();
28201 test_ret += test_xmlCopyError();
28202 test_ret += test_xmlCtxtGetLastError();
28203 test_ret += test_xmlCtxtResetLastError();
28204 test_ret += test_xmlGetLastError();
28205 test_ret += test_xmlParserError();
28206 test_ret += test_xmlParserPrintFileContext();
28207 test_ret += test_xmlParserPrintFileInfo();
28208 test_ret += test_xmlParserValidityError();
28209 test_ret += test_xmlParserValidityWarning();
28210 test_ret += test_xmlParserWarning();
28211 test_ret += test_xmlResetError();
28212 test_ret += test_xmlResetLastError();
28213 test_ret += test_xmlSetGenericErrorFunc();
28214 test_ret += test_xmlSetStructuredErrorFunc();
Daniel Veillardd93f6252004-11-02 15:53:51 +000028215
Daniel Veillard42595322004-11-08 10:52:06 +000028216 if (test_ret != 0)
28217 printf("Module xmlerror: %d errors\n", test_ret);
28218 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028219}
Daniel Veillardd93f6252004-11-02 15:53:51 +000028220
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028221#define gen_nb_xmlModulePtr 1
28222static xmlModulePtr gen_xmlModulePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
28223 return(NULL);
28224}
28225static void des_xmlModulePtr(int no ATTRIBUTE_UNUSED, xmlModulePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
28226}
28227
28228static int
28229test_xmlModuleClose(void) {
28230 int test_ret = 0;
28231
28232#if defined(LIBXML_MODULES_ENABLED)
28233 int mem_base;
28234 int ret_val;
28235 xmlModulePtr module; /* the module handle */
28236 int n_module;
28237
28238 for (n_module = 0;n_module < gen_nb_xmlModulePtr;n_module++) {
28239 mem_base = xmlMemBlocks();
28240 module = gen_xmlModulePtr(n_module, 0);
28241
28242 ret_val = xmlModuleClose(module);
28243 desret_int(ret_val);
28244 call_tests++;
28245 des_xmlModulePtr(n_module, module, 0);
28246 xmlResetLastError();
28247 if (mem_base != xmlMemBlocks()) {
28248 printf("Leak of %d blocks found in xmlModuleClose",
28249 xmlMemBlocks() - mem_base);
28250 test_ret++;
28251 printf(" %d", n_module);
28252 printf("\n");
28253 }
28254 }
28255 function_tests++;
28256#endif
28257
28258 return(test_ret);
28259}
28260
28261
28262static int
28263test_xmlModuleOpen(void) {
28264 int test_ret = 0;
28265
28266
28267 /* missing type support */
28268 return(test_ret);
28269}
28270
28271
28272static int
28273test_xmlModuleSymbol(void) {
28274 int test_ret = 0;
28275
28276#if defined(LIBXML_MODULES_ENABLED)
28277 int mem_base;
Daniel Veillardbe076e92005-01-04 20:18:14 +000028278 int ret_val;
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028279 xmlModulePtr module; /* the module */
28280 int n_module;
28281 char * name; /* the name of the symbol */
28282 int n_name;
Daniel Veillardbe076e92005-01-04 20:18:14 +000028283 void ** symbol; /* the resulting symbol address */
28284 int n_symbol;
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028285
28286 for (n_module = 0;n_module < gen_nb_xmlModulePtr;n_module++) {
28287 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
Daniel Veillardbe076e92005-01-04 20:18:14 +000028288 for (n_symbol = 0;n_symbol < gen_nb_void_ptr_ptr;n_symbol++) {
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028289 mem_base = xmlMemBlocks();
28290 module = gen_xmlModulePtr(n_module, 0);
28291 name = gen_const_char_ptr(n_name, 1);
Daniel Veillardbe076e92005-01-04 20:18:14 +000028292 symbol = gen_void_ptr_ptr(n_symbol, 2);
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028293
Daniel Veillardbe076e92005-01-04 20:18:14 +000028294 ret_val = xmlModuleSymbol(module, (const char *)name, symbol);
28295 desret_int(ret_val);
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028296 call_tests++;
28297 des_xmlModulePtr(n_module, module, 0);
28298 des_const_char_ptr(n_name, (const char *)name, 1);
Daniel Veillardbe076e92005-01-04 20:18:14 +000028299 des_void_ptr_ptr(n_symbol, symbol, 2);
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028300 xmlResetLastError();
28301 if (mem_base != xmlMemBlocks()) {
28302 printf("Leak of %d blocks found in xmlModuleSymbol",
28303 xmlMemBlocks() - mem_base);
28304 test_ret++;
28305 printf(" %d", n_module);
28306 printf(" %d", n_name);
Daniel Veillardbe076e92005-01-04 20:18:14 +000028307 printf(" %d", n_symbol);
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028308 printf("\n");
28309 }
28310 }
28311 }
Daniel Veillardbe076e92005-01-04 20:18:14 +000028312 }
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028313 function_tests++;
28314#endif
28315
28316 return(test_ret);
28317}
28318
28319static int
28320test_xmlmodule(void) {
28321 int test_ret = 0;
28322
28323 if (quiet == 0) printf("Testing xmlmodule : 2 of 4 functions ...\n");
28324 test_ret += test_xmlModuleClose();
28325 test_ret += test_xmlModuleOpen();
28326 test_ret += test_xmlModuleSymbol();
28327
28328 if (test_ret != 0)
28329 printf("Module xmlmodule: %d errors\n", test_ret);
28330 return(test_ret);
28331}
28332
Daniel Veillardd93f6252004-11-02 15:53:51 +000028333static int
28334test_xmlNewTextReader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028335 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028336
William M. Brack21e4ef22005-01-02 09:53:13 +000028337#if defined(LIBXML_READER_ENABLED)
Daniel Veillard34099b42004-11-04 17:34:35 +000028338 int mem_base;
28339 xmlTextReaderPtr ret_val;
28340 xmlParserInputBufferPtr input; /* the xmlParserInputBufferPtr used to read data */
28341 int n_input;
28342 const char * URI; /* the URI information for the source if available */
28343 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028344
Daniel Veillard34099b42004-11-04 17:34:35 +000028345 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
28346 for (n_URI = 0;n_URI < gen_nb_filepath;n_URI++) {
28347 mem_base = xmlMemBlocks();
28348 input = gen_xmlParserInputBufferPtr(n_input, 0);
28349 URI = gen_filepath(n_URI, 1);
28350
28351 ret_val = xmlNewTextReader(input, URI);
28352 desret_xmlTextReaderPtr(ret_val);
28353 call_tests++;
28354 des_xmlParserInputBufferPtr(n_input, input, 0);
28355 des_filepath(n_URI, URI, 1);
28356 xmlResetLastError();
28357 if (mem_base != xmlMemBlocks()) {
28358 printf("Leak of %d blocks found in xmlNewTextReader",
28359 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028360 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000028361 printf(" %d", n_input);
28362 printf(" %d", n_URI);
28363 printf("\n");
28364 }
28365 }
28366 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028367 function_tests++;
Daniel Veillard34099b42004-11-04 17:34:35 +000028368#endif
28369
Daniel Veillard42595322004-11-08 10:52:06 +000028370 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028371}
28372
28373
28374static int
28375test_xmlNewTextReaderFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028376 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028377
William M. Brack21e4ef22005-01-02 09:53:13 +000028378#if defined(LIBXML_READER_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028379 int mem_base;
28380 xmlTextReaderPtr ret_val;
28381 const char * URI; /* the URI of the resource to process */
28382 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028383
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028384 for (n_URI = 0;n_URI < gen_nb_filepath;n_URI++) {
28385 mem_base = xmlMemBlocks();
28386 URI = gen_filepath(n_URI, 0);
28387
28388 ret_val = xmlNewTextReaderFilename(URI);
28389 desret_xmlTextReaderPtr(ret_val);
28390 call_tests++;
28391 des_filepath(n_URI, URI, 0);
28392 xmlResetLastError();
28393 if (mem_base != xmlMemBlocks()) {
28394 printf("Leak of %d blocks found in xmlNewTextReaderFilename",
28395 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028396 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028397 printf(" %d", n_URI);
28398 printf("\n");
28399 }
28400 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028401 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028402#endif
28403
Daniel Veillard42595322004-11-08 10:52:06 +000028404 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028405}
28406
28407
28408static int
28409test_xmlReaderForDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028410 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028411
William M. Brack21e4ef22005-01-02 09:53:13 +000028412#if defined(LIBXML_READER_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028413 int mem_base;
28414 xmlTextReaderPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028415 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028416 int n_cur;
28417 const char * URL; /* the base URL to use for the document */
28418 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028419 char * encoding; /* the document encoding, or NULL */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028420 int n_encoding;
28421 int options; /* a combination of xmlParserOption */
28422 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028423
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028424 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
28425 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28426 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028427 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028428 mem_base = xmlMemBlocks();
28429 cur = gen_const_xmlChar_ptr(n_cur, 0);
28430 URL = gen_filepath(n_URL, 1);
28431 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000028432 options = gen_parseroptions(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028433
William M. Brackf13f77f2004-11-12 16:03:48 +000028434 ret_val = xmlReaderForDoc((const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028435 desret_xmlTextReaderPtr(ret_val);
28436 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000028437 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028438 des_filepath(n_URL, URL, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000028439 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000028440 des_parseroptions(n_options, options, 3);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028441 xmlResetLastError();
28442 if (mem_base != xmlMemBlocks()) {
28443 printf("Leak of %d blocks found in xmlReaderForDoc",
28444 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028445 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028446 printf(" %d", n_cur);
28447 printf(" %d", n_URL);
28448 printf(" %d", n_encoding);
28449 printf(" %d", n_options);
28450 printf("\n");
28451 }
28452 }
28453 }
28454 }
28455 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028456 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028457#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000028458
Daniel Veillard42595322004-11-08 10:52:06 +000028459 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028460}
28461
28462
28463static int
28464test_xmlReaderForFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028465 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028466
William M. Brack21e4ef22005-01-02 09:53:13 +000028467#if defined(LIBXML_READER_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028468 int mem_base;
28469 xmlTextReaderPtr ret_val;
28470 const char * filename; /* a file or URL */
28471 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028472 char * encoding; /* the document encoding, or NULL */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028473 int n_encoding;
28474 int options; /* a combination of xmlParserOption */
28475 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028476
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028477 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
28478 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028479 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028480 mem_base = xmlMemBlocks();
28481 filename = gen_filepath(n_filename, 0);
28482 encoding = gen_const_char_ptr(n_encoding, 1);
Daniel Veillard6128c012004-11-08 17:16:15 +000028483 options = gen_parseroptions(n_options, 2);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028484
William M. Brackf13f77f2004-11-12 16:03:48 +000028485 ret_val = xmlReaderForFile(filename, (const char *)encoding, options);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028486 desret_xmlTextReaderPtr(ret_val);
28487 call_tests++;
28488 des_filepath(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000028489 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillard6128c012004-11-08 17:16:15 +000028490 des_parseroptions(n_options, options, 2);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028491 xmlResetLastError();
28492 if (mem_base != xmlMemBlocks()) {
28493 printf("Leak of %d blocks found in xmlReaderForFile",
28494 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028495 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028496 printf(" %d", n_filename);
28497 printf(" %d", n_encoding);
28498 printf(" %d", n_options);
28499 printf("\n");
28500 }
28501 }
28502 }
28503 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028504 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028505#endif
28506
Daniel Veillard42595322004-11-08 10:52:06 +000028507 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028508}
28509
28510
28511static int
28512test_xmlReaderForMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028513 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028514
William M. Brack21e4ef22005-01-02 09:53:13 +000028515#if defined(LIBXML_READER_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028516 int mem_base;
28517 xmlTextReaderPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028518 char * buffer; /* a pointer to a char array */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028519 int n_buffer;
28520 int size; /* the size of the array */
28521 int n_size;
28522 const char * URL; /* the base URL to use for the document */
28523 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028524 char * encoding; /* the document encoding, or NULL */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028525 int n_encoding;
28526 int options; /* a combination of xmlParserOption */
28527 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028528
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028529 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
28530 for (n_size = 0;n_size < gen_nb_int;n_size++) {
28531 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28532 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028533 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028534 mem_base = xmlMemBlocks();
28535 buffer = gen_const_char_ptr(n_buffer, 0);
28536 size = gen_int(n_size, 1);
28537 URL = gen_filepath(n_URL, 2);
28538 encoding = gen_const_char_ptr(n_encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000028539 options = gen_parseroptions(n_options, 4);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028540
William M. Brackf13f77f2004-11-12 16:03:48 +000028541 ret_val = xmlReaderForMemory((const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028542 desret_xmlTextReaderPtr(ret_val);
28543 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000028544 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028545 des_int(n_size, size, 1);
28546 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000028547 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000028548 des_parseroptions(n_options, options, 4);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028549 xmlResetLastError();
28550 if (mem_base != xmlMemBlocks()) {
28551 printf("Leak of %d blocks found in xmlReaderForMemory",
28552 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028553 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028554 printf(" %d", n_buffer);
28555 printf(" %d", n_size);
28556 printf(" %d", n_URL);
28557 printf(" %d", n_encoding);
28558 printf(" %d", n_options);
28559 printf("\n");
28560 }
28561 }
28562 }
28563 }
28564 }
28565 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028566 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028567#endif
28568
Daniel Veillard42595322004-11-08 10:52:06 +000028569 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028570}
28571
28572
28573static int
28574test_xmlReaderNewDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028575 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028576
William M. Brack21e4ef22005-01-02 09:53:13 +000028577#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028578 int mem_base;
28579 int ret_val;
28580 xmlTextReaderPtr reader; /* an XML reader */
28581 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028582 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028583 int n_cur;
28584 const char * URL; /* the base URL to use for the document */
28585 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028586 char * encoding; /* the document encoding, or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028587 int n_encoding;
28588 int options; /* a combination of xmlParserOption */
28589 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028590
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028591 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28592 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
28593 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28594 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028595 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028596 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028597 reader = gen_xmlTextReaderPtr(n_reader, 0);
28598 cur = gen_const_xmlChar_ptr(n_cur, 1);
28599 URL = gen_filepath(n_URL, 2);
28600 encoding = gen_const_char_ptr(n_encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000028601 options = gen_parseroptions(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028602
William M. Brackf13f77f2004-11-12 16:03:48 +000028603 ret_val = xmlReaderNewDoc(reader, (const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028604 desret_int(ret_val);
28605 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028606 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000028607 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000028608 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000028609 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000028610 des_parseroptions(n_options, options, 4);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028611 xmlResetLastError();
28612 if (mem_base != xmlMemBlocks()) {
28613 printf("Leak of %d blocks found in xmlReaderNewDoc",
28614 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028615 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028616 printf(" %d", n_reader);
28617 printf(" %d", n_cur);
28618 printf(" %d", n_URL);
28619 printf(" %d", n_encoding);
28620 printf(" %d", n_options);
28621 printf("\n");
28622 }
28623 }
28624 }
28625 }
28626 }
28627 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028628 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028629#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000028630
Daniel Veillard42595322004-11-08 10:52:06 +000028631 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028632}
28633
28634
28635static int
28636test_xmlReaderNewFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028637 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028638
William M. Brack21e4ef22005-01-02 09:53:13 +000028639#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028640 int mem_base;
28641 int ret_val;
28642 xmlTextReaderPtr reader; /* an XML reader */
28643 int n_reader;
28644 const char * filename; /* a file or URL */
28645 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028646 char * encoding; /* the document encoding, or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028647 int n_encoding;
28648 int options; /* a combination of xmlParserOption */
28649 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028650
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028651 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28652 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
28653 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028654 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028655 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028656 reader = gen_xmlTextReaderPtr(n_reader, 0);
28657 filename = gen_filepath(n_filename, 1);
28658 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000028659 options = gen_parseroptions(n_options, 3);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028660
William M. Brackf13f77f2004-11-12 16:03:48 +000028661 ret_val = xmlReaderNewFile(reader, filename, (const char *)encoding, options);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028662 desret_int(ret_val);
28663 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028664 des_xmlTextReaderPtr(n_reader, reader, 0);
28665 des_filepath(n_filename, filename, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000028666 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000028667 des_parseroptions(n_options, options, 3);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028668 xmlResetLastError();
28669 if (mem_base != xmlMemBlocks()) {
28670 printf("Leak of %d blocks found in xmlReaderNewFile",
28671 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028672 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028673 printf(" %d", n_reader);
28674 printf(" %d", n_filename);
28675 printf(" %d", n_encoding);
28676 printf(" %d", n_options);
28677 printf("\n");
28678 }
28679 }
28680 }
28681 }
28682 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028683 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028684#endif
28685
Daniel Veillard42595322004-11-08 10:52:06 +000028686 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028687}
28688
28689
28690static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000028691test_xmlReaderNewMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028692 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028693
William M. Brack21e4ef22005-01-02 09:53:13 +000028694#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028695 int mem_base;
28696 int ret_val;
28697 xmlTextReaderPtr reader; /* an XML reader */
28698 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028699 char * buffer; /* a pointer to a char array */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028700 int n_buffer;
28701 int size; /* the size of the array */
28702 int n_size;
28703 const char * URL; /* the base URL to use for the document */
28704 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028705 char * encoding; /* the document encoding, or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028706 int n_encoding;
28707 int options; /* a combination of xmlParserOption */
28708 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028709
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028710 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28711 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
28712 for (n_size = 0;n_size < gen_nb_int;n_size++) {
28713 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28714 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028715 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028716 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028717 reader = gen_xmlTextReaderPtr(n_reader, 0);
28718 buffer = gen_const_char_ptr(n_buffer, 1);
28719 size = gen_int(n_size, 2);
28720 URL = gen_filepath(n_URL, 3);
28721 encoding = gen_const_char_ptr(n_encoding, 4);
Daniel Veillard6128c012004-11-08 17:16:15 +000028722 options = gen_parseroptions(n_options, 5);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028723
William M. Brackf13f77f2004-11-12 16:03:48 +000028724 ret_val = xmlReaderNewMemory(reader, (const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028725 desret_int(ret_val);
28726 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028727 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000028728 des_const_char_ptr(n_buffer, (const char *)buffer, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000028729 des_int(n_size, size, 2);
28730 des_filepath(n_URL, URL, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000028731 des_const_char_ptr(n_encoding, (const char *)encoding, 4);
Daniel Veillard6128c012004-11-08 17:16:15 +000028732 des_parseroptions(n_options, options, 5);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028733 xmlResetLastError();
28734 if (mem_base != xmlMemBlocks()) {
28735 printf("Leak of %d blocks found in xmlReaderNewMemory",
28736 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028737 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028738 printf(" %d", n_reader);
28739 printf(" %d", n_buffer);
28740 printf(" %d", n_size);
28741 printf(" %d", n_URL);
28742 printf(" %d", n_encoding);
28743 printf(" %d", n_options);
28744 printf("\n");
28745 }
28746 }
28747 }
28748 }
28749 }
28750 }
28751 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028752 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028753#endif
28754
Daniel Veillard42595322004-11-08 10:52:06 +000028755 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028756}
28757
28758
28759static int
28760test_xmlReaderNewWalker(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028761 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028762
William M. Brack21e4ef22005-01-02 09:53:13 +000028763#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028764 int mem_base;
28765 int ret_val;
28766 xmlTextReaderPtr reader; /* an XML reader */
28767 int n_reader;
28768 xmlDocPtr doc; /* a preparsed document */
28769 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028770
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028771 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28772 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
28773 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028774 reader = gen_xmlTextReaderPtr(n_reader, 0);
28775 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028776
28777 ret_val = xmlReaderNewWalker(reader, doc);
28778 desret_int(ret_val);
28779 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028780 des_xmlTextReaderPtr(n_reader, reader, 0);
28781 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028782 xmlResetLastError();
28783 if (mem_base != xmlMemBlocks()) {
28784 printf("Leak of %d blocks found in xmlReaderNewWalker",
28785 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028786 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028787 printf(" %d", n_reader);
28788 printf(" %d", n_doc);
28789 printf("\n");
28790 }
28791 }
28792 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028793 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028794#endif
28795
Daniel Veillard42595322004-11-08 10:52:06 +000028796 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028797}
28798
28799
28800static int
28801test_xmlReaderWalker(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028802 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028803
William M. Brack21e4ef22005-01-02 09:53:13 +000028804#if defined(LIBXML_READER_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028805 int mem_base;
28806 xmlTextReaderPtr ret_val;
28807 xmlDocPtr doc; /* a preparsed document */
28808 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028809
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028810 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
28811 mem_base = xmlMemBlocks();
28812 doc = gen_xmlDocPtr(n_doc, 0);
28813
28814 ret_val = xmlReaderWalker(doc);
28815 desret_xmlTextReaderPtr(ret_val);
28816 call_tests++;
28817 des_xmlDocPtr(n_doc, doc, 0);
28818 xmlResetLastError();
28819 if (mem_base != xmlMemBlocks()) {
28820 printf("Leak of %d blocks found in xmlReaderWalker",
28821 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028822 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028823 printf(" %d", n_doc);
28824 printf("\n");
28825 }
28826 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028827 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028828#endif
28829
Daniel Veillard42595322004-11-08 10:52:06 +000028830 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028831}
28832
28833
28834static int
28835test_xmlTextReaderAttributeCount(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028836 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028837
William M. Brack21e4ef22005-01-02 09:53:13 +000028838#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028839 int mem_base;
28840 int ret_val;
28841 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28842 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028843
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028844 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28845 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028846 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028847
28848 ret_val = xmlTextReaderAttributeCount(reader);
28849 desret_int(ret_val);
28850 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028851 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028852 xmlResetLastError();
28853 if (mem_base != xmlMemBlocks()) {
28854 printf("Leak of %d blocks found in xmlTextReaderAttributeCount",
28855 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028856 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028857 printf(" %d", n_reader);
28858 printf("\n");
28859 }
28860 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028861 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028862#endif
28863
Daniel Veillard42595322004-11-08 10:52:06 +000028864 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028865}
28866
28867
28868static int
28869test_xmlTextReaderBaseUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028870 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028871
William M. Brack21e4ef22005-01-02 09:53:13 +000028872#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028873 int mem_base;
28874 xmlChar * ret_val;
28875 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28876 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028877
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028878 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28879 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028880 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028881
28882 ret_val = xmlTextReaderBaseUri(reader);
28883 desret_xmlChar_ptr(ret_val);
28884 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028885 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028886 xmlResetLastError();
28887 if (mem_base != xmlMemBlocks()) {
28888 printf("Leak of %d blocks found in xmlTextReaderBaseUri",
28889 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028890 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028891 printf(" %d", n_reader);
28892 printf("\n");
28893 }
28894 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028895 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028896#endif
28897
Daniel Veillard42595322004-11-08 10:52:06 +000028898 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028899}
28900
28901
28902static int
28903test_xmlTextReaderClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028904 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028905
William M. Brack21e4ef22005-01-02 09:53:13 +000028906#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028907 int mem_base;
28908 int ret_val;
28909 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28910 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028911
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028912 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28913 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028914 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028915
28916 ret_val = xmlTextReaderClose(reader);
28917 desret_int(ret_val);
28918 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028919 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028920 xmlResetLastError();
28921 if (mem_base != xmlMemBlocks()) {
28922 printf("Leak of %d blocks found in xmlTextReaderClose",
28923 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028924 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028925 printf(" %d", n_reader);
28926 printf("\n");
28927 }
28928 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028929 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028930#endif
28931
Daniel Veillard42595322004-11-08 10:52:06 +000028932 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028933}
28934
28935
28936static int
28937test_xmlTextReaderConstBaseUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028938 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028939
William M. Brack21e4ef22005-01-02 09:53:13 +000028940#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028941 int mem_base;
28942 const xmlChar * ret_val;
28943 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28944 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028945
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028946 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28947 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028948 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028949
28950 ret_val = xmlTextReaderConstBaseUri(reader);
28951 desret_const_xmlChar_ptr(ret_val);
28952 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028953 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028954 xmlResetLastError();
28955 if (mem_base != xmlMemBlocks()) {
28956 printf("Leak of %d blocks found in xmlTextReaderConstBaseUri",
28957 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028958 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028959 printf(" %d", n_reader);
28960 printf("\n");
28961 }
28962 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028963 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028964#endif
28965
Daniel Veillard42595322004-11-08 10:52:06 +000028966 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028967}
28968
28969
28970static int
28971test_xmlTextReaderConstEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028972 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028973
William M. Brack21e4ef22005-01-02 09:53:13 +000028974#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028975 int mem_base;
28976 const xmlChar * ret_val;
28977 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28978 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028979
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028980 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28981 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028982 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028983
28984 ret_val = xmlTextReaderConstEncoding(reader);
28985 desret_const_xmlChar_ptr(ret_val);
28986 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028987 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028988 xmlResetLastError();
28989 if (mem_base != xmlMemBlocks()) {
28990 printf("Leak of %d blocks found in xmlTextReaderConstEncoding",
28991 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028992 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028993 printf(" %d", n_reader);
28994 printf("\n");
28995 }
28996 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028997 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028998#endif
28999
Daniel Veillard42595322004-11-08 10:52:06 +000029000 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029001}
29002
29003
29004static int
29005test_xmlTextReaderConstLocalName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029006 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029007
William M. Brack21e4ef22005-01-02 09:53:13 +000029008#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029009 int mem_base;
29010 const xmlChar * ret_val;
29011 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29012 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029013
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029014 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29015 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029016 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029017
29018 ret_val = xmlTextReaderConstLocalName(reader);
29019 desret_const_xmlChar_ptr(ret_val);
29020 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029021 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029022 xmlResetLastError();
29023 if (mem_base != xmlMemBlocks()) {
29024 printf("Leak of %d blocks found in xmlTextReaderConstLocalName",
29025 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029026 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029027 printf(" %d", n_reader);
29028 printf("\n");
29029 }
29030 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029031 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029032#endif
29033
Daniel Veillard42595322004-11-08 10:52:06 +000029034 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029035}
29036
29037
29038static int
29039test_xmlTextReaderConstName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029040 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029041
William M. Brack21e4ef22005-01-02 09:53:13 +000029042#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029043 int mem_base;
29044 const xmlChar * ret_val;
29045 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29046 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029047
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029048 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29049 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029050 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029051
29052 ret_val = xmlTextReaderConstName(reader);
29053 desret_const_xmlChar_ptr(ret_val);
29054 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029055 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029056 xmlResetLastError();
29057 if (mem_base != xmlMemBlocks()) {
29058 printf("Leak of %d blocks found in xmlTextReaderConstName",
29059 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029060 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029061 printf(" %d", n_reader);
29062 printf("\n");
29063 }
29064 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029065 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029066#endif
29067
Daniel Veillard42595322004-11-08 10:52:06 +000029068 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029069}
29070
29071
29072static int
29073test_xmlTextReaderConstNamespaceUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029074 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029075
William M. Brack21e4ef22005-01-02 09:53:13 +000029076#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029077 int mem_base;
29078 const xmlChar * ret_val;
29079 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29080 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029081
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029082 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29083 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029084 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029085
29086 ret_val = xmlTextReaderConstNamespaceUri(reader);
29087 desret_const_xmlChar_ptr(ret_val);
29088 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029089 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029090 xmlResetLastError();
29091 if (mem_base != xmlMemBlocks()) {
29092 printf("Leak of %d blocks found in xmlTextReaderConstNamespaceUri",
29093 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029094 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029095 printf(" %d", n_reader);
29096 printf("\n");
29097 }
29098 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029099 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029100#endif
29101
Daniel Veillard42595322004-11-08 10:52:06 +000029102 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029103}
29104
29105
29106static int
29107test_xmlTextReaderConstPrefix(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029108 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029109
William M. Brack21e4ef22005-01-02 09:53:13 +000029110#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029111 int mem_base;
29112 const xmlChar * ret_val;
29113 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29114 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029115
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029116 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29117 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029118 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029119
29120 ret_val = xmlTextReaderConstPrefix(reader);
29121 desret_const_xmlChar_ptr(ret_val);
29122 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029123 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029124 xmlResetLastError();
29125 if (mem_base != xmlMemBlocks()) {
29126 printf("Leak of %d blocks found in xmlTextReaderConstPrefix",
29127 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029128 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029129 printf(" %d", n_reader);
29130 printf("\n");
29131 }
29132 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029133 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029134#endif
29135
Daniel Veillard42595322004-11-08 10:52:06 +000029136 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029137}
29138
29139
29140static int
29141test_xmlTextReaderConstString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029142 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029143
William M. Brack21e4ef22005-01-02 09:53:13 +000029144#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029145 int mem_base;
29146 const xmlChar * ret_val;
29147 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29148 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029149 xmlChar * str; /* the string to intern. */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029150 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029151
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029152 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29153 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
29154 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029155 reader = gen_xmlTextReaderPtr(n_reader, 0);
29156 str = gen_const_xmlChar_ptr(n_str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029157
William M. Brackf13f77f2004-11-12 16:03:48 +000029158 ret_val = xmlTextReaderConstString(reader, (const xmlChar *)str);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029159 desret_const_xmlChar_ptr(ret_val);
29160 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029161 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000029162 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029163 xmlResetLastError();
29164 if (mem_base != xmlMemBlocks()) {
29165 printf("Leak of %d blocks found in xmlTextReaderConstString",
29166 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029167 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029168 printf(" %d", n_reader);
29169 printf(" %d", n_str);
29170 printf("\n");
29171 }
29172 }
29173 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029174 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029175#endif
29176
Daniel Veillard42595322004-11-08 10:52:06 +000029177 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029178}
29179
29180
29181static int
29182test_xmlTextReaderConstValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029183 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029184
William M. Brack21e4ef22005-01-02 09:53:13 +000029185#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029186 int mem_base;
29187 const xmlChar * ret_val;
29188 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29189 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029190
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029191 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29192 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029193 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029194
29195 ret_val = xmlTextReaderConstValue(reader);
29196 desret_const_xmlChar_ptr(ret_val);
29197 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029198 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029199 xmlResetLastError();
29200 if (mem_base != xmlMemBlocks()) {
29201 printf("Leak of %d blocks found in xmlTextReaderConstValue",
29202 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029203 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029204 printf(" %d", n_reader);
29205 printf("\n");
29206 }
29207 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029208 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029209#endif
29210
Daniel Veillard42595322004-11-08 10:52:06 +000029211 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029212}
29213
29214
29215static int
29216test_xmlTextReaderConstXmlLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029217 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029218
William M. Brack21e4ef22005-01-02 09:53:13 +000029219#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029220 int mem_base;
29221 const xmlChar * ret_val;
29222 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29223 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029224
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029225 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29226 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029227 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029228
29229 ret_val = xmlTextReaderConstXmlLang(reader);
29230 desret_const_xmlChar_ptr(ret_val);
29231 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029232 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029233 xmlResetLastError();
29234 if (mem_base != xmlMemBlocks()) {
29235 printf("Leak of %d blocks found in xmlTextReaderConstXmlLang",
29236 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029237 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029238 printf(" %d", n_reader);
29239 printf("\n");
29240 }
29241 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029242 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029243#endif
29244
Daniel Veillard42595322004-11-08 10:52:06 +000029245 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029246}
29247
29248
29249static int
29250test_xmlTextReaderConstXmlVersion(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029251 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029252
William M. Brack21e4ef22005-01-02 09:53:13 +000029253#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029254 int mem_base;
29255 const xmlChar * ret_val;
29256 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29257 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029258
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029259 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29260 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029261 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029262
29263 ret_val = xmlTextReaderConstXmlVersion(reader);
29264 desret_const_xmlChar_ptr(ret_val);
29265 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029266 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029267 xmlResetLastError();
29268 if (mem_base != xmlMemBlocks()) {
29269 printf("Leak of %d blocks found in xmlTextReaderConstXmlVersion",
29270 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029271 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029272 printf(" %d", n_reader);
29273 printf("\n");
29274 }
29275 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029276 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029277#endif
29278
Daniel Veillard42595322004-11-08 10:52:06 +000029279 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029280}
29281
29282
29283static int
29284test_xmlTextReaderCurrentDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029285 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029286
William M. Brack21e4ef22005-01-02 09:53:13 +000029287#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029288 int mem_base;
29289 xmlDocPtr ret_val;
29290 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29291 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029292
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029293 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29294 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029295 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029296
29297 ret_val = xmlTextReaderCurrentDoc(reader);
29298 desret_xmlDocPtr(ret_val);
29299 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029300 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029301 xmlResetLastError();
29302 if (mem_base != xmlMemBlocks()) {
29303 printf("Leak of %d blocks found in xmlTextReaderCurrentDoc",
29304 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029305 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029306 printf(" %d", n_reader);
29307 printf("\n");
29308 }
29309 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029310 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029311#endif
29312
Daniel Veillard42595322004-11-08 10:52:06 +000029313 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029314}
29315
29316
29317static int
29318test_xmlTextReaderCurrentNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029319 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029320
William M. Brack21e4ef22005-01-02 09:53:13 +000029321#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029322 int mem_base;
29323 xmlNodePtr ret_val;
29324 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29325 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029326
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029327 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29328 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029329 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029330
29331 ret_val = xmlTextReaderCurrentNode(reader);
29332 desret_xmlNodePtr(ret_val);
29333 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029334 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029335 xmlResetLastError();
29336 if (mem_base != xmlMemBlocks()) {
29337 printf("Leak of %d blocks found in xmlTextReaderCurrentNode",
29338 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029339 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029340 printf(" %d", n_reader);
29341 printf("\n");
29342 }
29343 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029344 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029345#endif
29346
Daniel Veillard42595322004-11-08 10:52:06 +000029347 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029348}
29349
29350
29351static int
29352test_xmlTextReaderDepth(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029353 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029354
William M. Brack21e4ef22005-01-02 09:53:13 +000029355#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029356 int mem_base;
29357 int ret_val;
29358 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29359 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029360
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029361 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29362 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029363 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029364
29365 ret_val = xmlTextReaderDepth(reader);
29366 desret_int(ret_val);
29367 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029368 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029369 xmlResetLastError();
29370 if (mem_base != xmlMemBlocks()) {
29371 printf("Leak of %d blocks found in xmlTextReaderDepth",
29372 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029373 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029374 printf(" %d", n_reader);
29375 printf("\n");
29376 }
29377 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029378 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029379#endif
29380
Daniel Veillard42595322004-11-08 10:52:06 +000029381 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029382}
29383
29384
29385static int
29386test_xmlTextReaderExpand(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029387 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029388
William M. Brack21e4ef22005-01-02 09:53:13 +000029389#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029390 int mem_base;
29391 xmlNodePtr ret_val;
29392 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29393 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029394
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029395 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29396 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029397 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029398
29399 ret_val = xmlTextReaderExpand(reader);
29400 desret_xmlNodePtr(ret_val);
29401 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029402 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029403 xmlResetLastError();
29404 if (mem_base != xmlMemBlocks()) {
29405 printf("Leak of %d blocks found in xmlTextReaderExpand",
29406 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029407 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029408 printf(" %d", n_reader);
29409 printf("\n");
29410 }
29411 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029412 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029413#endif
29414
Daniel Veillard42595322004-11-08 10:52:06 +000029415 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029416}
29417
29418
29419static int
29420test_xmlTextReaderGetAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029421 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029422
William M. Brack21e4ef22005-01-02 09:53:13 +000029423#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029424 int mem_base;
29425 xmlChar * ret_val;
29426 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29427 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029428 xmlChar * name; /* the qualified name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029429 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029430
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029431 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29432 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
29433 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029434 reader = gen_xmlTextReaderPtr(n_reader, 0);
29435 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029436
William M. Brackf13f77f2004-11-12 16:03:48 +000029437 ret_val = xmlTextReaderGetAttribute(reader, (const xmlChar *)name);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029438 desret_xmlChar_ptr(ret_val);
29439 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029440 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000029441 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029442 xmlResetLastError();
29443 if (mem_base != xmlMemBlocks()) {
29444 printf("Leak of %d blocks found in xmlTextReaderGetAttribute",
29445 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029446 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029447 printf(" %d", n_reader);
29448 printf(" %d", n_name);
29449 printf("\n");
29450 }
29451 }
29452 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029453 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029454#endif
29455
Daniel Veillard42595322004-11-08 10:52:06 +000029456 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029457}
29458
29459
29460static int
29461test_xmlTextReaderGetAttributeNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029462 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029463
William M. Brack21e4ef22005-01-02 09:53:13 +000029464#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029465 int mem_base;
29466 xmlChar * ret_val;
29467 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29468 int n_reader;
29469 int no; /* the zero-based index of the attribute relative to the containing element */
29470 int n_no;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029471
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029472 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29473 for (n_no = 0;n_no < gen_nb_int;n_no++) {
29474 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029475 reader = gen_xmlTextReaderPtr(n_reader, 0);
29476 no = gen_int(n_no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029477
29478 ret_val = xmlTextReaderGetAttributeNo(reader, no);
29479 desret_xmlChar_ptr(ret_val);
29480 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029481 des_xmlTextReaderPtr(n_reader, reader, 0);
29482 des_int(n_no, no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029483 xmlResetLastError();
29484 if (mem_base != xmlMemBlocks()) {
29485 printf("Leak of %d blocks found in xmlTextReaderGetAttributeNo",
29486 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029487 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029488 printf(" %d", n_reader);
29489 printf(" %d", n_no);
29490 printf("\n");
29491 }
29492 }
29493 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029494 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029495#endif
29496
Daniel Veillard42595322004-11-08 10:52:06 +000029497 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029498}
29499
29500
29501static int
29502test_xmlTextReaderGetAttributeNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029503 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029504
William M. Brack21e4ef22005-01-02 09:53:13 +000029505#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029506 int mem_base;
29507 xmlChar * ret_val;
29508 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29509 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029510 xmlChar * localName; /* the local name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029511 int n_localName;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029512 xmlChar * namespaceURI; /* the namespace URI of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029513 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029514
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029515 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29516 for (n_localName = 0;n_localName < gen_nb_const_xmlChar_ptr;n_localName++) {
29517 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
29518 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029519 reader = gen_xmlTextReaderPtr(n_reader, 0);
29520 localName = gen_const_xmlChar_ptr(n_localName, 1);
29521 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029522
William M. Brackf13f77f2004-11-12 16:03:48 +000029523 ret_val = xmlTextReaderGetAttributeNs(reader, (const xmlChar *)localName, (const xmlChar *)namespaceURI);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029524 desret_xmlChar_ptr(ret_val);
29525 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029526 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000029527 des_const_xmlChar_ptr(n_localName, (const xmlChar *)localName, 1);
29528 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029529 xmlResetLastError();
29530 if (mem_base != xmlMemBlocks()) {
29531 printf("Leak of %d blocks found in xmlTextReaderGetAttributeNs",
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(" %d", n_localName);
29536 printf(" %d", n_namespaceURI);
29537 printf("\n");
29538 }
29539 }
29540 }
29541 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029542 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029543#endif
29544
Daniel Veillard42595322004-11-08 10:52:06 +000029545 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029546}
29547
Daniel Veillarda521d282004-11-09 14:59:59 +000029548#ifdef LIBXML_READER_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000029549
Daniel Veillardce682bc2004-11-05 17:22:25 +000029550#define gen_nb_xmlTextReaderErrorFunc_ptr 1
29551static xmlTextReaderErrorFunc * gen_xmlTextReaderErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
29552 return(NULL);
29553}
29554static void des_xmlTextReaderErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlTextReaderErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
29555}
Daniel Veillarda521d282004-11-09 14:59:59 +000029556#endif
29557
Daniel Veillardce682bc2004-11-05 17:22:25 +000029558
Daniel Veillardd93f6252004-11-02 15:53:51 +000029559static int
29560test_xmlTextReaderGetErrorHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029561 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029562
William M. Brack21e4ef22005-01-02 09:53:13 +000029563#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029564 int mem_base;
29565 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29566 int n_reader;
29567 xmlTextReaderErrorFunc * f; /* the callback function or NULL is no callback has been registered */
29568 int n_f;
29569 void ** arg; /* a user argument */
29570 int n_arg;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029571
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029572 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29573 for (n_f = 0;n_f < gen_nb_xmlTextReaderErrorFunc_ptr;n_f++) {
29574 for (n_arg = 0;n_arg < gen_nb_void_ptr_ptr;n_arg++) {
29575 mem_base = xmlMemBlocks();
29576 reader = gen_xmlTextReaderPtr(n_reader, 0);
29577 f = gen_xmlTextReaderErrorFunc_ptr(n_f, 1);
29578 arg = gen_void_ptr_ptr(n_arg, 2);
29579
29580 xmlTextReaderGetErrorHandler(reader, f, arg);
29581 call_tests++;
29582 des_xmlTextReaderPtr(n_reader, reader, 0);
29583 des_xmlTextReaderErrorFunc_ptr(n_f, f, 1);
29584 des_void_ptr_ptr(n_arg, arg, 2);
29585 xmlResetLastError();
29586 if (mem_base != xmlMemBlocks()) {
29587 printf("Leak of %d blocks found in xmlTextReaderGetErrorHandler",
29588 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029589 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029590 printf(" %d", n_reader);
29591 printf(" %d", n_f);
29592 printf(" %d", n_arg);
29593 printf("\n");
29594 }
29595 }
29596 }
29597 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029598 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029599#endif
29600
Daniel Veillard42595322004-11-08 10:52:06 +000029601 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029602}
29603
29604
29605static int
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000029606test_xmlTextReaderGetParserColumnNumber(void) {
29607 int test_ret = 0;
29608
29609#if defined(LIBXML_READER_ENABLED)
29610 int mem_base;
29611 int ret_val;
29612 xmlTextReaderPtr reader; /* the user data (XML reader context) */
29613 int n_reader;
29614
29615 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29616 mem_base = xmlMemBlocks();
29617 reader = gen_xmlTextReaderPtr(n_reader, 0);
29618
29619 ret_val = xmlTextReaderGetParserColumnNumber(reader);
29620 desret_int(ret_val);
29621 call_tests++;
29622 des_xmlTextReaderPtr(n_reader, reader, 0);
29623 xmlResetLastError();
29624 if (mem_base != xmlMemBlocks()) {
29625 printf("Leak of %d blocks found in xmlTextReaderGetParserColumnNumber",
29626 xmlMemBlocks() - mem_base);
29627 test_ret++;
29628 printf(" %d", n_reader);
29629 printf("\n");
29630 }
29631 }
29632 function_tests++;
29633#endif
29634
29635 return(test_ret);
29636}
29637
29638
29639static int
29640test_xmlTextReaderGetParserLineNumber(void) {
29641 int test_ret = 0;
29642
29643#if defined(LIBXML_READER_ENABLED)
29644 int mem_base;
29645 int ret_val;
29646 xmlTextReaderPtr reader; /* the user data (XML reader context) */
29647 int n_reader;
29648
29649 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29650 mem_base = xmlMemBlocks();
29651 reader = gen_xmlTextReaderPtr(n_reader, 0);
29652
29653 ret_val = xmlTextReaderGetParserLineNumber(reader);
29654 desret_int(ret_val);
29655 call_tests++;
29656 des_xmlTextReaderPtr(n_reader, reader, 0);
29657 xmlResetLastError();
29658 if (mem_base != xmlMemBlocks()) {
29659 printf("Leak of %d blocks found in xmlTextReaderGetParserLineNumber",
29660 xmlMemBlocks() - mem_base);
29661 test_ret++;
29662 printf(" %d", n_reader);
29663 printf("\n");
29664 }
29665 }
29666 function_tests++;
29667#endif
29668
29669 return(test_ret);
29670}
29671
29672
29673static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000029674test_xmlTextReaderGetParserProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029675 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029676
William M. Brack21e4ef22005-01-02 09:53:13 +000029677#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029678 int mem_base;
29679 int ret_val;
29680 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29681 int n_reader;
29682 int prop; /* the xmlParserProperties to get */
29683 int n_prop;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029684
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029685 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29686 for (n_prop = 0;n_prop < gen_nb_int;n_prop++) {
29687 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029688 reader = gen_xmlTextReaderPtr(n_reader, 0);
29689 prop = gen_int(n_prop, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029690
29691 ret_val = xmlTextReaderGetParserProp(reader, prop);
29692 desret_int(ret_val);
29693 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029694 des_xmlTextReaderPtr(n_reader, reader, 0);
29695 des_int(n_prop, prop, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029696 xmlResetLastError();
29697 if (mem_base != xmlMemBlocks()) {
29698 printf("Leak of %d blocks found in xmlTextReaderGetParserProp",
29699 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029700 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029701 printf(" %d", n_reader);
29702 printf(" %d", n_prop);
29703 printf("\n");
29704 }
29705 }
29706 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029707 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029708#endif
29709
Daniel Veillard42595322004-11-08 10:52:06 +000029710 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029711}
29712
29713
29714static int
29715test_xmlTextReaderGetRemainder(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029716 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029717
William M. Brack21e4ef22005-01-02 09:53:13 +000029718#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029719 int mem_base;
29720 xmlParserInputBufferPtr ret_val;
29721 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29722 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029723
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029724 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29725 mem_base = xmlMemBlocks();
29726 reader = gen_xmlTextReaderPtr(n_reader, 0);
29727
29728 ret_val = xmlTextReaderGetRemainder(reader);
29729 desret_xmlParserInputBufferPtr(ret_val);
29730 call_tests++;
29731 des_xmlTextReaderPtr(n_reader, reader, 0);
29732 xmlResetLastError();
29733 if (mem_base != xmlMemBlocks()) {
29734 printf("Leak of %d blocks found in xmlTextReaderGetRemainder",
29735 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029736 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029737 printf(" %d", n_reader);
29738 printf("\n");
29739 }
29740 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029741 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029742#endif
29743
Daniel Veillard42595322004-11-08 10:52:06 +000029744 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029745}
29746
29747
29748static int
29749test_xmlTextReaderHasAttributes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029750 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029751
William M. Brack21e4ef22005-01-02 09:53:13 +000029752#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029753 int mem_base;
29754 int ret_val;
29755 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29756 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029757
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029758 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29759 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029760 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029761
29762 ret_val = xmlTextReaderHasAttributes(reader);
29763 desret_int(ret_val);
29764 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029765 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029766 xmlResetLastError();
29767 if (mem_base != xmlMemBlocks()) {
29768 printf("Leak of %d blocks found in xmlTextReaderHasAttributes",
29769 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029770 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029771 printf(" %d", n_reader);
29772 printf("\n");
29773 }
29774 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029775 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029776#endif
29777
Daniel Veillard42595322004-11-08 10:52:06 +000029778 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029779}
29780
29781
29782static int
29783test_xmlTextReaderHasValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029784 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029785
William M. Brack21e4ef22005-01-02 09:53:13 +000029786#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029787 int mem_base;
29788 int ret_val;
29789 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29790 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029791
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029792 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29793 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029794 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029795
29796 ret_val = xmlTextReaderHasValue(reader);
29797 desret_int(ret_val);
29798 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029799 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029800 xmlResetLastError();
29801 if (mem_base != xmlMemBlocks()) {
29802 printf("Leak of %d blocks found in xmlTextReaderHasValue",
29803 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029804 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029805 printf(" %d", n_reader);
29806 printf("\n");
29807 }
29808 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029809 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029810#endif
29811
Daniel Veillard42595322004-11-08 10:52:06 +000029812 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029813}
29814
29815
29816static int
29817test_xmlTextReaderIsDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029818 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029819
William M. Brack21e4ef22005-01-02 09:53:13 +000029820#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029821 int mem_base;
29822 int ret_val;
29823 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29824 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029825
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029826 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29827 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029828 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029829
29830 ret_val = xmlTextReaderIsDefault(reader);
29831 desret_int(ret_val);
29832 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029833 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029834 xmlResetLastError();
29835 if (mem_base != xmlMemBlocks()) {
29836 printf("Leak of %d blocks found in xmlTextReaderIsDefault",
29837 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029838 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029839 printf(" %d", n_reader);
29840 printf("\n");
29841 }
29842 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029843 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029844#endif
29845
Daniel Veillard42595322004-11-08 10:52:06 +000029846 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029847}
29848
29849
29850static int
29851test_xmlTextReaderIsEmptyElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029852 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029853
William M. Brack21e4ef22005-01-02 09:53:13 +000029854#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029855 int mem_base;
29856 int ret_val;
29857 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29858 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029859
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029860 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29861 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029862 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029863
29864 ret_val = xmlTextReaderIsEmptyElement(reader);
29865 desret_int(ret_val);
29866 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029867 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029868 xmlResetLastError();
29869 if (mem_base != xmlMemBlocks()) {
29870 printf("Leak of %d blocks found in xmlTextReaderIsEmptyElement",
29871 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029872 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029873 printf(" %d", n_reader);
29874 printf("\n");
29875 }
29876 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029877 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029878#endif
29879
Daniel Veillard42595322004-11-08 10:52:06 +000029880 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029881}
29882
29883
29884static int
29885test_xmlTextReaderIsNamespaceDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029886 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029887
William M. Brack21e4ef22005-01-02 09:53:13 +000029888#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029889 int mem_base;
29890 int ret_val;
29891 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29892 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029893
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029894 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29895 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029896 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029897
29898 ret_val = xmlTextReaderIsNamespaceDecl(reader);
29899 desret_int(ret_val);
29900 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029901 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029902 xmlResetLastError();
29903 if (mem_base != xmlMemBlocks()) {
29904 printf("Leak of %d blocks found in xmlTextReaderIsNamespaceDecl",
29905 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029906 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029907 printf(" %d", n_reader);
29908 printf("\n");
29909 }
29910 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029911 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029912#endif
29913
Daniel Veillard42595322004-11-08 10:52:06 +000029914 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029915}
29916
29917
29918static int
29919test_xmlTextReaderIsValid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029920 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029921
William M. Brack21e4ef22005-01-02 09:53:13 +000029922#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029923 int mem_base;
29924 int ret_val;
29925 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29926 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029927
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029928 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29929 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029930 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029931
29932 ret_val = xmlTextReaderIsValid(reader);
29933 desret_int(ret_val);
29934 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029935 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029936 xmlResetLastError();
29937 if (mem_base != xmlMemBlocks()) {
29938 printf("Leak of %d blocks found in xmlTextReaderIsValid",
29939 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029940 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029941 printf(" %d", n_reader);
29942 printf("\n");
29943 }
29944 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029945 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029946#endif
29947
Daniel Veillard42595322004-11-08 10:52:06 +000029948 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029949}
29950
29951
29952static int
29953test_xmlTextReaderLocalName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029954 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029955
William M. Brack21e4ef22005-01-02 09:53:13 +000029956#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029957 int mem_base;
29958 xmlChar * ret_val;
29959 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29960 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029961
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029962 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29963 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029964 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029965
29966 ret_val = xmlTextReaderLocalName(reader);
29967 desret_xmlChar_ptr(ret_val);
29968 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029969 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029970 xmlResetLastError();
29971 if (mem_base != xmlMemBlocks()) {
29972 printf("Leak of %d blocks found in xmlTextReaderLocalName",
29973 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029974 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029975 printf(" %d", n_reader);
29976 printf("\n");
29977 }
29978 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029979 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029980#endif
29981
Daniel Veillard42595322004-11-08 10:52:06 +000029982 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029983}
29984
Daniel Veillarda521d282004-11-09 14:59:59 +000029985#ifdef LIBXML_READER_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000029986
Daniel Veillardce682bc2004-11-05 17:22:25 +000029987#define gen_nb_xmlTextReaderLocatorPtr 1
29988static xmlTextReaderLocatorPtr gen_xmlTextReaderLocatorPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
29989 return(NULL);
29990}
29991static void des_xmlTextReaderLocatorPtr(int no ATTRIBUTE_UNUSED, xmlTextReaderLocatorPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
29992}
Daniel Veillarda521d282004-11-09 14:59:59 +000029993#endif
29994
Daniel Veillardce682bc2004-11-05 17:22:25 +000029995
Daniel Veillardd93f6252004-11-02 15:53:51 +000029996static int
29997test_xmlTextReaderLocatorBaseURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029998 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029999
William M. Brack21e4ef22005-01-02 09:53:13 +000030000#if defined(LIBXML_READER_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000030001 int mem_base;
30002 xmlChar * ret_val;
30003 xmlTextReaderLocatorPtr locator; /* the xmlTextReaderLocatorPtr used */
30004 int n_locator;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030005
Daniel Veillardce682bc2004-11-05 17:22:25 +000030006 for (n_locator = 0;n_locator < gen_nb_xmlTextReaderLocatorPtr;n_locator++) {
30007 mem_base = xmlMemBlocks();
30008 locator = gen_xmlTextReaderLocatorPtr(n_locator, 0);
30009
30010 ret_val = xmlTextReaderLocatorBaseURI(locator);
30011 desret_xmlChar_ptr(ret_val);
30012 call_tests++;
30013 des_xmlTextReaderLocatorPtr(n_locator, locator, 0);
30014 xmlResetLastError();
30015 if (mem_base != xmlMemBlocks()) {
30016 printf("Leak of %d blocks found in xmlTextReaderLocatorBaseURI",
30017 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030018 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030019 printf(" %d", n_locator);
30020 printf("\n");
30021 }
30022 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030023 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030024#endif
30025
Daniel Veillard42595322004-11-08 10:52:06 +000030026 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030027}
30028
30029
30030static int
30031test_xmlTextReaderLocatorLineNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030032 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030033
William M. Brack21e4ef22005-01-02 09:53:13 +000030034#if defined(LIBXML_READER_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000030035 int mem_base;
30036 int ret_val;
30037 xmlTextReaderLocatorPtr locator; /* the xmlTextReaderLocatorPtr used */
30038 int n_locator;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030039
Daniel Veillardce682bc2004-11-05 17:22:25 +000030040 for (n_locator = 0;n_locator < gen_nb_xmlTextReaderLocatorPtr;n_locator++) {
30041 mem_base = xmlMemBlocks();
30042 locator = gen_xmlTextReaderLocatorPtr(n_locator, 0);
30043
30044 ret_val = xmlTextReaderLocatorLineNumber(locator);
30045 desret_int(ret_val);
30046 call_tests++;
30047 des_xmlTextReaderLocatorPtr(n_locator, locator, 0);
30048 xmlResetLastError();
30049 if (mem_base != xmlMemBlocks()) {
30050 printf("Leak of %d blocks found in xmlTextReaderLocatorLineNumber",
30051 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030052 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030053 printf(" %d", n_locator);
30054 printf("\n");
30055 }
30056 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030057 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030058#endif
30059
Daniel Veillard42595322004-11-08 10:52:06 +000030060 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030061}
30062
30063
30064static int
30065test_xmlTextReaderLookupNamespace(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030066 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030067
William M. Brack21e4ef22005-01-02 09:53:13 +000030068#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030069 int mem_base;
30070 xmlChar * ret_val;
30071 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30072 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030073 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 +000030074 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030075
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030076 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30077 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
30078 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030079 reader = gen_xmlTextReaderPtr(n_reader, 0);
30080 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030081
William M. Brackf13f77f2004-11-12 16:03:48 +000030082 ret_val = xmlTextReaderLookupNamespace(reader, (const xmlChar *)prefix);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030083 desret_xmlChar_ptr(ret_val);
30084 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030085 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000030086 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030087 xmlResetLastError();
30088 if (mem_base != xmlMemBlocks()) {
30089 printf("Leak of %d blocks found in xmlTextReaderLookupNamespace",
30090 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030091 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030092 printf(" %d", n_reader);
30093 printf(" %d", n_prefix);
30094 printf("\n");
30095 }
30096 }
30097 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030098 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030099#endif
30100
Daniel Veillard42595322004-11-08 10:52:06 +000030101 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030102}
30103
30104
30105static int
30106test_xmlTextReaderMoveToAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030107 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030108
William M. Brack21e4ef22005-01-02 09:53:13 +000030109#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030110 int mem_base;
30111 int ret_val;
30112 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30113 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030114 xmlChar * name; /* the qualified name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030115 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030116
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030117 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30118 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
30119 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030120 reader = gen_xmlTextReaderPtr(n_reader, 0);
30121 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030122
William M. Brackf13f77f2004-11-12 16:03:48 +000030123 ret_val = xmlTextReaderMoveToAttribute(reader, (const xmlChar *)name);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030124 desret_int(ret_val);
30125 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030126 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000030127 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030128 xmlResetLastError();
30129 if (mem_base != xmlMemBlocks()) {
30130 printf("Leak of %d blocks found in xmlTextReaderMoveToAttribute",
30131 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030132 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030133 printf(" %d", n_reader);
30134 printf(" %d", n_name);
30135 printf("\n");
30136 }
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_xmlTextReaderMoveToAttributeNo(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;
30155 int no; /* the zero-based index of the attribute relative to the containing element. */
30156 int n_no;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030157
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030158 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30159 for (n_no = 0;n_no < gen_nb_int;n_no++) {
30160 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030161 reader = gen_xmlTextReaderPtr(n_reader, 0);
30162 no = gen_int(n_no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030163
30164 ret_val = xmlTextReaderMoveToAttributeNo(reader, no);
30165 desret_int(ret_val);
30166 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030167 des_xmlTextReaderPtr(n_reader, reader, 0);
30168 des_int(n_no, no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030169 xmlResetLastError();
30170 if (mem_base != xmlMemBlocks()) {
30171 printf("Leak of %d blocks found in xmlTextReaderMoveToAttributeNo",
30172 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030173 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030174 printf(" %d", n_reader);
30175 printf(" %d", n_no);
30176 printf("\n");
30177 }
30178 }
30179 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030180 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030181#endif
30182
Daniel Veillard42595322004-11-08 10:52:06 +000030183 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030184}
30185
30186
30187static int
30188test_xmlTextReaderMoveToAttributeNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030189 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030190
William M. Brack21e4ef22005-01-02 09:53:13 +000030191#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030192 int mem_base;
30193 int ret_val;
30194 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30195 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030196 xmlChar * localName; /* the local name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030197 int n_localName;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030198 xmlChar * namespaceURI; /* the namespace URI of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030199 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030200
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030201 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30202 for (n_localName = 0;n_localName < gen_nb_const_xmlChar_ptr;n_localName++) {
30203 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
30204 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030205 reader = gen_xmlTextReaderPtr(n_reader, 0);
30206 localName = gen_const_xmlChar_ptr(n_localName, 1);
30207 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030208
William M. Brackf13f77f2004-11-12 16:03:48 +000030209 ret_val = xmlTextReaderMoveToAttributeNs(reader, (const xmlChar *)localName, (const xmlChar *)namespaceURI);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030210 desret_int(ret_val);
30211 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030212 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000030213 des_const_xmlChar_ptr(n_localName, (const xmlChar *)localName, 1);
30214 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030215 xmlResetLastError();
30216 if (mem_base != xmlMemBlocks()) {
30217 printf("Leak of %d blocks found in xmlTextReaderMoveToAttributeNs",
30218 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030219 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030220 printf(" %d", n_reader);
30221 printf(" %d", n_localName);
30222 printf(" %d", n_namespaceURI);
30223 printf("\n");
30224 }
30225 }
30226 }
30227 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030228 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030229#endif
30230
Daniel Veillard42595322004-11-08 10:52:06 +000030231 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030232}
30233
30234
30235static int
30236test_xmlTextReaderMoveToElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030237 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030238
William M. Brack21e4ef22005-01-02 09:53:13 +000030239#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030240 int mem_base;
30241 int ret_val;
30242 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30243 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030244
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030245 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30246 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030247 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030248
30249 ret_val = xmlTextReaderMoveToElement(reader);
30250 desret_int(ret_val);
30251 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030252 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030253 xmlResetLastError();
30254 if (mem_base != xmlMemBlocks()) {
30255 printf("Leak of %d blocks found in xmlTextReaderMoveToElement",
30256 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030257 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030258 printf(" %d", n_reader);
30259 printf("\n");
30260 }
30261 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030262 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030263#endif
30264
Daniel Veillard42595322004-11-08 10:52:06 +000030265 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030266}
30267
30268
30269static int
30270test_xmlTextReaderMoveToFirstAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030271 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030272
William M. Brack21e4ef22005-01-02 09:53:13 +000030273#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030274 int mem_base;
30275 int ret_val;
30276 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30277 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030278
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030279 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30280 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030281 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030282
30283 ret_val = xmlTextReaderMoveToFirstAttribute(reader);
30284 desret_int(ret_val);
30285 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030286 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030287 xmlResetLastError();
30288 if (mem_base != xmlMemBlocks()) {
30289 printf("Leak of %d blocks found in xmlTextReaderMoveToFirstAttribute",
30290 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030291 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030292 printf(" %d", n_reader);
30293 printf("\n");
30294 }
30295 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030296 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030297#endif
30298
Daniel Veillard42595322004-11-08 10:52:06 +000030299 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030300}
30301
30302
30303static int
30304test_xmlTextReaderMoveToNextAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030305 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030306
William M. Brack21e4ef22005-01-02 09:53:13 +000030307#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030308 int mem_base;
30309 int ret_val;
30310 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30311 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030312
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030313 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30314 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030315 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030316
30317 ret_val = xmlTextReaderMoveToNextAttribute(reader);
30318 desret_int(ret_val);
30319 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030320 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030321 xmlResetLastError();
30322 if (mem_base != xmlMemBlocks()) {
30323 printf("Leak of %d blocks found in xmlTextReaderMoveToNextAttribute",
30324 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030325 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030326 printf(" %d", n_reader);
30327 printf("\n");
30328 }
30329 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030330 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030331#endif
30332
Daniel Veillard42595322004-11-08 10:52:06 +000030333 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030334}
30335
30336
30337static int
30338test_xmlTextReaderName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030339 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030340
William M. Brack21e4ef22005-01-02 09:53:13 +000030341#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030342 int mem_base;
30343 xmlChar * ret_val;
30344 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30345 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030346
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030347 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30348 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030349 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030350
30351 ret_val = xmlTextReaderName(reader);
30352 desret_xmlChar_ptr(ret_val);
30353 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030354 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030355 xmlResetLastError();
30356 if (mem_base != xmlMemBlocks()) {
30357 printf("Leak of %d blocks found in xmlTextReaderName",
30358 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030359 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030360 printf(" %d", n_reader);
30361 printf("\n");
30362 }
30363 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030364 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030365#endif
30366
Daniel Veillard42595322004-11-08 10:52:06 +000030367 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030368}
30369
30370
30371static int
30372test_xmlTextReaderNamespaceUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030373 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030374
William M. Brack21e4ef22005-01-02 09:53:13 +000030375#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030376 int mem_base;
30377 xmlChar * ret_val;
30378 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30379 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030380
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030381 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30382 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030383 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030384
30385 ret_val = xmlTextReaderNamespaceUri(reader);
30386 desret_xmlChar_ptr(ret_val);
30387 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030388 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030389 xmlResetLastError();
30390 if (mem_base != xmlMemBlocks()) {
30391 printf("Leak of %d blocks found in xmlTextReaderNamespaceUri",
30392 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030393 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030394 printf(" %d", n_reader);
30395 printf("\n");
30396 }
30397 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030398 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030399#endif
30400
Daniel Veillard42595322004-11-08 10:52:06 +000030401 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030402}
30403
30404
30405static int
30406test_xmlTextReaderNext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030407 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030408
William M. Brack21e4ef22005-01-02 09:53:13 +000030409#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030410 int mem_base;
30411 int ret_val;
30412 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30413 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030414
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030415 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30416 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030417 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030418
30419 ret_val = xmlTextReaderNext(reader);
30420 desret_int(ret_val);
30421 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030422 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030423 xmlResetLastError();
30424 if (mem_base != xmlMemBlocks()) {
30425 printf("Leak of %d blocks found in xmlTextReaderNext",
30426 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030427 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030428 printf(" %d", n_reader);
30429 printf("\n");
30430 }
30431 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030432 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030433#endif
30434
Daniel Veillard42595322004-11-08 10:52:06 +000030435 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030436}
30437
30438
30439static int
30440test_xmlTextReaderNextSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030441 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030442
William M. Brack21e4ef22005-01-02 09:53:13 +000030443#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030444 int mem_base;
30445 int ret_val;
30446 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30447 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030448
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030449 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30450 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030451 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030452
30453 ret_val = xmlTextReaderNextSibling(reader);
30454 desret_int(ret_val);
30455 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030456 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030457 xmlResetLastError();
30458 if (mem_base != xmlMemBlocks()) {
30459 printf("Leak of %d blocks found in xmlTextReaderNextSibling",
30460 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030461 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030462 printf(" %d", n_reader);
30463 printf("\n");
30464 }
30465 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030466 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030467#endif
30468
Daniel Veillard42595322004-11-08 10:52:06 +000030469 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030470}
30471
30472
30473static int
30474test_xmlTextReaderNodeType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030475 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030476
William M. Brack21e4ef22005-01-02 09:53:13 +000030477#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030478 int mem_base;
30479 int ret_val;
30480 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30481 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030482
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030483 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30484 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030485 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030486
30487 ret_val = xmlTextReaderNodeType(reader);
30488 desret_int(ret_val);
30489 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030490 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030491 xmlResetLastError();
30492 if (mem_base != xmlMemBlocks()) {
30493 printf("Leak of %d blocks found in xmlTextReaderNodeType",
30494 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030495 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030496 printf(" %d", n_reader);
30497 printf("\n");
30498 }
30499 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030500 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030501#endif
30502
Daniel Veillard42595322004-11-08 10:52:06 +000030503 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030504}
30505
30506
30507static int
30508test_xmlTextReaderNormalization(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030509 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030510
William M. Brack21e4ef22005-01-02 09:53:13 +000030511#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030512 int mem_base;
30513 int ret_val;
30514 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30515 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030516
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030517 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30518 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030519 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030520
30521 ret_val = xmlTextReaderNormalization(reader);
30522 desret_int(ret_val);
30523 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030524 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030525 xmlResetLastError();
30526 if (mem_base != xmlMemBlocks()) {
30527 printf("Leak of %d blocks found in xmlTextReaderNormalization",
30528 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030529 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030530 printf(" %d", n_reader);
30531 printf("\n");
30532 }
30533 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030534 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030535#endif
30536
Daniel Veillard42595322004-11-08 10:52:06 +000030537 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030538}
30539
30540
30541static int
30542test_xmlTextReaderPrefix(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030543 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030544
William M. Brack21e4ef22005-01-02 09:53:13 +000030545#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030546 int mem_base;
30547 xmlChar * ret_val;
30548 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30549 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030550
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030551 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30552 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030553 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030554
30555 ret_val = xmlTextReaderPrefix(reader);
30556 desret_xmlChar_ptr(ret_val);
30557 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030558 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030559 xmlResetLastError();
30560 if (mem_base != xmlMemBlocks()) {
30561 printf("Leak of %d blocks found in xmlTextReaderPrefix",
30562 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030563 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030564 printf(" %d", n_reader);
30565 printf("\n");
30566 }
30567 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030568 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030569#endif
30570
Daniel Veillard42595322004-11-08 10:52:06 +000030571 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030572}
30573
30574
30575static int
30576test_xmlTextReaderPreserve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030577 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030578
William M. Brack21e4ef22005-01-02 09:53:13 +000030579#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030580 int mem_base;
30581 xmlNodePtr ret_val;
30582 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30583 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030584
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030585 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30586 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030587 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030588
30589 ret_val = xmlTextReaderPreserve(reader);
30590 desret_xmlNodePtr(ret_val);
30591 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030592 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030593 xmlResetLastError();
30594 if (mem_base != xmlMemBlocks()) {
30595 printf("Leak of %d blocks found in xmlTextReaderPreserve",
30596 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030597 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030598 printf(" %d", n_reader);
30599 printf("\n");
30600 }
30601 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030602 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030603#endif
30604
Daniel Veillard42595322004-11-08 10:52:06 +000030605 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030606}
30607
30608
30609static int
30610test_xmlTextReaderPreservePattern(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030611 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030612
William M. Brack21e4ef22005-01-02 09:53:13 +000030613#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_PATTERN_ENABLED)
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030614#ifdef LIBXML_PATTERN_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030615 int mem_base;
30616 int ret_val;
30617 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30618 int n_reader;
30619 xmlChar * pattern; /* an XPath subset pattern */
30620 int n_pattern;
30621 xmlChar ** namespaces; /* the prefix definitions, array of [URI, prefix] or NULL */
30622 int n_namespaces;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030623
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030624 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30625 for (n_pattern = 0;n_pattern < gen_nb_const_xmlChar_ptr;n_pattern++) {
30626 for (n_namespaces = 0;n_namespaces < gen_nb_const_xmlChar_ptr_ptr;n_namespaces++) {
30627 mem_base = xmlMemBlocks();
30628 reader = gen_xmlTextReaderPtr(n_reader, 0);
30629 pattern = gen_const_xmlChar_ptr(n_pattern, 1);
30630 namespaces = gen_const_xmlChar_ptr_ptr(n_namespaces, 2);
30631
William M. Brackf13f77f2004-11-12 16:03:48 +000030632 ret_val = xmlTextReaderPreservePattern(reader, (const xmlChar *)pattern, (const xmlChar **)namespaces);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030633 desret_int(ret_val);
30634 call_tests++;
30635 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000030636 des_const_xmlChar_ptr(n_pattern, (const xmlChar *)pattern, 1);
30637 des_const_xmlChar_ptr_ptr(n_namespaces, (const xmlChar **)namespaces, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030638 xmlResetLastError();
30639 if (mem_base != xmlMemBlocks()) {
30640 printf("Leak of %d blocks found in xmlTextReaderPreservePattern",
30641 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030642 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030643 printf(" %d", n_reader);
30644 printf(" %d", n_pattern);
30645 printf(" %d", n_namespaces);
30646 printf("\n");
30647 }
30648 }
30649 }
30650 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030651 function_tests++;
30652#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030653#endif
30654
Daniel Veillard42595322004-11-08 10:52:06 +000030655 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030656}
30657
30658
30659static int
30660test_xmlTextReaderQuoteChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030661 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030662
William M. Brack21e4ef22005-01-02 09:53:13 +000030663#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030664 int mem_base;
30665 int ret_val;
30666 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30667 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030668
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030669 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30670 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030671 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030672
30673 ret_val = xmlTextReaderQuoteChar(reader);
30674 desret_int(ret_val);
30675 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030676 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030677 xmlResetLastError();
30678 if (mem_base != xmlMemBlocks()) {
30679 printf("Leak of %d blocks found in xmlTextReaderQuoteChar",
30680 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030681 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030682 printf(" %d", n_reader);
30683 printf("\n");
30684 }
30685 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030686 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030687#endif
30688
Daniel Veillard42595322004-11-08 10:52:06 +000030689 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030690}
30691
30692
30693static int
30694test_xmlTextReaderRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030695 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030696
William M. Brack21e4ef22005-01-02 09:53:13 +000030697#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030698 int mem_base;
30699 int ret_val;
30700 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30701 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030702
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030703 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30704 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030705 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030706
30707 ret_val = xmlTextReaderRead(reader);
30708 desret_int(ret_val);
30709 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030710 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030711 xmlResetLastError();
30712 if (mem_base != xmlMemBlocks()) {
30713 printf("Leak of %d blocks found in xmlTextReaderRead",
30714 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030715 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030716 printf(" %d", n_reader);
30717 printf("\n");
30718 }
30719 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030720 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030721#endif
30722
Daniel Veillard42595322004-11-08 10:52:06 +000030723 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030724}
30725
30726
30727static int
30728test_xmlTextReaderReadAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030729 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030730
William M. Brack21e4ef22005-01-02 09:53:13 +000030731#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030732 int mem_base;
30733 int ret_val;
30734 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30735 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030736
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030737 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30738 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030739 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030740
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030741 ret_val = xmlTextReaderReadAttributeValue(reader);
30742 desret_int(ret_val);
30743 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030744 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030745 xmlResetLastError();
30746 if (mem_base != xmlMemBlocks()) {
30747 printf("Leak of %d blocks found in xmlTextReaderReadAttributeValue",
30748 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030749 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030750 printf(" %d", n_reader);
30751 printf("\n");
30752 }
30753 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030754 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030755#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000030756
Daniel Veillard42595322004-11-08 10:52:06 +000030757 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030758}
30759
30760
30761static int
30762test_xmlTextReaderReadState(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030763 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030764
William M. Brack21e4ef22005-01-02 09:53:13 +000030765#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030766 int mem_base;
30767 int ret_val;
30768 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30769 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030770
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030771 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30772 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030773 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030774
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030775 ret_val = xmlTextReaderReadState(reader);
30776 desret_int(ret_val);
30777 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030778 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030779 xmlResetLastError();
30780 if (mem_base != xmlMemBlocks()) {
30781 printf("Leak of %d blocks found in xmlTextReaderReadState",
30782 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030783 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030784 printf(" %d", n_reader);
30785 printf("\n");
30786 }
30787 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030788 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030789#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000030790
Daniel Veillard42595322004-11-08 10:52:06 +000030791 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030792}
30793
30794
30795static int
30796test_xmlTextReaderRelaxNGSetSchema(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030797 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030798
William M. Brack21e4ef22005-01-02 09:53:13 +000030799#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000030800 int mem_base;
30801 int ret_val;
30802 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30803 int n_reader;
30804 xmlRelaxNGPtr schema; /* a precompiled RelaxNG schema */
30805 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030806
Daniel Veillardce682bc2004-11-05 17:22:25 +000030807 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30808 for (n_schema = 0;n_schema < gen_nb_xmlRelaxNGPtr;n_schema++) {
30809 mem_base = xmlMemBlocks();
30810 reader = gen_xmlTextReaderPtr(n_reader, 0);
30811 schema = gen_xmlRelaxNGPtr(n_schema, 1);
30812
30813 ret_val = xmlTextReaderRelaxNGSetSchema(reader, schema);
30814 desret_int(ret_val);
30815 call_tests++;
30816 des_xmlTextReaderPtr(n_reader, reader, 0);
30817 des_xmlRelaxNGPtr(n_schema, schema, 1);
30818 xmlResetLastError();
30819 if (mem_base != xmlMemBlocks()) {
30820 printf("Leak of %d blocks found in xmlTextReaderRelaxNGSetSchema",
30821 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030822 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030823 printf(" %d", n_reader);
30824 printf(" %d", n_schema);
30825 printf("\n");
30826 }
30827 }
30828 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030829 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030830#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000030831
Daniel Veillard42595322004-11-08 10:52:06 +000030832 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030833}
30834
30835
30836static int
30837test_xmlTextReaderRelaxNGValidate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030838 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030839
William M. Brack21e4ef22005-01-02 09:53:13 +000030840#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030841 int mem_base;
30842 int ret_val;
30843 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30844 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030845 char * rng; /* the path to a RelaxNG schema or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030846 int n_rng;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030847
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030848 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30849 for (n_rng = 0;n_rng < gen_nb_const_char_ptr;n_rng++) {
30850 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030851 reader = gen_xmlTextReaderPtr(n_reader, 0);
30852 rng = gen_const_char_ptr(n_rng, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030853
William M. Brackf13f77f2004-11-12 16:03:48 +000030854 ret_val = xmlTextReaderRelaxNGValidate(reader, (const char *)rng);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030855 desret_int(ret_val);
30856 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030857 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000030858 des_const_char_ptr(n_rng, (const char *)rng, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030859 xmlResetLastError();
30860 if (mem_base != xmlMemBlocks()) {
30861 printf("Leak of %d blocks found in xmlTextReaderRelaxNGValidate",
30862 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030863 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030864 printf(" %d", n_reader);
30865 printf(" %d", n_rng);
30866 printf("\n");
30867 }
30868 }
30869 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030870 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030871#endif
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030872
Daniel Veillard42595322004-11-08 10:52:06 +000030873 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030874}
30875
30876
30877static int
30878test_xmlTextReaderSetErrorHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030879 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030880
30881
30882 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000030883 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030884}
30885
30886
30887static int
30888test_xmlTextReaderSetParserProp(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;
30896 int prop; /* the xmlParserProperties to set */
30897 int n_prop;
30898 int value; /* usually 0 or 1 to (de)activate it */
30899 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030900
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030901 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30902 for (n_prop = 0;n_prop < gen_nb_int;n_prop++) {
30903 for (n_value = 0;n_value < gen_nb_int;n_value++) {
30904 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030905 reader = gen_xmlTextReaderPtr(n_reader, 0);
30906 prop = gen_int(n_prop, 1);
30907 value = gen_int(n_value, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030908
30909 ret_val = xmlTextReaderSetParserProp(reader, prop, value);
30910 desret_int(ret_val);
30911 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030912 des_xmlTextReaderPtr(n_reader, reader, 0);
30913 des_int(n_prop, prop, 1);
30914 des_int(n_value, value, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030915 xmlResetLastError();
30916 if (mem_base != xmlMemBlocks()) {
30917 printf("Leak of %d blocks found in xmlTextReaderSetParserProp",
30918 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030919 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030920 printf(" %d", n_reader);
30921 printf(" %d", n_prop);
30922 printf(" %d", n_value);
30923 printf("\n");
30924 }
30925 }
30926 }
30927 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030928 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030929#endif
30930
Daniel Veillard42595322004-11-08 10:52:06 +000030931 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030932}
30933
30934
30935static int
30936test_xmlTextReaderSetStructuredErrorHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030937 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030938
30939
30940 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000030941 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030942}
30943
30944
30945static int
30946test_xmlTextReaderStandalone(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030947 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030948
William M. Brack21e4ef22005-01-02 09:53:13 +000030949#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030950 int mem_base;
30951 int ret_val;
30952 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30953 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030954
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030955 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30956 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030957 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030958
30959 ret_val = xmlTextReaderStandalone(reader);
30960 desret_int(ret_val);
30961 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030962 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030963 xmlResetLastError();
30964 if (mem_base != xmlMemBlocks()) {
30965 printf("Leak of %d blocks found in xmlTextReaderStandalone",
30966 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030967 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030968 printf(" %d", n_reader);
30969 printf("\n");
30970 }
30971 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030972 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030973#endif
30974
Daniel Veillard42595322004-11-08 10:52:06 +000030975 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030976}
30977
30978
30979static int
30980test_xmlTextReaderValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030981 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030982
William M. Brack21e4ef22005-01-02 09:53:13 +000030983#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030984 int mem_base;
30985 xmlChar * ret_val;
30986 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30987 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030988
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030989 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30990 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030991 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030992
30993 ret_val = xmlTextReaderValue(reader);
30994 desret_xmlChar_ptr(ret_val);
30995 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030996 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030997 xmlResetLastError();
30998 if (mem_base != xmlMemBlocks()) {
30999 printf("Leak of %d blocks found in xmlTextReaderValue",
31000 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031001 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031002 printf(" %d", n_reader);
31003 printf("\n");
31004 }
31005 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031006 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031007#endif
31008
Daniel Veillard42595322004-11-08 10:52:06 +000031009 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031010}
31011
31012
31013static int
31014test_xmlTextReaderXmlLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031015 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031016
William M. Brack21e4ef22005-01-02 09:53:13 +000031017#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031018 int mem_base;
31019 xmlChar * ret_val;
31020 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31021 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031022
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031023 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31024 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000031025 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031026
31027 ret_val = xmlTextReaderXmlLang(reader);
31028 desret_xmlChar_ptr(ret_val);
31029 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000031030 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031031 xmlResetLastError();
31032 if (mem_base != xmlMemBlocks()) {
31033 printf("Leak of %d blocks found in xmlTextReaderXmlLang",
31034 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031035 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031036 printf(" %d", n_reader);
31037 printf("\n");
31038 }
31039 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031040 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031041#endif
31042
Daniel Veillard42595322004-11-08 10:52:06 +000031043 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031044}
31045
31046static int
31047test_xmlreader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031048 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031049
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000031050 if (quiet == 0) printf("Testing xmlreader : 70 of 80 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000031051 test_ret += test_xmlNewTextReader();
31052 test_ret += test_xmlNewTextReaderFilename();
31053 test_ret += test_xmlReaderForDoc();
31054 test_ret += test_xmlReaderForFile();
31055 test_ret += test_xmlReaderForMemory();
31056 test_ret += test_xmlReaderNewDoc();
31057 test_ret += test_xmlReaderNewFile();
31058 test_ret += test_xmlReaderNewMemory();
31059 test_ret += test_xmlReaderNewWalker();
31060 test_ret += test_xmlReaderWalker();
31061 test_ret += test_xmlTextReaderAttributeCount();
31062 test_ret += test_xmlTextReaderBaseUri();
31063 test_ret += test_xmlTextReaderClose();
31064 test_ret += test_xmlTextReaderConstBaseUri();
31065 test_ret += test_xmlTextReaderConstEncoding();
31066 test_ret += test_xmlTextReaderConstLocalName();
31067 test_ret += test_xmlTextReaderConstName();
31068 test_ret += test_xmlTextReaderConstNamespaceUri();
31069 test_ret += test_xmlTextReaderConstPrefix();
31070 test_ret += test_xmlTextReaderConstString();
31071 test_ret += test_xmlTextReaderConstValue();
31072 test_ret += test_xmlTextReaderConstXmlLang();
31073 test_ret += test_xmlTextReaderConstXmlVersion();
31074 test_ret += test_xmlTextReaderCurrentDoc();
31075 test_ret += test_xmlTextReaderCurrentNode();
31076 test_ret += test_xmlTextReaderDepth();
31077 test_ret += test_xmlTextReaderExpand();
31078 test_ret += test_xmlTextReaderGetAttribute();
31079 test_ret += test_xmlTextReaderGetAttributeNo();
31080 test_ret += test_xmlTextReaderGetAttributeNs();
31081 test_ret += test_xmlTextReaderGetErrorHandler();
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000031082 test_ret += test_xmlTextReaderGetParserColumnNumber();
31083 test_ret += test_xmlTextReaderGetParserLineNumber();
Daniel Veillard42595322004-11-08 10:52:06 +000031084 test_ret += test_xmlTextReaderGetParserProp();
31085 test_ret += test_xmlTextReaderGetRemainder();
31086 test_ret += test_xmlTextReaderHasAttributes();
31087 test_ret += test_xmlTextReaderHasValue();
31088 test_ret += test_xmlTextReaderIsDefault();
31089 test_ret += test_xmlTextReaderIsEmptyElement();
31090 test_ret += test_xmlTextReaderIsNamespaceDecl();
31091 test_ret += test_xmlTextReaderIsValid();
31092 test_ret += test_xmlTextReaderLocalName();
31093 test_ret += test_xmlTextReaderLocatorBaseURI();
31094 test_ret += test_xmlTextReaderLocatorLineNumber();
31095 test_ret += test_xmlTextReaderLookupNamespace();
31096 test_ret += test_xmlTextReaderMoveToAttribute();
31097 test_ret += test_xmlTextReaderMoveToAttributeNo();
31098 test_ret += test_xmlTextReaderMoveToAttributeNs();
31099 test_ret += test_xmlTextReaderMoveToElement();
31100 test_ret += test_xmlTextReaderMoveToFirstAttribute();
31101 test_ret += test_xmlTextReaderMoveToNextAttribute();
31102 test_ret += test_xmlTextReaderName();
31103 test_ret += test_xmlTextReaderNamespaceUri();
31104 test_ret += test_xmlTextReaderNext();
31105 test_ret += test_xmlTextReaderNextSibling();
31106 test_ret += test_xmlTextReaderNodeType();
31107 test_ret += test_xmlTextReaderNormalization();
31108 test_ret += test_xmlTextReaderPrefix();
31109 test_ret += test_xmlTextReaderPreserve();
31110 test_ret += test_xmlTextReaderPreservePattern();
31111 test_ret += test_xmlTextReaderQuoteChar();
31112 test_ret += test_xmlTextReaderRead();
31113 test_ret += test_xmlTextReaderReadAttributeValue();
31114 test_ret += test_xmlTextReaderReadState();
31115 test_ret += test_xmlTextReaderRelaxNGSetSchema();
31116 test_ret += test_xmlTextReaderRelaxNGValidate();
31117 test_ret += test_xmlTextReaderSetErrorHandler();
31118 test_ret += test_xmlTextReaderSetParserProp();
31119 test_ret += test_xmlTextReaderSetStructuredErrorHandler();
31120 test_ret += test_xmlTextReaderStandalone();
31121 test_ret += test_xmlTextReaderValue();
31122 test_ret += test_xmlTextReaderXmlLang();
Daniel Veillardd93f6252004-11-02 15:53:51 +000031123
Daniel Veillard42595322004-11-08 10:52:06 +000031124 if (test_ret != 0)
31125 printf("Module xmlreader: %d errors\n", test_ret);
31126 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031127}
Daniel Veillarda521d282004-11-09 14:59:59 +000031128#ifdef LIBXML_REGEXP_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000031129
Daniel Veillarda82b1822004-11-08 16:24:57 +000031130#define gen_nb_xmlRegExecCtxtPtr 1
31131static xmlRegExecCtxtPtr gen_xmlRegExecCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31132 return(NULL);
31133}
31134static void des_xmlRegExecCtxtPtr(int no ATTRIBUTE_UNUSED, xmlRegExecCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31135}
Daniel Veillarda521d282004-11-09 14:59:59 +000031136#endif
31137
Daniel Veillarda82b1822004-11-08 16:24:57 +000031138
31139static int
31140test_xmlRegExecPushString(void) {
31141 int test_ret = 0;
31142
William M. Brack21e4ef22005-01-02 09:53:13 +000031143#if defined(LIBXML_REGEXP_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000031144 int mem_base;
31145 int ret_val;
31146 xmlRegExecCtxtPtr exec; /* a regexp execution context or NULL to indicate the end */
31147 int n_exec;
31148 xmlChar * value; /* a string token input */
31149 int n_value;
31150 void * data; /* data associated to the token to reuse in callbacks */
31151 int n_data;
31152
31153 for (n_exec = 0;n_exec < gen_nb_xmlRegExecCtxtPtr;n_exec++) {
31154 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
31155 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
31156 mem_base = xmlMemBlocks();
31157 exec = gen_xmlRegExecCtxtPtr(n_exec, 0);
31158 value = gen_const_xmlChar_ptr(n_value, 1);
31159 data = gen_userdata(n_data, 2);
31160
William M. Brackf13f77f2004-11-12 16:03:48 +000031161 ret_val = xmlRegExecPushString(exec, (const xmlChar *)value, data);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031162 desret_int(ret_val);
31163 call_tests++;
31164 des_xmlRegExecCtxtPtr(n_exec, exec, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000031165 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031166 des_userdata(n_data, data, 2);
31167 xmlResetLastError();
31168 if (mem_base != xmlMemBlocks()) {
31169 printf("Leak of %d blocks found in xmlRegExecPushString",
31170 xmlMemBlocks() - mem_base);
31171 test_ret++;
31172 printf(" %d", n_exec);
31173 printf(" %d", n_value);
31174 printf(" %d", n_data);
31175 printf("\n");
31176 }
31177 }
31178 }
31179 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031180 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031181#endif
31182
Daniel Veillarda82b1822004-11-08 16:24:57 +000031183 return(test_ret);
31184}
31185
31186
31187static int
31188test_xmlRegExecPushString2(void) {
31189 int test_ret = 0;
31190
William M. Brack21e4ef22005-01-02 09:53:13 +000031191#if defined(LIBXML_REGEXP_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000031192 int mem_base;
31193 int ret_val;
31194 xmlRegExecCtxtPtr exec; /* a regexp execution context or NULL to indicate the end */
31195 int n_exec;
31196 xmlChar * value; /* the first string token input */
31197 int n_value;
31198 xmlChar * value2; /* the second string token input */
31199 int n_value2;
31200 void * data; /* data associated to the token to reuse in callbacks */
31201 int n_data;
31202
31203 for (n_exec = 0;n_exec < gen_nb_xmlRegExecCtxtPtr;n_exec++) {
31204 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
31205 for (n_value2 = 0;n_value2 < gen_nb_const_xmlChar_ptr;n_value2++) {
31206 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
31207 mem_base = xmlMemBlocks();
31208 exec = gen_xmlRegExecCtxtPtr(n_exec, 0);
31209 value = gen_const_xmlChar_ptr(n_value, 1);
31210 value2 = gen_const_xmlChar_ptr(n_value2, 2);
31211 data = gen_userdata(n_data, 3);
31212
William M. Brackf13f77f2004-11-12 16:03:48 +000031213 ret_val = xmlRegExecPushString2(exec, (const xmlChar *)value, (const xmlChar *)value2, data);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031214 desret_int(ret_val);
31215 call_tests++;
31216 des_xmlRegExecCtxtPtr(n_exec, exec, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000031217 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
31218 des_const_xmlChar_ptr(n_value2, (const xmlChar *)value2, 2);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031219 des_userdata(n_data, data, 3);
31220 xmlResetLastError();
31221 if (mem_base != xmlMemBlocks()) {
31222 printf("Leak of %d blocks found in xmlRegExecPushString2",
31223 xmlMemBlocks() - mem_base);
31224 test_ret++;
31225 printf(" %d", n_exec);
31226 printf(" %d", n_value);
31227 printf(" %d", n_value2);
31228 printf(" %d", n_data);
31229 printf("\n");
31230 }
31231 }
31232 }
31233 }
31234 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031235 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031236#endif
31237
Daniel Veillarda82b1822004-11-08 16:24:57 +000031238 return(test_ret);
31239}
31240
Daniel Veillarda521d282004-11-09 14:59:59 +000031241#ifdef LIBXML_REGEXP_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +000031242
31243#define gen_nb_xmlRegexpPtr 1
31244static xmlRegexpPtr gen_xmlRegexpPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31245 return(NULL);
31246}
31247static void des_xmlRegexpPtr(int no ATTRIBUTE_UNUSED, xmlRegexpPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31248}
Daniel Veillarda521d282004-11-09 14:59:59 +000031249#endif
31250
Daniel Veillarda82b1822004-11-08 16:24:57 +000031251
31252static int
31253test_xmlRegNewExecCtxt(void) {
31254 int test_ret = 0;
31255
31256
31257 /* missing type support */
31258 return(test_ret);
31259}
31260
31261
31262static int
31263test_xmlRegexpCompile(void) {
31264 int test_ret = 0;
31265
31266
31267 /* missing type support */
31268 return(test_ret);
31269}
31270
31271
31272static int
31273test_xmlRegexpExec(void) {
31274 int test_ret = 0;
31275
William M. Brack21e4ef22005-01-02 09:53:13 +000031276#if defined(LIBXML_REGEXP_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000031277 int mem_base;
31278 int ret_val;
31279 xmlRegexpPtr comp; /* the compiled regular expression */
31280 int n_comp;
31281 xmlChar * content; /* the value to check against the regular expression */
31282 int n_content;
31283
31284 for (n_comp = 0;n_comp < gen_nb_xmlRegexpPtr;n_comp++) {
31285 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
31286 mem_base = xmlMemBlocks();
31287 comp = gen_xmlRegexpPtr(n_comp, 0);
31288 content = gen_const_xmlChar_ptr(n_content, 1);
31289
William M. Brackf13f77f2004-11-12 16:03:48 +000031290 ret_val = xmlRegexpExec(comp, (const xmlChar *)content);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031291 desret_int(ret_val);
31292 call_tests++;
31293 des_xmlRegexpPtr(n_comp, comp, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000031294 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031295 xmlResetLastError();
31296 if (mem_base != xmlMemBlocks()) {
31297 printf("Leak of %d blocks found in xmlRegexpExec",
31298 xmlMemBlocks() - mem_base);
31299 test_ret++;
31300 printf(" %d", n_comp);
31301 printf(" %d", n_content);
31302 printf("\n");
31303 }
31304 }
31305 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031306 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031307#endif
31308
Daniel Veillarda82b1822004-11-08 16:24:57 +000031309 return(test_ret);
31310}
31311
31312
31313static int
31314test_xmlRegexpIsDeterminist(void) {
31315 int test_ret = 0;
31316
William M. Brack21e4ef22005-01-02 09:53:13 +000031317#if defined(LIBXML_REGEXP_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000031318 int mem_base;
31319 int ret_val;
31320 xmlRegexpPtr comp; /* the compiled regular expression */
31321 int n_comp;
31322
31323 for (n_comp = 0;n_comp < gen_nb_xmlRegexpPtr;n_comp++) {
31324 mem_base = xmlMemBlocks();
31325 comp = gen_xmlRegexpPtr(n_comp, 0);
31326
31327 ret_val = xmlRegexpIsDeterminist(comp);
31328 desret_int(ret_val);
31329 call_tests++;
31330 des_xmlRegexpPtr(n_comp, comp, 0);
31331 xmlResetLastError();
31332 if (mem_base != xmlMemBlocks()) {
31333 printf("Leak of %d blocks found in xmlRegexpIsDeterminist",
31334 xmlMemBlocks() - mem_base);
31335 test_ret++;
31336 printf(" %d", n_comp);
31337 printf("\n");
31338 }
31339 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031340 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031341#endif
31342
Daniel Veillarda82b1822004-11-08 16:24:57 +000031343 return(test_ret);
31344}
31345
31346
31347static int
31348test_xmlRegexpPrint(void) {
31349 int test_ret = 0;
31350
William M. Brack21e4ef22005-01-02 09:53:13 +000031351#if defined(LIBXML_REGEXP_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000031352 int mem_base;
31353 FILE * output; /* the file for the output debug */
31354 int n_output;
31355 xmlRegexpPtr regexp; /* the compiled regexp */
31356 int n_regexp;
31357
31358 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
31359 for (n_regexp = 0;n_regexp < gen_nb_xmlRegexpPtr;n_regexp++) {
31360 mem_base = xmlMemBlocks();
31361 output = gen_FILE_ptr(n_output, 0);
31362 regexp = gen_xmlRegexpPtr(n_regexp, 1);
31363
31364 xmlRegexpPrint(output, regexp);
31365 call_tests++;
31366 des_FILE_ptr(n_output, output, 0);
31367 des_xmlRegexpPtr(n_regexp, regexp, 1);
31368 xmlResetLastError();
31369 if (mem_base != xmlMemBlocks()) {
31370 printf("Leak of %d blocks found in xmlRegexpPrint",
31371 xmlMemBlocks() - mem_base);
31372 test_ret++;
31373 printf(" %d", n_output);
31374 printf(" %d", n_regexp);
31375 printf("\n");
31376 }
31377 }
31378 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031379 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031380#endif
31381
Daniel Veillarda82b1822004-11-08 16:24:57 +000031382 return(test_ret);
31383}
31384
31385static int
31386test_xmlregexp(void) {
31387 int test_ret = 0;
31388
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031389 if (quiet == 0) printf("Testing xmlregexp : 5 of 9 functions ...\n");
Daniel Veillarda82b1822004-11-08 16:24:57 +000031390 test_ret += test_xmlRegExecPushString();
31391 test_ret += test_xmlRegExecPushString2();
31392 test_ret += test_xmlRegNewExecCtxt();
31393 test_ret += test_xmlRegexpCompile();
31394 test_ret += test_xmlRegexpExec();
31395 test_ret += test_xmlRegexpIsDeterminist();
31396 test_ret += test_xmlRegexpPrint();
31397
31398 if (test_ret != 0)
31399 printf("Module xmlregexp: %d errors\n", test_ret);
31400 return(test_ret);
31401}
Daniel Veillarda521d282004-11-09 14:59:59 +000031402#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +000031403
Daniel Veillardce682bc2004-11-05 17:22:25 +000031404#define gen_nb_xmlSaveCtxtPtr 1
31405static xmlSaveCtxtPtr gen_xmlSaveCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31406 return(NULL);
31407}
31408static void des_xmlSaveCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSaveCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31409}
Daniel Veillarda521d282004-11-09 14:59:59 +000031410#endif
31411
Daniel Veillardce682bc2004-11-05 17:22:25 +000031412
Daniel Veillardd93f6252004-11-02 15:53:51 +000031413static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000031414test_xmlSaveClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031415 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031416
William M. Brack21e4ef22005-01-02 09:53:13 +000031417#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000031418 int mem_base;
31419 int ret_val;
31420 xmlSaveCtxtPtr ctxt; /* a document saving context */
31421 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031422
Daniel Veillardce682bc2004-11-05 17:22:25 +000031423 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
31424 mem_base = xmlMemBlocks();
31425 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
31426
31427 ret_val = xmlSaveClose(ctxt);
31428 desret_int(ret_val);
31429 call_tests++;
31430 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
31431 xmlResetLastError();
31432 if (mem_base != xmlMemBlocks()) {
31433 printf("Leak of %d blocks found in xmlSaveClose",
31434 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031435 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031436 printf(" %d", n_ctxt);
31437 printf("\n");
31438 }
31439 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031440 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031441#endif
31442
Daniel Veillard42595322004-11-08 10:52:06 +000031443 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031444}
31445
31446
31447static int
31448test_xmlSaveDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031449 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031450
William M. Brack21e4ef22005-01-02 09:53:13 +000031451#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000031452 int mem_base;
31453 long ret_val;
31454 xmlSaveCtxtPtr ctxt; /* a document saving context */
31455 int n_ctxt;
31456 xmlDocPtr doc; /* a document */
31457 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031458
Daniel Veillardce682bc2004-11-05 17:22:25 +000031459 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
31460 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
31461 mem_base = xmlMemBlocks();
31462 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
31463 doc = gen_xmlDocPtr(n_doc, 1);
31464
31465 ret_val = xmlSaveDoc(ctxt, doc);
31466 desret_long(ret_val);
31467 call_tests++;
31468 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
31469 des_xmlDocPtr(n_doc, doc, 1);
31470 xmlResetLastError();
31471 if (mem_base != xmlMemBlocks()) {
31472 printf("Leak of %d blocks found in xmlSaveDoc",
31473 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031474 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031475 printf(" %d", n_ctxt);
31476 printf(" %d", n_doc);
31477 printf("\n");
31478 }
31479 }
31480 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031481 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031482#endif
31483
Daniel Veillard42595322004-11-08 10:52:06 +000031484 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031485}
31486
31487
31488static int
31489test_xmlSaveFlush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031490 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031491
William M. Brack21e4ef22005-01-02 09:53:13 +000031492#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000031493 int mem_base;
31494 int ret_val;
31495 xmlSaveCtxtPtr ctxt; /* a document saving context */
31496 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031497
Daniel Veillardce682bc2004-11-05 17:22:25 +000031498 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
31499 mem_base = xmlMemBlocks();
31500 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
31501
31502 ret_val = xmlSaveFlush(ctxt);
31503 desret_int(ret_val);
31504 call_tests++;
31505 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
31506 xmlResetLastError();
31507 if (mem_base != xmlMemBlocks()) {
31508 printf("Leak of %d blocks found in xmlSaveFlush",
31509 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031510 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031511 printf(" %d", n_ctxt);
31512 printf("\n");
31513 }
31514 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031515 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031516#endif
31517
Daniel Veillard42595322004-11-08 10:52:06 +000031518 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031519}
31520
31521
31522static int
31523test_xmlSaveSetAttrEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031524 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031525
31526
31527 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031528 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031529}
31530
31531
31532static int
31533test_xmlSaveSetEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031534 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031535
31536
31537 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031538 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031539}
31540
31541
31542static int
31543test_xmlSaveToFd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031544 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031545
31546
31547 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031548 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031549}
31550
31551
31552static int
31553test_xmlSaveToFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031554 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031555
31556
31557 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031558 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031559}
31560
31561
31562static int
31563test_xmlSaveTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031564 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031565
William M. Brack21e4ef22005-01-02 09:53:13 +000031566#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000031567 int mem_base;
31568 long ret_val;
31569 xmlSaveCtxtPtr ctxt; /* a document saving context */
31570 int n_ctxt;
31571 xmlNodePtr node; /* a document */
31572 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031573
Daniel Veillardce682bc2004-11-05 17:22:25 +000031574 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
31575 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
31576 mem_base = xmlMemBlocks();
31577 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
31578 node = gen_xmlNodePtr(n_node, 1);
31579
31580 ret_val = xmlSaveTree(ctxt, node);
31581 desret_long(ret_val);
31582 call_tests++;
31583 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
31584 des_xmlNodePtr(n_node, node, 1);
31585 xmlResetLastError();
31586 if (mem_base != xmlMemBlocks()) {
31587 printf("Leak of %d blocks found in xmlSaveTree",
31588 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031589 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031590 printf(" %d", n_ctxt);
31591 printf(" %d", n_node);
31592 printf("\n");
31593 }
31594 }
31595 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031596 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031597#endif
31598
Daniel Veillard42595322004-11-08 10:52:06 +000031599 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031600}
31601
31602static int
31603test_xmlsave(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031604 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031605
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031606 if (quiet == 0) printf("Testing xmlsave : 4 of 9 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000031607 test_ret += test_xmlSaveClose();
31608 test_ret += test_xmlSaveDoc();
31609 test_ret += test_xmlSaveFlush();
31610 test_ret += test_xmlSaveSetAttrEscape();
31611 test_ret += test_xmlSaveSetEscape();
31612 test_ret += test_xmlSaveToFd();
31613 test_ret += test_xmlSaveToFilename();
31614 test_ret += test_xmlSaveTree();
Daniel Veillardd93f6252004-11-02 15:53:51 +000031615
Daniel Veillard42595322004-11-08 10:52:06 +000031616 if (test_ret != 0)
31617 printf("Module xmlsave: %d errors\n", test_ret);
31618 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031619}
Daniel Veillarda521d282004-11-09 14:59:59 +000031620#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000031621
Daniel Veillardce682bc2004-11-05 17:22:25 +000031622#define gen_nb_xmlSchemaPtr 1
31623static xmlSchemaPtr gen_xmlSchemaPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31624 return(NULL);
31625}
31626static void des_xmlSchemaPtr(int no ATTRIBUTE_UNUSED, xmlSchemaPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31627}
Daniel Veillarda521d282004-11-09 14:59:59 +000031628#endif
31629
Daniel Veillardce682bc2004-11-05 17:22:25 +000031630
Daniel Veillardd93f6252004-11-02 15:53:51 +000031631static int
31632test_xmlSchemaDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031633 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031634
William M. Brack21e4ef22005-01-02 09:53:13 +000031635#if defined(LIBXML_SCHEMAS_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000031636 int mem_base;
31637 FILE * output; /* the file output */
31638 int n_output;
31639 xmlSchemaPtr schema; /* a schema structure */
31640 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031641
Daniel Veillardce682bc2004-11-05 17:22:25 +000031642 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
31643 for (n_schema = 0;n_schema < gen_nb_xmlSchemaPtr;n_schema++) {
31644 mem_base = xmlMemBlocks();
31645 output = gen_FILE_ptr(n_output, 0);
31646 schema = gen_xmlSchemaPtr(n_schema, 1);
31647
31648 xmlSchemaDump(output, schema);
31649 call_tests++;
31650 des_FILE_ptr(n_output, output, 0);
31651 des_xmlSchemaPtr(n_schema, schema, 1);
31652 xmlResetLastError();
31653 if (mem_base != xmlMemBlocks()) {
31654 printf("Leak of %d blocks found in xmlSchemaDump",
31655 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031656 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031657 printf(" %d", n_output);
31658 printf(" %d", n_schema);
31659 printf("\n");
31660 }
31661 }
31662 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031663 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031664#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000031665
Daniel Veillard42595322004-11-08 10:52:06 +000031666 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031667}
31668
Daniel Veillarda521d282004-11-09 14:59:59 +000031669#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000031670
Daniel Veillardce682bc2004-11-05 17:22:25 +000031671#define gen_nb_xmlSchemaParserCtxtPtr 1
31672static xmlSchemaParserCtxtPtr gen_xmlSchemaParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31673 return(NULL);
31674}
31675static void des_xmlSchemaParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSchemaParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31676}
Daniel Veillarda521d282004-11-09 14:59:59 +000031677#endif
31678
31679#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000031680
31681#define gen_nb_xmlSchemaValidityErrorFunc_ptr 1
31682static xmlSchemaValidityErrorFunc * gen_xmlSchemaValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31683 return(NULL);
31684}
31685static void des_xmlSchemaValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlSchemaValidityErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31686}
Daniel Veillarda521d282004-11-09 14:59:59 +000031687#endif
31688
31689#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000031690
31691#define gen_nb_xmlSchemaValidityWarningFunc_ptr 1
31692static xmlSchemaValidityWarningFunc * gen_xmlSchemaValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31693 return(NULL);
31694}
31695static void des_xmlSchemaValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, xmlSchemaValidityWarningFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31696}
Daniel Veillarda521d282004-11-09 14:59:59 +000031697#endif
31698
Daniel Veillardce682bc2004-11-05 17:22:25 +000031699
Daniel Veillardd93f6252004-11-02 15:53:51 +000031700static int
31701test_xmlSchemaGetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031702 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031703
William M. Brack21e4ef22005-01-02 09:53:13 +000031704#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031705 int mem_base;
31706 int ret_val;
31707 xmlSchemaParserCtxtPtr ctxt; /* a XMl-Schema parser context */
31708 int n_ctxt;
31709 xmlSchemaValidityErrorFunc * err; /* the error callback result */
31710 int n_err;
31711 xmlSchemaValidityWarningFunc * warn; /* the warning callback result */
31712 int n_warn;
31713 void ** ctx; /* contextual data for the callbacks result */
31714 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031715
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031716 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaParserCtxtPtr;n_ctxt++) {
31717 for (n_err = 0;n_err < gen_nb_xmlSchemaValidityErrorFunc_ptr;n_err++) {
31718 for (n_warn = 0;n_warn < gen_nb_xmlSchemaValidityWarningFunc_ptr;n_warn++) {
31719 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
31720 mem_base = xmlMemBlocks();
31721 ctxt = gen_xmlSchemaParserCtxtPtr(n_ctxt, 0);
31722 err = gen_xmlSchemaValidityErrorFunc_ptr(n_err, 1);
31723 warn = gen_xmlSchemaValidityWarningFunc_ptr(n_warn, 2);
31724 ctx = gen_void_ptr_ptr(n_ctx, 3);
31725
31726 ret_val = xmlSchemaGetParserErrors(ctxt, err, warn, ctx);
31727 desret_int(ret_val);
31728 call_tests++;
31729 des_xmlSchemaParserCtxtPtr(n_ctxt, ctxt, 0);
31730 des_xmlSchemaValidityErrorFunc_ptr(n_err, err, 1);
31731 des_xmlSchemaValidityWarningFunc_ptr(n_warn, warn, 2);
31732 des_void_ptr_ptr(n_ctx, ctx, 3);
31733 xmlResetLastError();
31734 if (mem_base != xmlMemBlocks()) {
31735 printf("Leak of %d blocks found in xmlSchemaGetParserErrors",
31736 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031737 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031738 printf(" %d", n_ctxt);
31739 printf(" %d", n_err);
31740 printf(" %d", n_warn);
31741 printf(" %d", n_ctx);
31742 printf("\n");
31743 }
31744 }
31745 }
31746 }
31747 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031748 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031749#endif
31750
Daniel Veillard42595322004-11-08 10:52:06 +000031751 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031752}
31753
Daniel Veillarda521d282004-11-09 14:59:59 +000031754#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000031755
Daniel Veillardce682bc2004-11-05 17:22:25 +000031756#define gen_nb_xmlSchemaValidCtxtPtr 1
31757static xmlSchemaValidCtxtPtr gen_xmlSchemaValidCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31758 return(NULL);
31759}
31760static void des_xmlSchemaValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSchemaValidCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31761}
Daniel Veillarda521d282004-11-09 14:59:59 +000031762#endif
31763
Daniel Veillardce682bc2004-11-05 17:22:25 +000031764
Daniel Veillardd93f6252004-11-02 15:53:51 +000031765static int
31766test_xmlSchemaGetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031767 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031768
William M. Brack21e4ef22005-01-02 09:53:13 +000031769#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031770 int mem_base;
31771 int ret_val;
31772 xmlSchemaValidCtxtPtr ctxt; /* a XML-Schema validation context */
31773 int n_ctxt;
31774 xmlSchemaValidityErrorFunc * err; /* the error function result */
31775 int n_err;
31776 xmlSchemaValidityWarningFunc * warn; /* the warning function result */
31777 int n_warn;
31778 void ** ctx; /* the functions context result */
31779 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031780
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031781 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
31782 for (n_err = 0;n_err < gen_nb_xmlSchemaValidityErrorFunc_ptr;n_err++) {
31783 for (n_warn = 0;n_warn < gen_nb_xmlSchemaValidityWarningFunc_ptr;n_warn++) {
31784 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
31785 mem_base = xmlMemBlocks();
31786 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
31787 err = gen_xmlSchemaValidityErrorFunc_ptr(n_err, 1);
31788 warn = gen_xmlSchemaValidityWarningFunc_ptr(n_warn, 2);
31789 ctx = gen_void_ptr_ptr(n_ctx, 3);
31790
31791 ret_val = xmlSchemaGetValidErrors(ctxt, err, warn, ctx);
31792 desret_int(ret_val);
31793 call_tests++;
31794 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
31795 des_xmlSchemaValidityErrorFunc_ptr(n_err, err, 1);
31796 des_xmlSchemaValidityWarningFunc_ptr(n_warn, warn, 2);
31797 des_void_ptr_ptr(n_ctx, ctx, 3);
31798 xmlResetLastError();
31799 if (mem_base != xmlMemBlocks()) {
31800 printf("Leak of %d blocks found in xmlSchemaGetValidErrors",
31801 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031802 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031803 printf(" %d", n_ctxt);
31804 printf(" %d", n_err);
31805 printf(" %d", n_warn);
31806 printf(" %d", n_ctx);
31807 printf("\n");
31808 }
31809 }
31810 }
31811 }
31812 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031813 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031814#endif
31815
Daniel Veillard42595322004-11-08 10:52:06 +000031816 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031817}
31818
31819
31820static int
31821test_xmlSchemaNewDocParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031822 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031823
William M. Brack21e4ef22005-01-02 09:53:13 +000031824#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000031825 int mem_base;
31826 xmlSchemaParserCtxtPtr ret_val;
31827 xmlDocPtr doc; /* a preparsed document tree */
31828 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031829
Daniel Veillard42595322004-11-08 10:52:06 +000031830 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
31831 mem_base = xmlMemBlocks();
31832 doc = gen_xmlDocPtr(n_doc, 0);
31833
31834 ret_val = xmlSchemaNewDocParserCtxt(doc);
31835 desret_xmlSchemaParserCtxtPtr(ret_val);
31836 call_tests++;
31837 des_xmlDocPtr(n_doc, doc, 0);
31838 xmlResetLastError();
31839 if (mem_base != xmlMemBlocks()) {
31840 printf("Leak of %d blocks found in xmlSchemaNewDocParserCtxt",
31841 xmlMemBlocks() - mem_base);
31842 test_ret++;
31843 printf(" %d", n_doc);
31844 printf("\n");
31845 }
31846 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031847 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031848#endif
31849
Daniel Veillard42595322004-11-08 10:52:06 +000031850 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031851}
31852
31853
31854static int
31855test_xmlSchemaNewMemParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031856 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031857
William M. Brack21e4ef22005-01-02 09:53:13 +000031858#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000031859 int mem_base;
31860 xmlSchemaParserCtxtPtr ret_val;
31861 char * buffer; /* a pointer to a char array containing the schemas */
31862 int n_buffer;
31863 int size; /* the size of the array */
31864 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031865
Daniel Veillard42595322004-11-08 10:52:06 +000031866 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
31867 for (n_size = 0;n_size < gen_nb_int;n_size++) {
31868 mem_base = xmlMemBlocks();
31869 buffer = gen_const_char_ptr(n_buffer, 0);
31870 size = gen_int(n_size, 1);
31871
William M. Brackf13f77f2004-11-12 16:03:48 +000031872 ret_val = xmlSchemaNewMemParserCtxt((const char *)buffer, size);
Daniel Veillard42595322004-11-08 10:52:06 +000031873 desret_xmlSchemaParserCtxtPtr(ret_val);
31874 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000031875 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard42595322004-11-08 10:52:06 +000031876 des_int(n_size, size, 1);
31877 xmlResetLastError();
31878 if (mem_base != xmlMemBlocks()) {
31879 printf("Leak of %d blocks found in xmlSchemaNewMemParserCtxt",
31880 xmlMemBlocks() - mem_base);
31881 test_ret++;
31882 printf(" %d", n_buffer);
31883 printf(" %d", n_size);
31884 printf("\n");
31885 }
31886 }
31887 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031888 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031889#endif
31890
Daniel Veillard42595322004-11-08 10:52:06 +000031891 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031892}
31893
31894
31895static int
31896test_xmlSchemaNewParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031897 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031898
William M. Brack21e4ef22005-01-02 09:53:13 +000031899#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000031900 int mem_base;
31901 xmlSchemaParserCtxtPtr ret_val;
31902 char * URL; /* the location of the schema */
31903 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031904
Daniel Veillard42595322004-11-08 10:52:06 +000031905 for (n_URL = 0;n_URL < gen_nb_const_char_ptr;n_URL++) {
31906 mem_base = xmlMemBlocks();
31907 URL = gen_const_char_ptr(n_URL, 0);
31908
William M. Brackf13f77f2004-11-12 16:03:48 +000031909 ret_val = xmlSchemaNewParserCtxt((const char *)URL);
Daniel Veillard42595322004-11-08 10:52:06 +000031910 desret_xmlSchemaParserCtxtPtr(ret_val);
31911 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000031912 des_const_char_ptr(n_URL, (const char *)URL, 0);
Daniel Veillard42595322004-11-08 10:52:06 +000031913 xmlResetLastError();
31914 if (mem_base != xmlMemBlocks()) {
31915 printf("Leak of %d blocks found in xmlSchemaNewParserCtxt",
31916 xmlMemBlocks() - mem_base);
31917 test_ret++;
31918 printf(" %d", n_URL);
31919 printf("\n");
31920 }
31921 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031922 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031923#endif
31924
Daniel Veillard42595322004-11-08 10:52:06 +000031925 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031926}
31927
31928
31929static int
31930test_xmlSchemaNewValidCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031931 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031932
31933
31934 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031935 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031936}
31937
31938
31939static int
31940test_xmlSchemaParse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031941 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031942
31943
31944 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031945 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031946}
31947
31948
31949static int
31950test_xmlSchemaSetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031951 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031952
31953
31954 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031955 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031956}
31957
31958
31959static int
31960test_xmlSchemaSetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031961 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031962
31963
31964 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031965 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031966}
31967
31968
31969static int
31970test_xmlSchemaSetValidOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031971 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031972
William M. Brack21e4ef22005-01-02 09:53:13 +000031973#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000031974 int mem_base;
31975 int ret_val;
31976 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
31977 int n_ctxt;
31978 int options; /* a combination of xmlSchemaValidOption */
31979 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031980
Daniel Veillardce682bc2004-11-05 17:22:25 +000031981 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
31982 for (n_options = 0;n_options < gen_nb_int;n_options++) {
31983 mem_base = xmlMemBlocks();
31984 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
31985 options = gen_int(n_options, 1);
31986
31987 ret_val = xmlSchemaSetValidOptions(ctxt, options);
31988 desret_int(ret_val);
31989 call_tests++;
31990 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
31991 des_int(n_options, options, 1);
31992 xmlResetLastError();
31993 if (mem_base != xmlMemBlocks()) {
31994 printf("Leak of %d blocks found in xmlSchemaSetValidOptions",
31995 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031996 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031997 printf(" %d", n_ctxt);
31998 printf(" %d", n_options);
31999 printf("\n");
32000 }
32001 }
32002 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032003 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032004#endif
32005
Daniel Veillard42595322004-11-08 10:52:06 +000032006 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032007}
32008
32009
32010static int
32011test_xmlSchemaValidCtxtGetOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032012 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032013
William M. Brack21e4ef22005-01-02 09:53:13 +000032014#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032015 int mem_base;
32016 int ret_val;
32017 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
32018 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032019
Daniel Veillardce682bc2004-11-05 17:22:25 +000032020 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
32021 mem_base = xmlMemBlocks();
32022 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
32023
32024 ret_val = xmlSchemaValidCtxtGetOptions(ctxt);
32025 desret_int(ret_val);
32026 call_tests++;
32027 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
32028 xmlResetLastError();
32029 if (mem_base != xmlMemBlocks()) {
32030 printf("Leak of %d blocks found in xmlSchemaValidCtxtGetOptions",
32031 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032032 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032033 printf(" %d", n_ctxt);
32034 printf("\n");
32035 }
32036 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032037 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032038#endif
32039
Daniel Veillard42595322004-11-08 10:52:06 +000032040 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032041}
32042
32043
32044static int
32045test_xmlSchemaValidateDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032046 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032047
William M. Brack21e4ef22005-01-02 09:53:13 +000032048#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032049 int mem_base;
32050 int ret_val;
32051 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
32052 int n_ctxt;
32053 xmlDocPtr doc; /* a parsed document tree */
32054 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032055
Daniel Veillardce682bc2004-11-05 17:22:25 +000032056 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
32057 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
32058 mem_base = xmlMemBlocks();
32059 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
32060 doc = gen_xmlDocPtr(n_doc, 1);
32061
32062 ret_val = xmlSchemaValidateDoc(ctxt, doc);
32063 desret_int(ret_val);
32064 call_tests++;
32065 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
32066 des_xmlDocPtr(n_doc, doc, 1);
32067 xmlResetLastError();
32068 if (mem_base != xmlMemBlocks()) {
32069 printf("Leak of %d blocks found in xmlSchemaValidateDoc",
32070 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032071 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032072 printf(" %d", n_ctxt);
32073 printf(" %d", n_doc);
32074 printf("\n");
32075 }
32076 }
32077 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032078 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032079#endif
32080
Daniel Veillard42595322004-11-08 10:52:06 +000032081 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032082}
32083
32084
32085static int
32086test_xmlSchemaValidateOneElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032087 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032088
William M. Brack21e4ef22005-01-02 09:53:13 +000032089#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032090 int mem_base;
32091 int ret_val;
32092 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
32093 int n_ctxt;
32094 xmlNodePtr elem; /* an element node */
32095 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032096
Daniel Veillardce682bc2004-11-05 17:22:25 +000032097 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
32098 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
32099 mem_base = xmlMemBlocks();
32100 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
32101 elem = gen_xmlNodePtr(n_elem, 1);
32102
32103 ret_val = xmlSchemaValidateOneElement(ctxt, elem);
32104 desret_int(ret_val);
32105 call_tests++;
32106 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
32107 des_xmlNodePtr(n_elem, elem, 1);
32108 xmlResetLastError();
32109 if (mem_base != xmlMemBlocks()) {
32110 printf("Leak of %d blocks found in xmlSchemaValidateOneElement",
32111 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032112 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032113 printf(" %d", n_ctxt);
32114 printf(" %d", n_elem);
32115 printf("\n");
32116 }
32117 }
32118 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032119 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032120#endif
32121
Daniel Veillard42595322004-11-08 10:52:06 +000032122 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032123}
32124
32125
32126static int
32127test_xmlSchemaValidateStream(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 Veillardce682bc2004-11-05 17:22:25 +000032131 int mem_base;
32132 int ret_val;
32133 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
32134 int n_ctxt;
32135 xmlParserInputBufferPtr input; /* the input to use for reading the data */
32136 int n_input;
32137 xmlCharEncoding enc; /* an optional encoding information */
32138 int n_enc;
32139 xmlSAXHandlerPtr sax; /* a SAX handler for the resulting events */
32140 int n_sax;
32141 void * user_data; /* the context to provide to the SAX handler. */
32142 int n_user_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032143
Daniel Veillardce682bc2004-11-05 17:22:25 +000032144 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
32145 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
32146 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
32147 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
32148 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
32149 mem_base = xmlMemBlocks();
32150 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
32151 input = gen_xmlParserInputBufferPtr(n_input, 1);
32152 enc = gen_xmlCharEncoding(n_enc, 2);
32153 sax = gen_xmlSAXHandlerPtr(n_sax, 3);
32154 user_data = gen_userdata(n_user_data, 4);
32155
32156 ret_val = xmlSchemaValidateStream(ctxt, input, enc, sax, user_data);
32157 desret_int(ret_val);
32158 call_tests++;
32159 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
32160 des_xmlParserInputBufferPtr(n_input, input, 1);
32161 des_xmlCharEncoding(n_enc, enc, 2);
32162 des_xmlSAXHandlerPtr(n_sax, sax, 3);
32163 des_userdata(n_user_data, user_data, 4);
32164 xmlResetLastError();
32165 if (mem_base != xmlMemBlocks()) {
32166 printf("Leak of %d blocks found in xmlSchemaValidateStream",
32167 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032168 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032169 printf(" %d", n_ctxt);
32170 printf(" %d", n_input);
32171 printf(" %d", n_enc);
32172 printf(" %d", n_sax);
32173 printf(" %d", n_user_data);
32174 printf("\n");
32175 }
32176 }
32177 }
32178 }
32179 }
32180 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032181 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032182#endif
32183
Daniel Veillard42595322004-11-08 10:52:06 +000032184 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032185}
32186
32187static int
32188test_xmlschemas(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032189 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032190
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032191 if (quiet == 0) printf("Testing xmlschemas : 11 of 18 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000032192 test_ret += test_xmlSchemaDump();
32193 test_ret += test_xmlSchemaGetParserErrors();
32194 test_ret += test_xmlSchemaGetValidErrors();
32195 test_ret += test_xmlSchemaNewDocParserCtxt();
32196 test_ret += test_xmlSchemaNewMemParserCtxt();
32197 test_ret += test_xmlSchemaNewParserCtxt();
32198 test_ret += test_xmlSchemaNewValidCtxt();
32199 test_ret += test_xmlSchemaParse();
32200 test_ret += test_xmlSchemaSetParserErrors();
32201 test_ret += test_xmlSchemaSetValidErrors();
32202 test_ret += test_xmlSchemaSetValidOptions();
32203 test_ret += test_xmlSchemaValidCtxtGetOptions();
32204 test_ret += test_xmlSchemaValidateDoc();
32205 test_ret += test_xmlSchemaValidateOneElement();
32206 test_ret += test_xmlSchemaValidateStream();
Daniel Veillardd93f6252004-11-02 15:53:51 +000032207
Daniel Veillard42595322004-11-08 10:52:06 +000032208 if (test_ret != 0)
32209 printf("Module xmlschemas: %d errors\n", test_ret);
32210 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032211}
Daniel Veillarda521d282004-11-09 14:59:59 +000032212#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000032213
Daniel Veillardce682bc2004-11-05 17:22:25 +000032214#define gen_nb_xmlSchemaFacetPtr 1
32215static xmlSchemaFacetPtr gen_xmlSchemaFacetPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32216 return(NULL);
32217}
32218static void des_xmlSchemaFacetPtr(int no ATTRIBUTE_UNUSED, xmlSchemaFacetPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32219}
Daniel Veillarda521d282004-11-09 14:59:59 +000032220#endif
32221
32222#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000032223
32224#define gen_nb_xmlSchemaTypePtr 1
32225static xmlSchemaTypePtr gen_xmlSchemaTypePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32226 return(NULL);
32227}
32228static void des_xmlSchemaTypePtr(int no ATTRIBUTE_UNUSED, xmlSchemaTypePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32229}
Daniel Veillarda521d282004-11-09 14:59:59 +000032230#endif
32231
Daniel Veillardce682bc2004-11-05 17:22:25 +000032232
Daniel Veillardd93f6252004-11-02 15:53:51 +000032233static int
32234test_xmlSchemaCheckFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032235 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032236
William M. Brack21e4ef22005-01-02 09:53:13 +000032237#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032238 int mem_base;
32239 int ret_val;
32240 xmlSchemaFacetPtr facet; /* the facet */
32241 int n_facet;
32242 xmlSchemaTypePtr typeDecl; /* the schema type definition */
32243 int n_typeDecl;
32244 xmlSchemaParserCtxtPtr ctxt; /* the schema parser context or NULL */
32245 int n_ctxt;
32246 xmlChar * name; /* name of the type */
32247 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032248
Daniel Veillardce682bc2004-11-05 17:22:25 +000032249 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
32250 for (n_typeDecl = 0;n_typeDecl < gen_nb_xmlSchemaTypePtr;n_typeDecl++) {
32251 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaParserCtxtPtr;n_ctxt++) {
32252 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
32253 mem_base = xmlMemBlocks();
32254 facet = gen_xmlSchemaFacetPtr(n_facet, 0);
32255 typeDecl = gen_xmlSchemaTypePtr(n_typeDecl, 1);
32256 ctxt = gen_xmlSchemaParserCtxtPtr(n_ctxt, 2);
32257 name = gen_const_xmlChar_ptr(n_name, 3);
32258
William M. Brackf13f77f2004-11-12 16:03:48 +000032259 ret_val = xmlSchemaCheckFacet(facet, typeDecl, ctxt, (const xmlChar *)name);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032260 desret_int(ret_val);
32261 call_tests++;
32262 des_xmlSchemaFacetPtr(n_facet, facet, 0);
32263 des_xmlSchemaTypePtr(n_typeDecl, typeDecl, 1);
32264 des_xmlSchemaParserCtxtPtr(n_ctxt, ctxt, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000032265 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 3);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032266 xmlResetLastError();
32267 if (mem_base != xmlMemBlocks()) {
32268 printf("Leak of %d blocks found in xmlSchemaCheckFacet",
32269 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032270 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032271 printf(" %d", n_facet);
32272 printf(" %d", n_typeDecl);
32273 printf(" %d", n_ctxt);
32274 printf(" %d", n_name);
32275 printf("\n");
32276 }
32277 }
32278 }
32279 }
32280 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032281 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032282#endif
32283
Daniel Veillard42595322004-11-08 10:52:06 +000032284 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032285}
32286
32287
32288static int
32289test_xmlSchemaCleanupTypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032290 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032291
William M. Brack21e4ef22005-01-02 09:53:13 +000032292#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000032293 int mem_base;
32294
32295 mem_base = xmlMemBlocks();
32296
32297 xmlSchemaCleanupTypes();
32298 call_tests++;
32299 xmlResetLastError();
32300 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000032301 printf("Leak of %d blocks found in xmlSchemaCleanupTypes",
Daniel Veillardd93f6252004-11-02 15:53:51 +000032302 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032303 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000032304 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000032305 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032306 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032307#endif
32308
Daniel Veillard42595322004-11-08 10:52:06 +000032309 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032310}
32311
32312
32313static int
32314test_xmlSchemaCollapseString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032315 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032316
William M. Brack21e4ef22005-01-02 09:53:13 +000032317#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032318 int mem_base;
32319 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032320 xmlChar * value; /* a value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032321 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032322
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032323 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32324 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000032325 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032326
William M. Brackf13f77f2004-11-12 16:03:48 +000032327 ret_val = xmlSchemaCollapseString((const xmlChar *)value);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032328 desret_xmlChar_ptr(ret_val);
32329 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000032330 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032331 xmlResetLastError();
32332 if (mem_base != xmlMemBlocks()) {
32333 printf("Leak of %d blocks found in xmlSchemaCollapseString",
32334 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032335 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032336 printf(" %d", n_value);
32337 printf("\n");
32338 }
32339 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032340 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032341#endif
32342
Daniel Veillard42595322004-11-08 10:52:06 +000032343 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032344}
32345
Daniel Veillarda521d282004-11-09 14:59:59 +000032346#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000032347
Daniel Veillardce682bc2004-11-05 17:22:25 +000032348#define gen_nb_xmlSchemaValPtr 1
32349static xmlSchemaValPtr gen_xmlSchemaValPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32350 return(NULL);
32351}
32352static void des_xmlSchemaValPtr(int no ATTRIBUTE_UNUSED, xmlSchemaValPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32353}
Daniel Veillarda521d282004-11-09 14:59:59 +000032354#endif
32355
Daniel Veillardce682bc2004-11-05 17:22:25 +000032356
Daniel Veillardd93f6252004-11-02 15:53:51 +000032357static int
32358test_xmlSchemaCompareValues(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032359 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032360
William M. Brack21e4ef22005-01-02 09:53:13 +000032361#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032362 int mem_base;
32363 int ret_val;
32364 xmlSchemaValPtr x; /* a first value */
32365 int n_x;
32366 xmlSchemaValPtr y; /* a second value */
32367 int n_y;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032368
Daniel Veillardce682bc2004-11-05 17:22:25 +000032369 for (n_x = 0;n_x < gen_nb_xmlSchemaValPtr;n_x++) {
32370 for (n_y = 0;n_y < gen_nb_xmlSchemaValPtr;n_y++) {
32371 mem_base = xmlMemBlocks();
32372 x = gen_xmlSchemaValPtr(n_x, 0);
32373 y = gen_xmlSchemaValPtr(n_y, 1);
32374
32375 ret_val = xmlSchemaCompareValues(x, y);
32376 desret_int(ret_val);
32377 call_tests++;
32378 des_xmlSchemaValPtr(n_x, x, 0);
32379 des_xmlSchemaValPtr(n_y, y, 1);
32380 xmlResetLastError();
32381 if (mem_base != xmlMemBlocks()) {
32382 printf("Leak of %d blocks found in xmlSchemaCompareValues",
32383 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032384 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032385 printf(" %d", n_x);
32386 printf(" %d", n_y);
32387 printf("\n");
32388 }
32389 }
32390 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032391 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032392#endif
32393
Daniel Veillard42595322004-11-08 10:52:06 +000032394 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032395}
32396
32397
32398static int
32399test_xmlSchemaGetBuiltInListSimpleTypeItemType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032400 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032401
William M. Brack21e4ef22005-01-02 09:53:13 +000032402#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000032403 int mem_base;
32404 xmlSchemaTypePtr ret_val;
32405 xmlSchemaTypePtr type; /* the built-in simple type. */
32406 int n_type;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032407
Daniel Veillard42595322004-11-08 10:52:06 +000032408 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32409 mem_base = xmlMemBlocks();
32410 type = gen_xmlSchemaTypePtr(n_type, 0);
32411
32412 ret_val = xmlSchemaGetBuiltInListSimpleTypeItemType(type);
32413 desret_xmlSchemaTypePtr(ret_val);
32414 call_tests++;
32415 des_xmlSchemaTypePtr(n_type, type, 0);
32416 xmlResetLastError();
32417 if (mem_base != xmlMemBlocks()) {
32418 printf("Leak of %d blocks found in xmlSchemaGetBuiltInListSimpleTypeItemType",
32419 xmlMemBlocks() - mem_base);
32420 test_ret++;
32421 printf(" %d", n_type);
32422 printf("\n");
32423 }
32424 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032425 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032426#endif
32427
Daniel Veillard42595322004-11-08 10:52:06 +000032428 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032429}
32430
32431
32432static int
32433test_xmlSchemaGetBuiltInType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032434 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032435
William M. Brack21e4ef22005-01-02 09:53:13 +000032436#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000032437 xmlSchemaTypePtr ret_val;
32438 xmlSchemaValType type; /* the type of the built in type */
32439 int n_type;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032440
Daniel Veillard42595322004-11-08 10:52:06 +000032441 for (n_type = 0;n_type < gen_nb_xmlSchemaValType;n_type++) {
32442 type = gen_xmlSchemaValType(n_type, 0);
32443
32444 ret_val = xmlSchemaGetBuiltInType(type);
32445 desret_xmlSchemaTypePtr(ret_val);
32446 call_tests++;
32447 des_xmlSchemaValType(n_type, type, 0);
32448 xmlResetLastError();
32449 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032450 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032451#endif
32452
Daniel Veillard42595322004-11-08 10:52:06 +000032453 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032454}
32455
32456
32457static int
32458test_xmlSchemaGetFacetValueAsULong(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032459 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032460
William M. Brack21e4ef22005-01-02 09:53:13 +000032461#if defined(LIBXML_SCHEMAS_ENABLED)
William M. Brack094dd862004-11-14 14:28:34 +000032462 int mem_base;
32463 unsigned long ret_val;
32464 xmlSchemaFacetPtr facet; /* an schemas type facet */
32465 int n_facet;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032466
William M. Brack094dd862004-11-14 14:28:34 +000032467 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
32468 mem_base = xmlMemBlocks();
32469 facet = gen_xmlSchemaFacetPtr(n_facet, 0);
32470
32471 ret_val = xmlSchemaGetFacetValueAsULong(facet);
32472 desret_unsigned_long(ret_val);
32473 call_tests++;
32474 des_xmlSchemaFacetPtr(n_facet, facet, 0);
32475 xmlResetLastError();
32476 if (mem_base != xmlMemBlocks()) {
32477 printf("Leak of %d blocks found in xmlSchemaGetFacetValueAsULong",
32478 xmlMemBlocks() - mem_base);
32479 test_ret++;
32480 printf(" %d", n_facet);
32481 printf("\n");
32482 }
32483 }
32484 function_tests++;
32485#endif
32486
Daniel Veillard42595322004-11-08 10:52:06 +000032487 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032488}
32489
32490
32491static int
32492test_xmlSchemaGetPredefinedType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032493 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032494
William M. Brack21e4ef22005-01-02 09:53:13 +000032495#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000032496 int mem_base;
32497 xmlSchemaTypePtr ret_val;
32498 xmlChar * name; /* the type name */
32499 int n_name;
32500 xmlChar * ns; /* the URI of the namespace usually "http://www.w3.org/2001/XMLSchema" */
32501 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032502
Daniel Veillard42595322004-11-08 10:52:06 +000032503 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
32504 for (n_ns = 0;n_ns < gen_nb_const_xmlChar_ptr;n_ns++) {
32505 mem_base = xmlMemBlocks();
32506 name = gen_const_xmlChar_ptr(n_name, 0);
32507 ns = gen_const_xmlChar_ptr(n_ns, 1);
32508
William M. Brackf13f77f2004-11-12 16:03:48 +000032509 ret_val = xmlSchemaGetPredefinedType((const xmlChar *)name, (const xmlChar *)ns);
Daniel Veillard42595322004-11-08 10:52:06 +000032510 desret_xmlSchemaTypePtr(ret_val);
32511 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000032512 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
32513 des_const_xmlChar_ptr(n_ns, (const xmlChar *)ns, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000032514 xmlResetLastError();
32515 if (mem_base != xmlMemBlocks()) {
32516 printf("Leak of %d blocks found in xmlSchemaGetPredefinedType",
32517 xmlMemBlocks() - mem_base);
32518 test_ret++;
32519 printf(" %d", n_name);
32520 printf(" %d", n_ns);
32521 printf("\n");
32522 }
32523 }
32524 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032525 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032526#endif
32527
Daniel Veillard42595322004-11-08 10:52:06 +000032528 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032529}
32530
32531
32532static int
32533test_xmlSchemaInitTypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032534 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032535
William M. Brack21e4ef22005-01-02 09:53:13 +000032536#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000032537
32538
32539 xmlSchemaInitTypes();
32540 call_tests++;
32541 xmlResetLastError();
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032542 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032543#endif
32544
Daniel Veillard42595322004-11-08 10:52:06 +000032545 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032546}
32547
32548
32549static int
32550test_xmlSchemaIsBuiltInTypeFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032551 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032552
William M. Brack21e4ef22005-01-02 09:53:13 +000032553#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032554 int mem_base;
32555 int ret_val;
32556 xmlSchemaTypePtr type; /* the built-in type */
32557 int n_type;
32558 int facetType; /* the facet type */
32559 int n_facetType;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032560
Daniel Veillardce682bc2004-11-05 17:22:25 +000032561 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32562 for (n_facetType = 0;n_facetType < gen_nb_int;n_facetType++) {
32563 mem_base = xmlMemBlocks();
32564 type = gen_xmlSchemaTypePtr(n_type, 0);
32565 facetType = gen_int(n_facetType, 1);
32566
32567 ret_val = xmlSchemaIsBuiltInTypeFacet(type, facetType);
32568 desret_int(ret_val);
32569 call_tests++;
32570 des_xmlSchemaTypePtr(n_type, type, 0);
32571 des_int(n_facetType, facetType, 1);
32572 xmlResetLastError();
32573 if (mem_base != xmlMemBlocks()) {
32574 printf("Leak of %d blocks found in xmlSchemaIsBuiltInTypeFacet",
32575 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032576 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032577 printf(" %d", n_type);
32578 printf(" %d", n_facetType);
32579 printf("\n");
32580 }
32581 }
32582 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032583 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032584#endif
32585
Daniel Veillard42595322004-11-08 10:52:06 +000032586 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032587}
32588
32589
32590static int
32591test_xmlSchemaNewFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032592 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032593
32594
32595 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000032596 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032597}
32598
Daniel Veillarda521d282004-11-09 14:59:59 +000032599#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000032600
Daniel Veillardce682bc2004-11-05 17:22:25 +000032601#define gen_nb_xmlSchemaValPtr_ptr 1
32602static xmlSchemaValPtr * gen_xmlSchemaValPtr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32603 return(NULL);
32604}
32605static void des_xmlSchemaValPtr_ptr(int no ATTRIBUTE_UNUSED, xmlSchemaValPtr * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32606}
Daniel Veillarda521d282004-11-09 14:59:59 +000032607#endif
32608
Daniel Veillardce682bc2004-11-05 17:22:25 +000032609
Daniel Veillardd93f6252004-11-02 15:53:51 +000032610static int
32611test_xmlSchemaValPredefTypeNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032612 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032613
William M. Brack21e4ef22005-01-02 09:53:13 +000032614#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032615 int mem_base;
32616 int ret_val;
32617 xmlSchemaTypePtr type; /* the predefined type */
32618 int n_type;
32619 xmlChar * value; /* the value to check */
32620 int n_value;
32621 xmlSchemaValPtr * val; /* the return computed value */
32622 int n_val;
32623 xmlNodePtr node; /* the node containing the value */
32624 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032625
Daniel Veillardce682bc2004-11-05 17:22:25 +000032626 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32627 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32628 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr_ptr;n_val++) {
32629 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
32630 mem_base = xmlMemBlocks();
32631 type = gen_xmlSchemaTypePtr(n_type, 0);
32632 value = gen_const_xmlChar_ptr(n_value, 1);
32633 val = gen_xmlSchemaValPtr_ptr(n_val, 2);
32634 node = gen_xmlNodePtr(n_node, 3);
32635
William M. Brackf13f77f2004-11-12 16:03:48 +000032636 ret_val = xmlSchemaValPredefTypeNode(type, (const xmlChar *)value, val, node);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032637 desret_int(ret_val);
32638 call_tests++;
32639 des_xmlSchemaTypePtr(n_type, type, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000032640 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032641 des_xmlSchemaValPtr_ptr(n_val, val, 2);
32642 des_xmlNodePtr(n_node, node, 3);
32643 xmlResetLastError();
32644 if (mem_base != xmlMemBlocks()) {
32645 printf("Leak of %d blocks found in xmlSchemaValPredefTypeNode",
32646 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032647 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032648 printf(" %d", n_type);
32649 printf(" %d", n_value);
32650 printf(" %d", n_val);
32651 printf(" %d", n_node);
32652 printf("\n");
32653 }
32654 }
32655 }
32656 }
32657 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032658 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032659#endif
32660
Daniel Veillard42595322004-11-08 10:52:06 +000032661 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032662}
32663
32664
32665static int
32666test_xmlSchemaValPredefTypeNodeNoNorm(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032667 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032668
William M. Brack21e4ef22005-01-02 09:53:13 +000032669#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032670 int mem_base;
32671 int ret_val;
32672 xmlSchemaTypePtr type; /* the predefined type */
32673 int n_type;
32674 xmlChar * value; /* the value to check */
32675 int n_value;
32676 xmlSchemaValPtr * val; /* the return computed value */
32677 int n_val;
32678 xmlNodePtr node; /* the node containing the value */
32679 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032680
Daniel Veillardce682bc2004-11-05 17:22:25 +000032681 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32682 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32683 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr_ptr;n_val++) {
32684 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
32685 mem_base = xmlMemBlocks();
32686 type = gen_xmlSchemaTypePtr(n_type, 0);
32687 value = gen_const_xmlChar_ptr(n_value, 1);
32688 val = gen_xmlSchemaValPtr_ptr(n_val, 2);
32689 node = gen_xmlNodePtr(n_node, 3);
32690
William M. Brackf13f77f2004-11-12 16:03:48 +000032691 ret_val = xmlSchemaValPredefTypeNodeNoNorm(type, (const xmlChar *)value, val, node);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032692 desret_int(ret_val);
32693 call_tests++;
32694 des_xmlSchemaTypePtr(n_type, type, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000032695 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032696 des_xmlSchemaValPtr_ptr(n_val, val, 2);
32697 des_xmlNodePtr(n_node, node, 3);
32698 xmlResetLastError();
32699 if (mem_base != xmlMemBlocks()) {
32700 printf("Leak of %d blocks found in xmlSchemaValPredefTypeNodeNoNorm",
32701 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032702 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032703 printf(" %d", n_type);
32704 printf(" %d", n_value);
32705 printf(" %d", n_val);
32706 printf(" %d", n_node);
32707 printf("\n");
32708 }
32709 }
32710 }
32711 }
32712 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032713 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032714#endif
32715
Daniel Veillard42595322004-11-08 10:52:06 +000032716 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032717}
32718
32719
32720static int
32721test_xmlSchemaValidateFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032722 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032723
William M. Brack21e4ef22005-01-02 09:53:13 +000032724#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032725 int mem_base;
32726 int ret_val;
32727 xmlSchemaTypePtr base; /* the base type */
32728 int n_base;
32729 xmlSchemaFacetPtr facet; /* the facet to check */
32730 int n_facet;
32731 xmlChar * value; /* the lexical repr of the value to validate */
32732 int n_value;
32733 xmlSchemaValPtr val; /* the precomputed value */
32734 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032735
Daniel Veillardce682bc2004-11-05 17:22:25 +000032736 for (n_base = 0;n_base < gen_nb_xmlSchemaTypePtr;n_base++) {
32737 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
32738 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32739 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) {
32740 mem_base = xmlMemBlocks();
32741 base = gen_xmlSchemaTypePtr(n_base, 0);
32742 facet = gen_xmlSchemaFacetPtr(n_facet, 1);
32743 value = gen_const_xmlChar_ptr(n_value, 2);
32744 val = gen_xmlSchemaValPtr(n_val, 3);
32745
William M. Brackf13f77f2004-11-12 16:03:48 +000032746 ret_val = xmlSchemaValidateFacet(base, facet, (const xmlChar *)value, val);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032747 desret_int(ret_val);
32748 call_tests++;
32749 des_xmlSchemaTypePtr(n_base, base, 0);
32750 des_xmlSchemaFacetPtr(n_facet, facet, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000032751 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032752 des_xmlSchemaValPtr(n_val, val, 3);
32753 xmlResetLastError();
32754 if (mem_base != xmlMemBlocks()) {
32755 printf("Leak of %d blocks found in xmlSchemaValidateFacet",
32756 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032757 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032758 printf(" %d", n_base);
32759 printf(" %d", n_facet);
32760 printf(" %d", n_value);
32761 printf(" %d", n_val);
32762 printf("\n");
32763 }
32764 }
32765 }
32766 }
32767 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032768 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032769#endif
32770
Daniel Veillard42595322004-11-08 10:52:06 +000032771 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032772}
32773
32774
32775static int
32776test_xmlSchemaValidateLengthFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032777 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032778
William M. Brack21e4ef22005-01-02 09:53:13 +000032779#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032780 int mem_base;
32781 int ret_val;
32782 xmlSchemaTypePtr type; /* the built-in type */
32783 int n_type;
32784 xmlSchemaFacetPtr facet; /* the facet to check */
32785 int n_facet;
32786 xmlChar * value; /* the lexical repr. of the value to be validated */
32787 int n_value;
32788 xmlSchemaValPtr val; /* the precomputed value */
32789 int n_val;
32790 unsigned long * length; /* the actual length of the value */
32791 int n_length;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032792
Daniel Veillardce682bc2004-11-05 17:22:25 +000032793 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32794 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
32795 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32796 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) {
32797 for (n_length = 0;n_length < gen_nb_unsigned_long_ptr;n_length++) {
32798 mem_base = xmlMemBlocks();
32799 type = gen_xmlSchemaTypePtr(n_type, 0);
32800 facet = gen_xmlSchemaFacetPtr(n_facet, 1);
32801 value = gen_const_xmlChar_ptr(n_value, 2);
32802 val = gen_xmlSchemaValPtr(n_val, 3);
32803 length = gen_unsigned_long_ptr(n_length, 4);
32804
William M. Brackf13f77f2004-11-12 16:03:48 +000032805 ret_val = xmlSchemaValidateLengthFacet(type, facet, (const xmlChar *)value, val, length);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032806 desret_int(ret_val);
32807 call_tests++;
32808 des_xmlSchemaTypePtr(n_type, type, 0);
32809 des_xmlSchemaFacetPtr(n_facet, facet, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000032810 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032811 des_xmlSchemaValPtr(n_val, val, 3);
32812 des_unsigned_long_ptr(n_length, length, 4);
32813 xmlResetLastError();
32814 if (mem_base != xmlMemBlocks()) {
32815 printf("Leak of %d blocks found in xmlSchemaValidateLengthFacet",
32816 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032817 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032818 printf(" %d", n_type);
32819 printf(" %d", n_facet);
32820 printf(" %d", n_value);
32821 printf(" %d", n_val);
32822 printf(" %d", n_length);
32823 printf("\n");
32824 }
32825 }
32826 }
32827 }
32828 }
32829 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032830 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032831#endif
32832
Daniel Veillard42595322004-11-08 10:52:06 +000032833 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032834}
32835
32836
32837static int
32838test_xmlSchemaValidateListSimpleTypeFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032839 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032840
William M. Brack21e4ef22005-01-02 09:53:13 +000032841#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032842 int mem_base;
32843 int ret_val;
32844 xmlSchemaFacetPtr facet; /* the facet to check */
32845 int n_facet;
32846 xmlChar * value; /* the lexical repr of the value to validate */
32847 int n_value;
32848 unsigned long actualLen; /* the number of list items */
32849 int n_actualLen;
32850 unsigned long * expectedLen; /* the resulting expected number of list items */
32851 int n_expectedLen;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032852
Daniel Veillardce682bc2004-11-05 17:22:25 +000032853 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
32854 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32855 for (n_actualLen = 0;n_actualLen < gen_nb_unsigned_long;n_actualLen++) {
32856 for (n_expectedLen = 0;n_expectedLen < gen_nb_unsigned_long_ptr;n_expectedLen++) {
32857 mem_base = xmlMemBlocks();
32858 facet = gen_xmlSchemaFacetPtr(n_facet, 0);
32859 value = gen_const_xmlChar_ptr(n_value, 1);
32860 actualLen = gen_unsigned_long(n_actualLen, 2);
32861 expectedLen = gen_unsigned_long_ptr(n_expectedLen, 3);
32862
William M. Brackf13f77f2004-11-12 16:03:48 +000032863 ret_val = xmlSchemaValidateListSimpleTypeFacet(facet, (const xmlChar *)value, actualLen, expectedLen);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032864 desret_int(ret_val);
32865 call_tests++;
32866 des_xmlSchemaFacetPtr(n_facet, facet, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000032867 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032868 des_unsigned_long(n_actualLen, actualLen, 2);
32869 des_unsigned_long_ptr(n_expectedLen, expectedLen, 3);
32870 xmlResetLastError();
32871 if (mem_base != xmlMemBlocks()) {
32872 printf("Leak of %d blocks found in xmlSchemaValidateListSimpleTypeFacet",
32873 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032874 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032875 printf(" %d", n_facet);
32876 printf(" %d", n_value);
32877 printf(" %d", n_actualLen);
32878 printf(" %d", n_expectedLen);
32879 printf("\n");
32880 }
32881 }
32882 }
32883 }
32884 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032885 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032886#endif
32887
Daniel Veillard42595322004-11-08 10:52:06 +000032888 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032889}
32890
32891
32892static int
32893test_xmlSchemaValidatePredefinedType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032894 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032895
William M. Brack21e4ef22005-01-02 09:53:13 +000032896#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032897 int mem_base;
32898 int ret_val;
32899 xmlSchemaTypePtr type; /* the predefined type */
32900 int n_type;
32901 xmlChar * value; /* the value to check */
32902 int n_value;
32903 xmlSchemaValPtr * val; /* the return computed value */
32904 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032905
Daniel Veillardce682bc2004-11-05 17:22:25 +000032906 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32907 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32908 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr_ptr;n_val++) {
32909 mem_base = xmlMemBlocks();
32910 type = gen_xmlSchemaTypePtr(n_type, 0);
32911 value = gen_const_xmlChar_ptr(n_value, 1);
32912 val = gen_xmlSchemaValPtr_ptr(n_val, 2);
32913
William M. Brackf13f77f2004-11-12 16:03:48 +000032914 ret_val = xmlSchemaValidatePredefinedType(type, (const xmlChar *)value, val);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032915 desret_int(ret_val);
32916 call_tests++;
32917 des_xmlSchemaTypePtr(n_type, type, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000032918 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032919 des_xmlSchemaValPtr_ptr(n_val, val, 2);
32920 xmlResetLastError();
32921 if (mem_base != xmlMemBlocks()) {
32922 printf("Leak of %d blocks found in xmlSchemaValidatePredefinedType",
32923 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032924 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032925 printf(" %d", n_type);
32926 printf(" %d", n_value);
32927 printf(" %d", n_val);
32928 printf("\n");
32929 }
32930 }
32931 }
32932 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032933 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032934#endif
32935
Daniel Veillard42595322004-11-08 10:52:06 +000032936 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032937}
32938
Daniel Veillard91b955c2004-12-10 10:26:42 +000032939
32940static int
32941test_xmlSchemaWhiteSpaceReplace(void) {
32942 int test_ret = 0;
32943
William M. Brack21e4ef22005-01-02 09:53:13 +000032944#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard91b955c2004-12-10 10:26:42 +000032945 int mem_base;
32946 xmlChar * ret_val;
32947 xmlChar * value; /* a value */
32948 int n_value;
32949
32950 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32951 mem_base = xmlMemBlocks();
32952 value = gen_const_xmlChar_ptr(n_value, 0);
32953
32954 ret_val = xmlSchemaWhiteSpaceReplace((const xmlChar *)value);
32955 desret_xmlChar_ptr(ret_val);
32956 call_tests++;
32957 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
32958 xmlResetLastError();
32959 if (mem_base != xmlMemBlocks()) {
32960 printf("Leak of %d blocks found in xmlSchemaWhiteSpaceReplace",
32961 xmlMemBlocks() - mem_base);
32962 test_ret++;
32963 printf(" %d", n_value);
32964 printf("\n");
32965 }
32966 }
32967 function_tests++;
32968#endif
32969
32970 return(test_ret);
32971}
32972
Daniel Veillardd93f6252004-11-02 15:53:51 +000032973static int
32974test_xmlschemastypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032975 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032976
Daniel Veillard91b955c2004-12-10 10:26:42 +000032977 if (quiet == 0) printf("Testing xmlschemastypes : 17 of 20 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000032978 test_ret += test_xmlSchemaCheckFacet();
32979 test_ret += test_xmlSchemaCleanupTypes();
32980 test_ret += test_xmlSchemaCollapseString();
32981 test_ret += test_xmlSchemaCompareValues();
32982 test_ret += test_xmlSchemaGetBuiltInListSimpleTypeItemType();
32983 test_ret += test_xmlSchemaGetBuiltInType();
32984 test_ret += test_xmlSchemaGetFacetValueAsULong();
32985 test_ret += test_xmlSchemaGetPredefinedType();
32986 test_ret += test_xmlSchemaInitTypes();
32987 test_ret += test_xmlSchemaIsBuiltInTypeFacet();
32988 test_ret += test_xmlSchemaNewFacet();
32989 test_ret += test_xmlSchemaValPredefTypeNode();
32990 test_ret += test_xmlSchemaValPredefTypeNodeNoNorm();
32991 test_ret += test_xmlSchemaValidateFacet();
32992 test_ret += test_xmlSchemaValidateLengthFacet();
32993 test_ret += test_xmlSchemaValidateListSimpleTypeFacet();
32994 test_ret += test_xmlSchemaValidatePredefinedType();
Daniel Veillard91b955c2004-12-10 10:26:42 +000032995 test_ret += test_xmlSchemaWhiteSpaceReplace();
Daniel Veillardd93f6252004-11-02 15:53:51 +000032996
Daniel Veillard42595322004-11-08 10:52:06 +000032997 if (test_ret != 0)
32998 printf("Module xmlschemastypes: %d errors\n", test_ret);
32999 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033000}
33001
33002static int
33003test_xmlCharStrdup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033004 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033005
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033006 int mem_base;
33007 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033008 char * cur; /* the input char * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033009 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033010
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033011 for (n_cur = 0;n_cur < gen_nb_const_char_ptr;n_cur++) {
33012 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033013 cur = gen_const_char_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033014
William M. Brackf13f77f2004-11-12 16:03:48 +000033015 ret_val = xmlCharStrdup((const char *)cur);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033016 desret_xmlChar_ptr(ret_val);
33017 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033018 des_const_char_ptr(n_cur, (const char *)cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033019 xmlResetLastError();
33020 if (mem_base != xmlMemBlocks()) {
33021 printf("Leak of %d blocks found in xmlCharStrdup",
33022 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033023 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033024 printf(" %d", n_cur);
33025 printf("\n");
33026 }
33027 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033028 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033029
Daniel Veillard42595322004-11-08 10:52:06 +000033030 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033031}
33032
33033
33034static int
33035test_xmlCharStrndup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033036 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033037
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033038 int mem_base;
33039 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033040 char * cur; /* the input char * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033041 int n_cur;
33042 int len; /* the len of @cur */
33043 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033044
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033045 for (n_cur = 0;n_cur < gen_nb_const_char_ptr;n_cur++) {
33046 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33047 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033048 cur = gen_const_char_ptr(n_cur, 0);
33049 len = gen_int(n_len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033050
William M. Brackf13f77f2004-11-12 16:03:48 +000033051 ret_val = xmlCharStrndup((const char *)cur, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033052 desret_xmlChar_ptr(ret_val);
33053 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033054 des_const_char_ptr(n_cur, (const char *)cur, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033055 des_int(n_len, len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033056 xmlResetLastError();
33057 if (mem_base != xmlMemBlocks()) {
33058 printf("Leak of %d blocks found in xmlCharStrndup",
33059 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033060 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033061 printf(" %d", n_cur);
33062 printf(" %d", n_len);
33063 printf("\n");
33064 }
33065 }
33066 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033067 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033068
Daniel Veillard42595322004-11-08 10:52:06 +000033069 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033070}
33071
33072
33073static int
33074test_xmlCheckUTF8(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033075 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033076
Daniel Veillardce682bc2004-11-05 17:22:25 +000033077 int mem_base;
33078 int ret_val;
33079 unsigned char * utf; /* Pointer to putative UTF-8 encoded string. */
33080 int n_utf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033081
Daniel Veillardce682bc2004-11-05 17:22:25 +000033082 for (n_utf = 0;n_utf < gen_nb_const_unsigned_char_ptr;n_utf++) {
33083 mem_base = xmlMemBlocks();
33084 utf = gen_const_unsigned_char_ptr(n_utf, 0);
33085
William M. Brackf13f77f2004-11-12 16:03:48 +000033086 ret_val = xmlCheckUTF8((const unsigned char *)utf);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033087 desret_int(ret_val);
33088 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033089 des_const_unsigned_char_ptr(n_utf, (const unsigned char *)utf, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033090 xmlResetLastError();
33091 if (mem_base != xmlMemBlocks()) {
33092 printf("Leak of %d blocks found in xmlCheckUTF8",
33093 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033094 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033095 printf(" %d", n_utf);
33096 printf("\n");
33097 }
33098 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000033099 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033100
Daniel Veillard42595322004-11-08 10:52:06 +000033101 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033102}
33103
33104
33105static int
33106test_xmlGetUTF8Char(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033107 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033108
Daniel Veillardce682bc2004-11-05 17:22:25 +000033109 int mem_base;
33110 int ret_val;
33111 unsigned char * utf; /* a sequence of UTF-8 encoded bytes */
33112 int n_utf;
33113 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. */
33114 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033115
Daniel Veillardce682bc2004-11-05 17:22:25 +000033116 for (n_utf = 0;n_utf < gen_nb_const_unsigned_char_ptr;n_utf++) {
33117 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
33118 mem_base = xmlMemBlocks();
33119 utf = gen_const_unsigned_char_ptr(n_utf, 0);
33120 len = gen_int_ptr(n_len, 1);
33121
William M. Brackf13f77f2004-11-12 16:03:48 +000033122 ret_val = xmlGetUTF8Char((const unsigned char *)utf, len);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033123 desret_int(ret_val);
33124 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033125 des_const_unsigned_char_ptr(n_utf, (const unsigned char *)utf, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033126 des_int_ptr(n_len, len, 1);
33127 xmlResetLastError();
33128 if (mem_base != xmlMemBlocks()) {
33129 printf("Leak of %d blocks found in xmlGetUTF8Char",
33130 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033131 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033132 printf(" %d", n_utf);
33133 printf(" %d", n_len);
33134 printf("\n");
33135 }
33136 }
33137 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000033138 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033139
Daniel Veillard42595322004-11-08 10:52:06 +000033140 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033141}
33142
33143
33144static int
33145test_xmlStrEqual(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033146 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033147
33148 int mem_base;
33149 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033150 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033151 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033152 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033153 int n_str2;
33154
33155 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33156 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33157 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033158 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33159 str2 = gen_const_xmlChar_ptr(n_str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033160
William M. Brackf13f77f2004-11-12 16:03:48 +000033161 ret_val = xmlStrEqual((const xmlChar *)str1, (const xmlChar *)str2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033162 desret_int(ret_val);
33163 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033164 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
33165 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033166 xmlResetLastError();
33167 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033168 printf("Leak of %d blocks found in xmlStrEqual",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033169 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033170 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033171 printf(" %d", n_str1);
33172 printf(" %d", n_str2);
33173 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033174 }
33175 }
33176 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033177 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033178
Daniel Veillard42595322004-11-08 10:52:06 +000033179 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033180}
33181
33182
33183static int
33184test_xmlStrPrintf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033185 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033186
33187
33188 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000033189 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033190}
33191
33192
33193static int
33194test_xmlStrQEqual(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033195 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033196
33197 int mem_base;
33198 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033199 xmlChar * pref; /* the prefix of the QName */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033200 int n_pref;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033201 xmlChar * name; /* the localname of the QName */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033202 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033203 xmlChar * str; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033204 int n_str;
33205
33206 for (n_pref = 0;n_pref < gen_nb_const_xmlChar_ptr;n_pref++) {
33207 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
33208 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33209 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033210 pref = gen_const_xmlChar_ptr(n_pref, 0);
33211 name = gen_const_xmlChar_ptr(n_name, 1);
33212 str = gen_const_xmlChar_ptr(n_str, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033213
William M. Brackf13f77f2004-11-12 16:03:48 +000033214 ret_val = xmlStrQEqual((const xmlChar *)pref, (const xmlChar *)name, (const xmlChar *)str);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033215 desret_int(ret_val);
33216 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033217 des_const_xmlChar_ptr(n_pref, (const xmlChar *)pref, 0);
33218 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
33219 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033220 xmlResetLastError();
33221 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033222 printf("Leak of %d blocks found in xmlStrQEqual",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033223 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033224 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033225 printf(" %d", n_pref);
33226 printf(" %d", n_name);
33227 printf(" %d", n_str);
33228 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033229 }
33230 }
33231 }
33232 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033233 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033234
Daniel Veillard42595322004-11-08 10:52:06 +000033235 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033236}
33237
33238
33239static int
33240test_xmlStrVPrintf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033241 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033242
33243
33244 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000033245 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033246}
33247
33248
33249static int
33250test_xmlStrcasecmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033251 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033252
33253 int mem_base;
33254 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033255 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033256 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033257 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033258 int n_str2;
33259
33260 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33261 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33262 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033263 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33264 str2 = gen_const_xmlChar_ptr(n_str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033265
William M. Brackf13f77f2004-11-12 16:03:48 +000033266 ret_val = xmlStrcasecmp((const xmlChar *)str1, (const xmlChar *)str2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033267 desret_int(ret_val);
33268 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033269 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
33270 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033271 xmlResetLastError();
33272 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033273 printf("Leak of %d blocks found in xmlStrcasecmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033274 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033275 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033276 printf(" %d", n_str1);
33277 printf(" %d", n_str2);
33278 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033279 }
33280 }
33281 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033282 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033283
Daniel Veillard42595322004-11-08 10:52:06 +000033284 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033285}
33286
33287
33288static int
33289test_xmlStrcasestr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033290 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033291
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033292 int mem_base;
33293 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033294 xmlChar * str; /* the xmlChar * array (haystack) */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033295 int n_str;
33296 xmlChar * val; /* the xmlChar to search (needle) */
33297 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033298
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033299 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33300 for (n_val = 0;n_val < gen_nb_xmlChar_ptr;n_val++) {
33301 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033302 str = gen_const_xmlChar_ptr(n_str, 0);
33303 val = gen_xmlChar_ptr(n_val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033304
William M. Brackf13f77f2004-11-12 16:03:48 +000033305 ret_val = xmlStrcasestr((const xmlChar *)str, val);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033306 desret_const_xmlChar_ptr(ret_val);
33307 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033308 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033309 des_xmlChar_ptr(n_val, val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033310 xmlResetLastError();
33311 if (mem_base != xmlMemBlocks()) {
33312 printf("Leak of %d blocks found in xmlStrcasestr",
33313 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033314 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033315 printf(" %d", n_str);
33316 printf(" %d", n_val);
33317 printf("\n");
33318 }
33319 }
33320 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033321 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033322
Daniel Veillard42595322004-11-08 10:52:06 +000033323 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033324}
33325
33326
33327static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000033328test_xmlStrchr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033329 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033330
Daniel Veillardf2a36f92004-11-08 17:55:01 +000033331 int mem_base;
33332 const xmlChar * ret_val;
33333 xmlChar * str; /* the xmlChar * array */
33334 int n_str;
33335 xmlChar val; /* the xmlChar to search */
33336 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033337
Daniel Veillardf2a36f92004-11-08 17:55:01 +000033338 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33339 for (n_val = 0;n_val < gen_nb_xmlChar;n_val++) {
33340 mem_base = xmlMemBlocks();
33341 str = gen_const_xmlChar_ptr(n_str, 0);
33342 val = gen_xmlChar(n_val, 1);
33343
William M. Brackf13f77f2004-11-12 16:03:48 +000033344 ret_val = xmlStrchr((const xmlChar *)str, val);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000033345 desret_const_xmlChar_ptr(ret_val);
33346 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033347 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000033348 des_xmlChar(n_val, val, 1);
33349 xmlResetLastError();
33350 if (mem_base != xmlMemBlocks()) {
33351 printf("Leak of %d blocks found in xmlStrchr",
33352 xmlMemBlocks() - mem_base);
33353 test_ret++;
33354 printf(" %d", n_str);
33355 printf(" %d", n_val);
33356 printf("\n");
33357 }
33358 }
33359 }
Daniel Veillardf2a36f92004-11-08 17:55:01 +000033360 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033361
Daniel Veillard42595322004-11-08 10:52:06 +000033362 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033363}
33364
33365
33366static int
33367test_xmlStrcmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033368 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033369
33370 int mem_base;
33371 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033372 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033373 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033374 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033375 int n_str2;
33376
33377 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33378 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33379 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033380 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33381 str2 = gen_const_xmlChar_ptr(n_str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033382
William M. Brackf13f77f2004-11-12 16:03:48 +000033383 ret_val = xmlStrcmp((const xmlChar *)str1, (const xmlChar *)str2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033384 desret_int(ret_val);
33385 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033386 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
33387 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033388 xmlResetLastError();
33389 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033390 printf("Leak of %d blocks found in xmlStrcmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033391 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033392 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033393 printf(" %d", n_str1);
33394 printf(" %d", n_str2);
33395 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033396 }
33397 }
33398 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033399 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033400
Daniel Veillard42595322004-11-08 10:52:06 +000033401 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033402}
33403
33404
33405static int
33406test_xmlStrdup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033407 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033408
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033409 int mem_base;
33410 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033411 xmlChar * cur; /* the input xmlChar * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033412 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033413
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033414 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
33415 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033416 cur = gen_const_xmlChar_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033417
William M. Brackf13f77f2004-11-12 16:03:48 +000033418 ret_val = xmlStrdup((const xmlChar *)cur);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033419 desret_xmlChar_ptr(ret_val);
33420 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033421 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033422 xmlResetLastError();
33423 if (mem_base != xmlMemBlocks()) {
33424 printf("Leak of %d blocks found in xmlStrdup",
33425 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033426 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033427 printf(" %d", n_cur);
33428 printf("\n");
33429 }
33430 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033431 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033432
Daniel Veillard42595322004-11-08 10:52:06 +000033433 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033434}
33435
33436
33437static int
33438test_xmlStrlen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033439 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033440
33441 int mem_base;
33442 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033443 xmlChar * str; /* the xmlChar * array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033444 int n_str;
33445
33446 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33447 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033448 str = gen_const_xmlChar_ptr(n_str, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033449
William M. Brackf13f77f2004-11-12 16:03:48 +000033450 ret_val = xmlStrlen((const xmlChar *)str);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033451 desret_int(ret_val);
33452 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033453 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033454 xmlResetLastError();
33455 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033456 printf("Leak of %d blocks found in xmlStrlen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033457 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033458 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033459 printf(" %d", n_str);
33460 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033461 }
33462 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033463 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033464
Daniel Veillard42595322004-11-08 10:52:06 +000033465 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033466}
33467
33468
33469static int
33470test_xmlStrncasecmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033471 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033472
33473 int mem_base;
33474 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033475 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033476 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033477 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033478 int n_str2;
33479 int len; /* the max comparison length */
33480 int n_len;
33481
33482 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33483 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33484 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33485 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033486 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33487 str2 = gen_const_xmlChar_ptr(n_str2, 1);
33488 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033489
William M. Brackf13f77f2004-11-12 16:03:48 +000033490 ret_val = xmlStrncasecmp((const xmlChar *)str1, (const xmlChar *)str2, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033491 desret_int(ret_val);
33492 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033493 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
33494 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033495 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033496 xmlResetLastError();
33497 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033498 printf("Leak of %d blocks found in xmlStrncasecmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033499 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033500 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033501 printf(" %d", n_str1);
33502 printf(" %d", n_str2);
33503 printf(" %d", n_len);
33504 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033505 }
33506 }
33507 }
33508 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033509 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033510
Daniel Veillard42595322004-11-08 10:52:06 +000033511 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033512}
33513
33514
33515static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000033516test_xmlStrncatNew(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033517 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033518
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033519 int mem_base;
33520 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033521 xmlChar * str1; /* first xmlChar string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033522 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033523 xmlChar * str2; /* second xmlChar string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033524 int n_str2;
33525 int len; /* the len of @str2 */
33526 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033527
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033528 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33529 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33530 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33531 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033532 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33533 str2 = gen_const_xmlChar_ptr(n_str2, 1);
33534 len = gen_int(n_len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033535
William M. Brackf13f77f2004-11-12 16:03:48 +000033536 ret_val = xmlStrncatNew((const xmlChar *)str1, (const xmlChar *)str2, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033537 desret_xmlChar_ptr(ret_val);
33538 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033539 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
33540 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033541 des_int(n_len, len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033542 xmlResetLastError();
33543 if (mem_base != xmlMemBlocks()) {
33544 printf("Leak of %d blocks found in xmlStrncatNew",
33545 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033546 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033547 printf(" %d", n_str1);
33548 printf(" %d", n_str2);
33549 printf(" %d", n_len);
33550 printf("\n");
33551 }
33552 }
33553 }
33554 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033555 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033556
Daniel Veillard42595322004-11-08 10:52:06 +000033557 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033558}
33559
33560
33561static int
33562test_xmlStrncmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033563 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033564
33565 int mem_base;
33566 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033567 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033568 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033569 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033570 int n_str2;
33571 int len; /* the max comparison length */
33572 int n_len;
33573
33574 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33575 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33576 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33577 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033578 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33579 str2 = gen_const_xmlChar_ptr(n_str2, 1);
33580 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033581
William M. Brackf13f77f2004-11-12 16:03:48 +000033582 ret_val = xmlStrncmp((const xmlChar *)str1, (const xmlChar *)str2, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033583 desret_int(ret_val);
33584 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033585 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
33586 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033587 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033588 xmlResetLastError();
33589 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033590 printf("Leak of %d blocks found in xmlStrncmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033591 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033592 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033593 printf(" %d", n_str1);
33594 printf(" %d", n_str2);
33595 printf(" %d", n_len);
33596 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033597 }
33598 }
33599 }
33600 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033601 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033602
Daniel Veillard42595322004-11-08 10:52:06 +000033603 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033604}
33605
33606
33607static int
33608test_xmlStrndup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033609 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033610
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033611 int mem_base;
33612 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033613 xmlChar * cur; /* the input xmlChar * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033614 int n_cur;
33615 int len; /* the len of @cur */
33616 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033617
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033618 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
33619 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33620 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033621 cur = gen_const_xmlChar_ptr(n_cur, 0);
33622 len = gen_int(n_len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033623
William M. Brackf13f77f2004-11-12 16:03:48 +000033624 ret_val = xmlStrndup((const xmlChar *)cur, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033625 desret_xmlChar_ptr(ret_val);
33626 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033627 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033628 des_int(n_len, len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033629 xmlResetLastError();
33630 if (mem_base != xmlMemBlocks()) {
33631 printf("Leak of %d blocks found in xmlStrndup",
33632 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033633 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033634 printf(" %d", n_cur);
33635 printf(" %d", n_len);
33636 printf("\n");
33637 }
33638 }
33639 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033640 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033641
Daniel Veillard42595322004-11-08 10:52:06 +000033642 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033643}
33644
33645
33646static int
33647test_xmlStrstr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033648 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033649
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033650 int mem_base;
33651 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033652 xmlChar * str; /* the xmlChar * array (haystack) */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033653 int n_str;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033654 xmlChar * val; /* the xmlChar to search (needle) */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033655 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033656
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033657 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33658 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
33659 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033660 str = gen_const_xmlChar_ptr(n_str, 0);
33661 val = gen_const_xmlChar_ptr(n_val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033662
William M. Brackf13f77f2004-11-12 16:03:48 +000033663 ret_val = xmlStrstr((const xmlChar *)str, (const xmlChar *)val);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033664 desret_const_xmlChar_ptr(ret_val);
33665 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033666 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
33667 des_const_xmlChar_ptr(n_val, (const xmlChar *)val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033668 xmlResetLastError();
33669 if (mem_base != xmlMemBlocks()) {
33670 printf("Leak of %d blocks found in xmlStrstr",
33671 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033672 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033673 printf(" %d", n_str);
33674 printf(" %d", n_val);
33675 printf("\n");
33676 }
33677 }
33678 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033679 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033680
Daniel Veillard42595322004-11-08 10:52:06 +000033681 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033682}
33683
33684
33685static int
33686test_xmlStrsub(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033687 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033688
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033689 int mem_base;
33690 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033691 xmlChar * str; /* the xmlChar * array (haystack) */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033692 int n_str;
33693 int start; /* the index of the first char (zero based) */
33694 int n_start;
33695 int len; /* the length of the substring */
33696 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033697
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033698 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33699 for (n_start = 0;n_start < gen_nb_int;n_start++) {
33700 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33701 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033702 str = gen_const_xmlChar_ptr(n_str, 0);
33703 start = gen_int(n_start, 1);
33704 len = gen_int(n_len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033705
William M. Brackf13f77f2004-11-12 16:03:48 +000033706 ret_val = xmlStrsub((const xmlChar *)str, start, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033707 desret_xmlChar_ptr(ret_val);
33708 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033709 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033710 des_int(n_start, start, 1);
33711 des_int(n_len, len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033712 xmlResetLastError();
33713 if (mem_base != xmlMemBlocks()) {
33714 printf("Leak of %d blocks found in xmlStrsub",
33715 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033716 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033717 printf(" %d", n_str);
33718 printf(" %d", n_start);
33719 printf(" %d", n_len);
33720 printf("\n");
33721 }
33722 }
33723 }
33724 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033725 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033726
Daniel Veillard42595322004-11-08 10:52:06 +000033727 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033728}
33729
33730
33731static int
33732test_xmlUTF8Charcmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033733 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033734
33735 int mem_base;
33736 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033737 xmlChar * utf1; /* pointer to first UTF8 char */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033738 int n_utf1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033739 xmlChar * utf2; /* pointer to second UTF8 char */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033740 int n_utf2;
33741
33742 for (n_utf1 = 0;n_utf1 < gen_nb_const_xmlChar_ptr;n_utf1++) {
33743 for (n_utf2 = 0;n_utf2 < gen_nb_const_xmlChar_ptr;n_utf2++) {
33744 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033745 utf1 = gen_const_xmlChar_ptr(n_utf1, 0);
33746 utf2 = gen_const_xmlChar_ptr(n_utf2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033747
William M. Brackf13f77f2004-11-12 16:03:48 +000033748 ret_val = xmlUTF8Charcmp((const xmlChar *)utf1, (const xmlChar *)utf2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033749 desret_int(ret_val);
33750 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033751 des_const_xmlChar_ptr(n_utf1, (const xmlChar *)utf1, 0);
33752 des_const_xmlChar_ptr(n_utf2, (const xmlChar *)utf2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033753 xmlResetLastError();
33754 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033755 printf("Leak of %d blocks found in xmlUTF8Charcmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033756 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033757 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033758 printf(" %d", n_utf1);
33759 printf(" %d", n_utf2);
33760 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033761 }
33762 }
33763 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033764 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033765
Daniel Veillard42595322004-11-08 10:52:06 +000033766 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033767}
33768
33769
33770static int
33771test_xmlUTF8Size(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033772 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033773
33774 int mem_base;
33775 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033776 xmlChar * utf; /* pointer to the UTF8 character */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033777 int n_utf;
33778
33779 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33780 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033781 utf = gen_const_xmlChar_ptr(n_utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033782
William M. Brackf13f77f2004-11-12 16:03:48 +000033783 ret_val = xmlUTF8Size((const xmlChar *)utf);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033784 desret_int(ret_val);
33785 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033786 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033787 xmlResetLastError();
33788 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033789 printf("Leak of %d blocks found in xmlUTF8Size",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033790 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033791 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033792 printf(" %d", n_utf);
33793 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033794 }
33795 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033796 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033797
Daniel Veillard42595322004-11-08 10:52:06 +000033798 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033799}
33800
33801
33802static int
33803test_xmlUTF8Strlen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033804 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033805
33806 int mem_base;
33807 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033808 xmlChar * utf; /* a sequence of UTF-8 encoded bytes */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033809 int n_utf;
33810
33811 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33812 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033813 utf = gen_const_xmlChar_ptr(n_utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033814
William M. Brackf13f77f2004-11-12 16:03:48 +000033815 ret_val = xmlUTF8Strlen((const xmlChar *)utf);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033816 desret_int(ret_val);
33817 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033818 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033819 xmlResetLastError();
33820 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033821 printf("Leak of %d blocks found in xmlUTF8Strlen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033822 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033823 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033824 printf(" %d", n_utf);
33825 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033826 }
33827 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033828 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033829
Daniel Veillard42595322004-11-08 10:52:06 +000033830 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033831}
33832
33833
33834static int
33835test_xmlUTF8Strloc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033836 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033837
33838 int mem_base;
33839 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033840 xmlChar * utf; /* the input UTF8 * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033841 int n_utf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033842 xmlChar * utfchar; /* the UTF8 character to be found */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033843 int n_utfchar;
33844
33845 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33846 for (n_utfchar = 0;n_utfchar < gen_nb_const_xmlChar_ptr;n_utfchar++) {
33847 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033848 utf = gen_const_xmlChar_ptr(n_utf, 0);
33849 utfchar = gen_const_xmlChar_ptr(n_utfchar, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033850
William M. Brackf13f77f2004-11-12 16:03:48 +000033851 ret_val = xmlUTF8Strloc((const xmlChar *)utf, (const xmlChar *)utfchar);
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_utf, (const xmlChar *)utf, 0);
33855 des_const_xmlChar_ptr(n_utfchar, (const xmlChar *)utfchar, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033856 xmlResetLastError();
33857 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033858 printf("Leak of %d blocks found in xmlUTF8Strloc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033859 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033860 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033861 printf(" %d", n_utf);
33862 printf(" %d", n_utfchar);
33863 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033864 }
33865 }
33866 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033867 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033868
Daniel Veillard42595322004-11-08 10:52:06 +000033869 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033870}
33871
33872
33873static int
33874test_xmlUTF8Strndup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033875 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033876
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033877 int mem_base;
33878 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033879 xmlChar * utf; /* the input UTF8 * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033880 int n_utf;
33881 int len; /* the len of @utf (in chars) */
33882 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033883
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033884 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33885 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33886 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033887 utf = gen_const_xmlChar_ptr(n_utf, 0);
33888 len = gen_int(n_len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033889
William M. Brackf13f77f2004-11-12 16:03:48 +000033890 ret_val = xmlUTF8Strndup((const xmlChar *)utf, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033891 desret_xmlChar_ptr(ret_val);
33892 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033893 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033894 des_int(n_len, len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033895 xmlResetLastError();
33896 if (mem_base != xmlMemBlocks()) {
33897 printf("Leak of %d blocks found in xmlUTF8Strndup",
33898 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033899 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033900 printf(" %d", n_utf);
33901 printf(" %d", n_len);
33902 printf("\n");
33903 }
33904 }
33905 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033906 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033907
Daniel Veillard42595322004-11-08 10:52:06 +000033908 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033909}
33910
33911
33912static int
33913test_xmlUTF8Strpos(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033914 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033915
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033916 int mem_base;
33917 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033918 xmlChar * utf; /* the input UTF8 * */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033919 int n_utf;
33920 int pos; /* the position of the desired UTF8 char (in chars) */
33921 int n_pos;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033922
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033923 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33924 for (n_pos = 0;n_pos < gen_nb_int;n_pos++) {
33925 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033926 utf = gen_const_xmlChar_ptr(n_utf, 0);
33927 pos = gen_int(n_pos, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033928
William M. Brackf13f77f2004-11-12 16:03:48 +000033929 ret_val = xmlUTF8Strpos((const xmlChar *)utf, pos);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033930 desret_const_xmlChar_ptr(ret_val);
33931 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033932 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033933 des_int(n_pos, pos, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033934 xmlResetLastError();
33935 if (mem_base != xmlMemBlocks()) {
33936 printf("Leak of %d blocks found in xmlUTF8Strpos",
33937 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033938 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033939 printf(" %d", n_utf);
33940 printf(" %d", n_pos);
33941 printf("\n");
33942 }
33943 }
33944 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033945 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033946
Daniel Veillard42595322004-11-08 10:52:06 +000033947 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033948}
33949
33950
33951static int
33952test_xmlUTF8Strsize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033953 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033954
33955 int mem_base;
33956 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033957 xmlChar * utf; /* a sequence of UTF-8 encoded bytes */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033958 int n_utf;
33959 int len; /* the number of characters in the array */
33960 int n_len;
33961
33962 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33963 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33964 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033965 utf = gen_const_xmlChar_ptr(n_utf, 0);
33966 len = gen_int(n_len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033967
William M. Brackf13f77f2004-11-12 16:03:48 +000033968 ret_val = xmlUTF8Strsize((const xmlChar *)utf, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033969 desret_int(ret_val);
33970 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033971 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033972 des_int(n_len, len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033973 xmlResetLastError();
33974 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033975 printf("Leak of %d blocks found in xmlUTF8Strsize",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033976 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033977 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033978 printf(" %d", n_utf);
33979 printf(" %d", n_len);
33980 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033981 }
33982 }
33983 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033984 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033985
Daniel Veillard42595322004-11-08 10:52:06 +000033986 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033987}
33988
33989
33990static int
33991test_xmlUTF8Strsub(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033992 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033993
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033994 int mem_base;
33995 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033996 xmlChar * utf; /* a sequence of UTF-8 encoded bytes */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033997 int n_utf;
33998 int start; /* relative pos of first char */
33999 int n_start;
34000 int len; /* total number to copy */
34001 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034002
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034003 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
34004 for (n_start = 0;n_start < gen_nb_int;n_start++) {
34005 for (n_len = 0;n_len < gen_nb_int;n_len++) {
34006 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034007 utf = gen_const_xmlChar_ptr(n_utf, 0);
34008 start = gen_int(n_start, 1);
34009 len = gen_int(n_len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034010
William M. Brackf13f77f2004-11-12 16:03:48 +000034011 ret_val = xmlUTF8Strsub((const xmlChar *)utf, start, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034012 desret_xmlChar_ptr(ret_val);
34013 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034014 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000034015 des_int(n_start, start, 1);
34016 des_int(n_len, len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034017 xmlResetLastError();
34018 if (mem_base != xmlMemBlocks()) {
34019 printf("Leak of %d blocks found in xmlUTF8Strsub",
34020 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034021 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034022 printf(" %d", n_utf);
34023 printf(" %d", n_start);
34024 printf(" %d", n_len);
34025 printf("\n");
34026 }
34027 }
34028 }
34029 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034030 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034031
Daniel Veillard42595322004-11-08 10:52:06 +000034032 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034033}
34034
34035static int
34036test_xmlstring(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034037 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034038
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034039 if (quiet == 0) printf("Testing xmlstring : 26 of 30 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000034040 test_ret += test_xmlCharStrdup();
34041 test_ret += test_xmlCharStrndup();
34042 test_ret += test_xmlCheckUTF8();
34043 test_ret += test_xmlGetUTF8Char();
34044 test_ret += test_xmlStrEqual();
34045 test_ret += test_xmlStrPrintf();
34046 test_ret += test_xmlStrQEqual();
34047 test_ret += test_xmlStrVPrintf();
34048 test_ret += test_xmlStrcasecmp();
34049 test_ret += test_xmlStrcasestr();
34050 test_ret += test_xmlStrchr();
34051 test_ret += test_xmlStrcmp();
34052 test_ret += test_xmlStrdup();
34053 test_ret += test_xmlStrlen();
34054 test_ret += test_xmlStrncasecmp();
34055 test_ret += test_xmlStrncatNew();
34056 test_ret += test_xmlStrncmp();
34057 test_ret += test_xmlStrndup();
34058 test_ret += test_xmlStrstr();
34059 test_ret += test_xmlStrsub();
34060 test_ret += test_xmlUTF8Charcmp();
34061 test_ret += test_xmlUTF8Size();
34062 test_ret += test_xmlUTF8Strlen();
34063 test_ret += test_xmlUTF8Strloc();
34064 test_ret += test_xmlUTF8Strndup();
34065 test_ret += test_xmlUTF8Strpos();
34066 test_ret += test_xmlUTF8Strsize();
34067 test_ret += test_xmlUTF8Strsub();
Daniel Veillardd93f6252004-11-02 15:53:51 +000034068
Daniel Veillard42595322004-11-08 10:52:06 +000034069 if (test_ret != 0)
34070 printf("Module xmlstring: %d errors\n", test_ret);
34071 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034072}
34073
34074static int
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034075test_xmlUCSIsAegeanNumbers(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034076 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034077
William M. Brack21e4ef22005-01-02 09:53:13 +000034078#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034079 int mem_base;
34080 int ret_val;
34081 int code; /* UCS code point */
34082 int n_code;
34083
34084 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34085 mem_base = xmlMemBlocks();
34086 code = gen_int(n_code, 0);
34087
34088 ret_val = xmlUCSIsAegeanNumbers(code);
34089 desret_int(ret_val);
34090 call_tests++;
34091 des_int(n_code, code, 0);
34092 xmlResetLastError();
34093 if (mem_base != xmlMemBlocks()) {
34094 printf("Leak of %d blocks found in xmlUCSIsAegeanNumbers",
34095 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034096 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034097 printf(" %d", n_code);
34098 printf("\n");
34099 }
34100 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034101 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034102#endif
34103
Daniel Veillard42595322004-11-08 10:52:06 +000034104 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034105}
34106
34107
34108static int
34109test_xmlUCSIsAlphabeticPresentationForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034110 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034111
William M. Brack21e4ef22005-01-02 09:53:13 +000034112#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034113 int mem_base;
34114 int ret_val;
34115 int code; /* UCS code point */
34116 int n_code;
34117
34118 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34119 mem_base = xmlMemBlocks();
34120 code = gen_int(n_code, 0);
34121
34122 ret_val = xmlUCSIsAlphabeticPresentationForms(code);
34123 desret_int(ret_val);
34124 call_tests++;
34125 des_int(n_code, code, 0);
34126 xmlResetLastError();
34127 if (mem_base != xmlMemBlocks()) {
34128 printf("Leak of %d blocks found in xmlUCSIsAlphabeticPresentationForms",
34129 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034130 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034131 printf(" %d", n_code);
34132 printf("\n");
34133 }
34134 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034135 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034136#endif
34137
Daniel Veillard42595322004-11-08 10:52:06 +000034138 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034139}
34140
34141
34142static int
34143test_xmlUCSIsArabic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034144 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034145
William M. Brack21e4ef22005-01-02 09:53:13 +000034146#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034147 int mem_base;
34148 int ret_val;
34149 int code; /* UCS code point */
34150 int n_code;
34151
34152 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34153 mem_base = xmlMemBlocks();
34154 code = gen_int(n_code, 0);
34155
34156 ret_val = xmlUCSIsArabic(code);
34157 desret_int(ret_val);
34158 call_tests++;
34159 des_int(n_code, code, 0);
34160 xmlResetLastError();
34161 if (mem_base != xmlMemBlocks()) {
34162 printf("Leak of %d blocks found in xmlUCSIsArabic",
34163 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034164 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034165 printf(" %d", n_code);
34166 printf("\n");
34167 }
34168 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034169 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034170#endif
34171
Daniel Veillard42595322004-11-08 10:52:06 +000034172 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034173}
34174
34175
34176static int
34177test_xmlUCSIsArabicPresentationFormsA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034178 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034179
William M. Brack21e4ef22005-01-02 09:53:13 +000034180#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034181 int mem_base;
34182 int ret_val;
34183 int code; /* UCS code point */
34184 int n_code;
34185
34186 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34187 mem_base = xmlMemBlocks();
34188 code = gen_int(n_code, 0);
34189
34190 ret_val = xmlUCSIsArabicPresentationFormsA(code);
34191 desret_int(ret_val);
34192 call_tests++;
34193 des_int(n_code, code, 0);
34194 xmlResetLastError();
34195 if (mem_base != xmlMemBlocks()) {
34196 printf("Leak of %d blocks found in xmlUCSIsArabicPresentationFormsA",
34197 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034198 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034199 printf(" %d", n_code);
34200 printf("\n");
34201 }
34202 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034203 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034204#endif
34205
Daniel Veillard42595322004-11-08 10:52:06 +000034206 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034207}
34208
34209
34210static int
34211test_xmlUCSIsArabicPresentationFormsB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034212 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034213
William M. Brack21e4ef22005-01-02 09:53:13 +000034214#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034215 int mem_base;
34216 int ret_val;
34217 int code; /* UCS code point */
34218 int n_code;
34219
34220 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34221 mem_base = xmlMemBlocks();
34222 code = gen_int(n_code, 0);
34223
34224 ret_val = xmlUCSIsArabicPresentationFormsB(code);
34225 desret_int(ret_val);
34226 call_tests++;
34227 des_int(n_code, code, 0);
34228 xmlResetLastError();
34229 if (mem_base != xmlMemBlocks()) {
34230 printf("Leak of %d blocks found in xmlUCSIsArabicPresentationFormsB",
34231 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034232 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034233 printf(" %d", n_code);
34234 printf("\n");
34235 }
34236 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034237 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034238#endif
34239
Daniel Veillard42595322004-11-08 10:52:06 +000034240 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034241}
34242
34243
34244static int
34245test_xmlUCSIsArmenian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034246 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034247
William M. Brack21e4ef22005-01-02 09:53:13 +000034248#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034249 int mem_base;
34250 int ret_val;
34251 int code; /* UCS code point */
34252 int n_code;
34253
34254 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34255 mem_base = xmlMemBlocks();
34256 code = gen_int(n_code, 0);
34257
34258 ret_val = xmlUCSIsArmenian(code);
34259 desret_int(ret_val);
34260 call_tests++;
34261 des_int(n_code, code, 0);
34262 xmlResetLastError();
34263 if (mem_base != xmlMemBlocks()) {
34264 printf("Leak of %d blocks found in xmlUCSIsArmenian",
34265 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034266 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034267 printf(" %d", n_code);
34268 printf("\n");
34269 }
34270 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034271 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034272#endif
34273
Daniel Veillard42595322004-11-08 10:52:06 +000034274 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034275}
34276
34277
34278static int
34279test_xmlUCSIsArrows(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034280 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034281
William M. Brack21e4ef22005-01-02 09:53:13 +000034282#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034283 int mem_base;
34284 int ret_val;
34285 int code; /* UCS code point */
34286 int n_code;
34287
34288 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34289 mem_base = xmlMemBlocks();
34290 code = gen_int(n_code, 0);
34291
34292 ret_val = xmlUCSIsArrows(code);
34293 desret_int(ret_val);
34294 call_tests++;
34295 des_int(n_code, code, 0);
34296 xmlResetLastError();
34297 if (mem_base != xmlMemBlocks()) {
34298 printf("Leak of %d blocks found in xmlUCSIsArrows",
34299 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034300 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034301 printf(" %d", n_code);
34302 printf("\n");
34303 }
34304 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034305 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034306#endif
34307
Daniel Veillard42595322004-11-08 10:52:06 +000034308 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034309}
34310
34311
34312static int
34313test_xmlUCSIsBasicLatin(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034314 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034315
William M. Brack21e4ef22005-01-02 09:53:13 +000034316#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034317 int mem_base;
34318 int ret_val;
34319 int code; /* UCS code point */
34320 int n_code;
34321
34322 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34323 mem_base = xmlMemBlocks();
34324 code = gen_int(n_code, 0);
34325
34326 ret_val = xmlUCSIsBasicLatin(code);
34327 desret_int(ret_val);
34328 call_tests++;
34329 des_int(n_code, code, 0);
34330 xmlResetLastError();
34331 if (mem_base != xmlMemBlocks()) {
34332 printf("Leak of %d blocks found in xmlUCSIsBasicLatin",
34333 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034334 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034335 printf(" %d", n_code);
34336 printf("\n");
34337 }
34338 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034339 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034340#endif
34341
Daniel Veillard42595322004-11-08 10:52:06 +000034342 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034343}
34344
34345
34346static int
34347test_xmlUCSIsBengali(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034348 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034349
William M. Brack21e4ef22005-01-02 09:53:13 +000034350#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034351 int mem_base;
34352 int ret_val;
34353 int code; /* UCS code point */
34354 int n_code;
34355
34356 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34357 mem_base = xmlMemBlocks();
34358 code = gen_int(n_code, 0);
34359
34360 ret_val = xmlUCSIsBengali(code);
34361 desret_int(ret_val);
34362 call_tests++;
34363 des_int(n_code, code, 0);
34364 xmlResetLastError();
34365 if (mem_base != xmlMemBlocks()) {
34366 printf("Leak of %d blocks found in xmlUCSIsBengali",
34367 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034368 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034369 printf(" %d", n_code);
34370 printf("\n");
34371 }
34372 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034373 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034374#endif
34375
Daniel Veillard42595322004-11-08 10:52:06 +000034376 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034377}
34378
34379
34380static int
34381test_xmlUCSIsBlock(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034382 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034383
William M. Brack21e4ef22005-01-02 09:53:13 +000034384#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034385 int mem_base;
34386 int ret_val;
34387 int code; /* UCS code point */
34388 int n_code;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034389 char * block; /* UCS block name */
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034390 int n_block;
34391
34392 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34393 for (n_block = 0;n_block < gen_nb_const_char_ptr;n_block++) {
34394 mem_base = xmlMemBlocks();
34395 code = gen_int(n_code, 0);
34396 block = gen_const_char_ptr(n_block, 1);
34397
William M. Brackf13f77f2004-11-12 16:03:48 +000034398 ret_val = xmlUCSIsBlock(code, (const char *)block);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034399 desret_int(ret_val);
34400 call_tests++;
34401 des_int(n_code, code, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000034402 des_const_char_ptr(n_block, (const char *)block, 1);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034403 xmlResetLastError();
34404 if (mem_base != xmlMemBlocks()) {
34405 printf("Leak of %d blocks found in xmlUCSIsBlock",
34406 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034407 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034408 printf(" %d", n_code);
34409 printf(" %d", n_block);
34410 printf("\n");
34411 }
34412 }
34413 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034414 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034415#endif
34416
Daniel Veillard42595322004-11-08 10:52:06 +000034417 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034418}
34419
34420
34421static int
34422test_xmlUCSIsBlockElements(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034423 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034424
William M. Brack21e4ef22005-01-02 09:53:13 +000034425#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034426 int mem_base;
34427 int ret_val;
34428 int code; /* UCS code point */
34429 int n_code;
34430
34431 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34432 mem_base = xmlMemBlocks();
34433 code = gen_int(n_code, 0);
34434
34435 ret_val = xmlUCSIsBlockElements(code);
34436 desret_int(ret_val);
34437 call_tests++;
34438 des_int(n_code, code, 0);
34439 xmlResetLastError();
34440 if (mem_base != xmlMemBlocks()) {
34441 printf("Leak of %d blocks found in xmlUCSIsBlockElements",
34442 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034443 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034444 printf(" %d", n_code);
34445 printf("\n");
34446 }
34447 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034448 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034449#endif
34450
Daniel Veillard42595322004-11-08 10:52:06 +000034451 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034452}
34453
34454
34455static int
34456test_xmlUCSIsBopomofo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034457 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034458
William M. Brack21e4ef22005-01-02 09:53:13 +000034459#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034460 int mem_base;
34461 int ret_val;
34462 int code; /* UCS code point */
34463 int n_code;
34464
34465 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34466 mem_base = xmlMemBlocks();
34467 code = gen_int(n_code, 0);
34468
34469 ret_val = xmlUCSIsBopomofo(code);
34470 desret_int(ret_val);
34471 call_tests++;
34472 des_int(n_code, code, 0);
34473 xmlResetLastError();
34474 if (mem_base != xmlMemBlocks()) {
34475 printf("Leak of %d blocks found in xmlUCSIsBopomofo",
34476 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034477 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034478 printf(" %d", n_code);
34479 printf("\n");
34480 }
34481 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034482 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034483#endif
34484
Daniel Veillard42595322004-11-08 10:52:06 +000034485 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034486}
34487
34488
34489static int
34490test_xmlUCSIsBopomofoExtended(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034491 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034492
William M. Brack21e4ef22005-01-02 09:53:13 +000034493#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034494 int mem_base;
34495 int ret_val;
34496 int code; /* UCS code point */
34497 int n_code;
34498
34499 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34500 mem_base = xmlMemBlocks();
34501 code = gen_int(n_code, 0);
34502
34503 ret_val = xmlUCSIsBopomofoExtended(code);
34504 desret_int(ret_val);
34505 call_tests++;
34506 des_int(n_code, code, 0);
34507 xmlResetLastError();
34508 if (mem_base != xmlMemBlocks()) {
34509 printf("Leak of %d blocks found in xmlUCSIsBopomofoExtended",
34510 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034511 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034512 printf(" %d", n_code);
34513 printf("\n");
34514 }
34515 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034516 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034517#endif
34518
Daniel Veillard42595322004-11-08 10:52:06 +000034519 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034520}
34521
34522
34523static int
34524test_xmlUCSIsBoxDrawing(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034525 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034526
William M. Brack21e4ef22005-01-02 09:53:13 +000034527#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034528 int mem_base;
34529 int ret_val;
34530 int code; /* UCS code point */
34531 int n_code;
34532
34533 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34534 mem_base = xmlMemBlocks();
34535 code = gen_int(n_code, 0);
34536
34537 ret_val = xmlUCSIsBoxDrawing(code);
34538 desret_int(ret_val);
34539 call_tests++;
34540 des_int(n_code, code, 0);
34541 xmlResetLastError();
34542 if (mem_base != xmlMemBlocks()) {
34543 printf("Leak of %d blocks found in xmlUCSIsBoxDrawing",
34544 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034545 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034546 printf(" %d", n_code);
34547 printf("\n");
34548 }
34549 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034550 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034551#endif
34552
Daniel Veillard42595322004-11-08 10:52:06 +000034553 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034554}
34555
34556
34557static int
34558test_xmlUCSIsBraillePatterns(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034559 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034560
William M. Brack21e4ef22005-01-02 09:53:13 +000034561#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034562 int mem_base;
34563 int ret_val;
34564 int code; /* UCS code point */
34565 int n_code;
34566
34567 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34568 mem_base = xmlMemBlocks();
34569 code = gen_int(n_code, 0);
34570
34571 ret_val = xmlUCSIsBraillePatterns(code);
34572 desret_int(ret_val);
34573 call_tests++;
34574 des_int(n_code, code, 0);
34575 xmlResetLastError();
34576 if (mem_base != xmlMemBlocks()) {
34577 printf("Leak of %d blocks found in xmlUCSIsBraillePatterns",
34578 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034579 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034580 printf(" %d", n_code);
34581 printf("\n");
34582 }
34583 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034584 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034585#endif
34586
Daniel Veillard42595322004-11-08 10:52:06 +000034587 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034588}
34589
34590
34591static int
34592test_xmlUCSIsBuhid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034593 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034594
William M. Brack21e4ef22005-01-02 09:53:13 +000034595#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034596 int mem_base;
34597 int ret_val;
34598 int code; /* UCS code point */
34599 int n_code;
34600
34601 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34602 mem_base = xmlMemBlocks();
34603 code = gen_int(n_code, 0);
34604
34605 ret_val = xmlUCSIsBuhid(code);
34606 desret_int(ret_val);
34607 call_tests++;
34608 des_int(n_code, code, 0);
34609 xmlResetLastError();
34610 if (mem_base != xmlMemBlocks()) {
34611 printf("Leak of %d blocks found in xmlUCSIsBuhid",
34612 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034613 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034614 printf(" %d", n_code);
34615 printf("\n");
34616 }
34617 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034618 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034619#endif
34620
Daniel Veillard42595322004-11-08 10:52:06 +000034621 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034622}
34623
34624
34625static int
34626test_xmlUCSIsByzantineMusicalSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034627 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034628
William M. Brack21e4ef22005-01-02 09:53:13 +000034629#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034630 int mem_base;
34631 int ret_val;
34632 int code; /* UCS code point */
34633 int n_code;
34634
34635 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34636 mem_base = xmlMemBlocks();
34637 code = gen_int(n_code, 0);
34638
34639 ret_val = xmlUCSIsByzantineMusicalSymbols(code);
34640 desret_int(ret_val);
34641 call_tests++;
34642 des_int(n_code, code, 0);
34643 xmlResetLastError();
34644 if (mem_base != xmlMemBlocks()) {
34645 printf("Leak of %d blocks found in xmlUCSIsByzantineMusicalSymbols",
34646 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034647 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034648 printf(" %d", n_code);
34649 printf("\n");
34650 }
34651 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034652 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034653#endif
34654
Daniel Veillard42595322004-11-08 10:52:06 +000034655 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034656}
34657
34658
34659static int
34660test_xmlUCSIsCJKCompatibility(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034661 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034662
William M. Brack21e4ef22005-01-02 09:53:13 +000034663#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034664 int mem_base;
34665 int ret_val;
34666 int code; /* UCS code point */
34667 int n_code;
34668
34669 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34670 mem_base = xmlMemBlocks();
34671 code = gen_int(n_code, 0);
34672
34673 ret_val = xmlUCSIsCJKCompatibility(code);
34674 desret_int(ret_val);
34675 call_tests++;
34676 des_int(n_code, code, 0);
34677 xmlResetLastError();
34678 if (mem_base != xmlMemBlocks()) {
34679 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibility",
34680 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034681 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034682 printf(" %d", n_code);
34683 printf("\n");
34684 }
34685 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034686 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034687#endif
34688
Daniel Veillard42595322004-11-08 10:52:06 +000034689 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034690}
34691
34692
34693static int
34694test_xmlUCSIsCJKCompatibilityForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034695 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034696
William M. Brack21e4ef22005-01-02 09:53:13 +000034697#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034698 int mem_base;
34699 int ret_val;
34700 int code; /* UCS code point */
34701 int n_code;
34702
34703 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34704 mem_base = xmlMemBlocks();
34705 code = gen_int(n_code, 0);
34706
34707 ret_val = xmlUCSIsCJKCompatibilityForms(code);
34708 desret_int(ret_val);
34709 call_tests++;
34710 des_int(n_code, code, 0);
34711 xmlResetLastError();
34712 if (mem_base != xmlMemBlocks()) {
34713 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibilityForms",
34714 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034715 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034716 printf(" %d", n_code);
34717 printf("\n");
34718 }
34719 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034720 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034721#endif
34722
Daniel Veillard42595322004-11-08 10:52:06 +000034723 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034724}
34725
34726
34727static int
34728test_xmlUCSIsCJKCompatibilityIdeographs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034729 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034730
William M. Brack21e4ef22005-01-02 09:53:13 +000034731#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034732 int mem_base;
34733 int ret_val;
34734 int code; /* UCS code point */
34735 int n_code;
34736
34737 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34738 mem_base = xmlMemBlocks();
34739 code = gen_int(n_code, 0);
34740
34741 ret_val = xmlUCSIsCJKCompatibilityIdeographs(code);
34742 desret_int(ret_val);
34743 call_tests++;
34744 des_int(n_code, code, 0);
34745 xmlResetLastError();
34746 if (mem_base != xmlMemBlocks()) {
34747 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibilityIdeographs",
34748 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034749 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034750 printf(" %d", n_code);
34751 printf("\n");
34752 }
34753 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034754 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034755#endif
34756
Daniel Veillard42595322004-11-08 10:52:06 +000034757 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034758}
34759
34760
34761static int
34762test_xmlUCSIsCJKCompatibilityIdeographsSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034763 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034764
William M. Brack21e4ef22005-01-02 09:53:13 +000034765#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034766 int mem_base;
34767 int ret_val;
34768 int code; /* UCS code point */
34769 int n_code;
34770
34771 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34772 mem_base = xmlMemBlocks();
34773 code = gen_int(n_code, 0);
34774
34775 ret_val = xmlUCSIsCJKCompatibilityIdeographsSupplement(code);
34776 desret_int(ret_val);
34777 call_tests++;
34778 des_int(n_code, code, 0);
34779 xmlResetLastError();
34780 if (mem_base != xmlMemBlocks()) {
34781 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibilityIdeographsSupplement",
34782 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034783 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034784 printf(" %d", n_code);
34785 printf("\n");
34786 }
34787 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034788 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034789#endif
34790
Daniel Veillard42595322004-11-08 10:52:06 +000034791 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034792}
34793
34794
34795static int
34796test_xmlUCSIsCJKRadicalsSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034797 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034798
William M. Brack21e4ef22005-01-02 09:53:13 +000034799#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034800 int mem_base;
34801 int ret_val;
34802 int code; /* UCS code point */
34803 int n_code;
34804
34805 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34806 mem_base = xmlMemBlocks();
34807 code = gen_int(n_code, 0);
34808
34809 ret_val = xmlUCSIsCJKRadicalsSupplement(code);
34810 desret_int(ret_val);
34811 call_tests++;
34812 des_int(n_code, code, 0);
34813 xmlResetLastError();
34814 if (mem_base != xmlMemBlocks()) {
34815 printf("Leak of %d blocks found in xmlUCSIsCJKRadicalsSupplement",
34816 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034817 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034818 printf(" %d", n_code);
34819 printf("\n");
34820 }
34821 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034822 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034823#endif
34824
Daniel Veillard42595322004-11-08 10:52:06 +000034825 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034826}
34827
34828
34829static int
34830test_xmlUCSIsCJKSymbolsandPunctuation(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034831 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034832
William M. Brack21e4ef22005-01-02 09:53:13 +000034833#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034834 int mem_base;
34835 int ret_val;
34836 int code; /* UCS code point */
34837 int n_code;
34838
34839 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34840 mem_base = xmlMemBlocks();
34841 code = gen_int(n_code, 0);
34842
34843 ret_val = xmlUCSIsCJKSymbolsandPunctuation(code);
34844 desret_int(ret_val);
34845 call_tests++;
34846 des_int(n_code, code, 0);
34847 xmlResetLastError();
34848 if (mem_base != xmlMemBlocks()) {
34849 printf("Leak of %d blocks found in xmlUCSIsCJKSymbolsandPunctuation",
34850 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034851 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034852 printf(" %d", n_code);
34853 printf("\n");
34854 }
34855 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034856 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034857#endif
34858
Daniel Veillard42595322004-11-08 10:52:06 +000034859 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034860}
34861
34862
34863static int
34864test_xmlUCSIsCJKUnifiedIdeographs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034865 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034866
William M. Brack21e4ef22005-01-02 09:53:13 +000034867#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034868 int mem_base;
34869 int ret_val;
34870 int code; /* UCS code point */
34871 int n_code;
34872
34873 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34874 mem_base = xmlMemBlocks();
34875 code = gen_int(n_code, 0);
34876
34877 ret_val = xmlUCSIsCJKUnifiedIdeographs(code);
34878 desret_int(ret_val);
34879 call_tests++;
34880 des_int(n_code, code, 0);
34881 xmlResetLastError();
34882 if (mem_base != xmlMemBlocks()) {
34883 printf("Leak of %d blocks found in xmlUCSIsCJKUnifiedIdeographs",
34884 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034885 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034886 printf(" %d", n_code);
34887 printf("\n");
34888 }
34889 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034890 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034891#endif
34892
Daniel Veillard42595322004-11-08 10:52:06 +000034893 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034894}
34895
34896
34897static int
34898test_xmlUCSIsCJKUnifiedIdeographsExtensionA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034899 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034900
William M. Brack21e4ef22005-01-02 09:53:13 +000034901#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034902 int mem_base;
34903 int ret_val;
34904 int code; /* UCS code point */
34905 int n_code;
34906
34907 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34908 mem_base = xmlMemBlocks();
34909 code = gen_int(n_code, 0);
34910
34911 ret_val = xmlUCSIsCJKUnifiedIdeographsExtensionA(code);
34912 desret_int(ret_val);
34913 call_tests++;
34914 des_int(n_code, code, 0);
34915 xmlResetLastError();
34916 if (mem_base != xmlMemBlocks()) {
34917 printf("Leak of %d blocks found in xmlUCSIsCJKUnifiedIdeographsExtensionA",
34918 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034919 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034920 printf(" %d", n_code);
34921 printf("\n");
34922 }
34923 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034924 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034925#endif
34926
Daniel Veillard42595322004-11-08 10:52:06 +000034927 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034928}
34929
34930
34931static int
34932test_xmlUCSIsCJKUnifiedIdeographsExtensionB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034933 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034934
William M. Brack21e4ef22005-01-02 09:53:13 +000034935#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034936 int mem_base;
34937 int ret_val;
34938 int code; /* UCS code point */
34939 int n_code;
34940
34941 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34942 mem_base = xmlMemBlocks();
34943 code = gen_int(n_code, 0);
34944
34945 ret_val = xmlUCSIsCJKUnifiedIdeographsExtensionB(code);
34946 desret_int(ret_val);
34947 call_tests++;
34948 des_int(n_code, code, 0);
34949 xmlResetLastError();
34950 if (mem_base != xmlMemBlocks()) {
34951 printf("Leak of %d blocks found in xmlUCSIsCJKUnifiedIdeographsExtensionB",
34952 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034953 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034954 printf(" %d", n_code);
34955 printf("\n");
34956 }
34957 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034958 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034959#endif
34960
Daniel Veillard42595322004-11-08 10:52:06 +000034961 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034962}
34963
34964
34965static int
34966test_xmlUCSIsCat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034967 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034968
William M. Brack21e4ef22005-01-02 09:53:13 +000034969#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034970 int mem_base;
34971 int ret_val;
34972 int code; /* UCS code point */
34973 int n_code;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034974 char * cat; /* UCS Category name */
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034975 int n_cat;
34976
34977 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34978 for (n_cat = 0;n_cat < gen_nb_const_char_ptr;n_cat++) {
34979 mem_base = xmlMemBlocks();
34980 code = gen_int(n_code, 0);
34981 cat = gen_const_char_ptr(n_cat, 1);
34982
William M. Brackf13f77f2004-11-12 16:03:48 +000034983 ret_val = xmlUCSIsCat(code, (const char *)cat);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034984 desret_int(ret_val);
34985 call_tests++;
34986 des_int(n_code, code, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000034987 des_const_char_ptr(n_cat, (const char *)cat, 1);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034988 xmlResetLastError();
34989 if (mem_base != xmlMemBlocks()) {
34990 printf("Leak of %d blocks found in xmlUCSIsCat",
34991 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034992 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034993 printf(" %d", n_code);
34994 printf(" %d", n_cat);
34995 printf("\n");
34996 }
34997 }
34998 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034999 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035000#endif
35001
Daniel Veillard42595322004-11-08 10:52:06 +000035002 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035003}
35004
35005
35006static int
35007test_xmlUCSIsCatC(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035008 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035009
William M. Brack21e4ef22005-01-02 09:53:13 +000035010#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035011 int mem_base;
35012 int ret_val;
35013 int code; /* UCS code point */
35014 int n_code;
35015
35016 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35017 mem_base = xmlMemBlocks();
35018 code = gen_int(n_code, 0);
35019
35020 ret_val = xmlUCSIsCatC(code);
35021 desret_int(ret_val);
35022 call_tests++;
35023 des_int(n_code, code, 0);
35024 xmlResetLastError();
35025 if (mem_base != xmlMemBlocks()) {
35026 printf("Leak of %d blocks found in xmlUCSIsCatC",
35027 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035028 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035029 printf(" %d", n_code);
35030 printf("\n");
35031 }
35032 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035033 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035034#endif
35035
Daniel Veillard42595322004-11-08 10:52:06 +000035036 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035037}
35038
35039
35040static int
35041test_xmlUCSIsCatCc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035042 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035043
William M. Brack21e4ef22005-01-02 09:53:13 +000035044#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035045 int mem_base;
35046 int ret_val;
35047 int code; /* UCS code point */
35048 int n_code;
35049
35050 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35051 mem_base = xmlMemBlocks();
35052 code = gen_int(n_code, 0);
35053
35054 ret_val = xmlUCSIsCatCc(code);
35055 desret_int(ret_val);
35056 call_tests++;
35057 des_int(n_code, code, 0);
35058 xmlResetLastError();
35059 if (mem_base != xmlMemBlocks()) {
35060 printf("Leak of %d blocks found in xmlUCSIsCatCc",
35061 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035062 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035063 printf(" %d", n_code);
35064 printf("\n");
35065 }
35066 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035067 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035068#endif
35069
Daniel Veillard42595322004-11-08 10:52:06 +000035070 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035071}
35072
35073
35074static int
35075test_xmlUCSIsCatCf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035076 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035077
William M. Brack21e4ef22005-01-02 09:53:13 +000035078#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035079 int mem_base;
35080 int ret_val;
35081 int code; /* UCS code point */
35082 int n_code;
35083
35084 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35085 mem_base = xmlMemBlocks();
35086 code = gen_int(n_code, 0);
35087
35088 ret_val = xmlUCSIsCatCf(code);
35089 desret_int(ret_val);
35090 call_tests++;
35091 des_int(n_code, code, 0);
35092 xmlResetLastError();
35093 if (mem_base != xmlMemBlocks()) {
35094 printf("Leak of %d blocks found in xmlUCSIsCatCf",
35095 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035096 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035097 printf(" %d", n_code);
35098 printf("\n");
35099 }
35100 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035101 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035102#endif
35103
Daniel Veillard42595322004-11-08 10:52:06 +000035104 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035105}
35106
35107
35108static int
35109test_xmlUCSIsCatCo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035110 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035111
William M. Brack21e4ef22005-01-02 09:53:13 +000035112#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035113 int mem_base;
35114 int ret_val;
35115 int code; /* UCS code point */
35116 int n_code;
35117
35118 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35119 mem_base = xmlMemBlocks();
35120 code = gen_int(n_code, 0);
35121
35122 ret_val = xmlUCSIsCatCo(code);
35123 desret_int(ret_val);
35124 call_tests++;
35125 des_int(n_code, code, 0);
35126 xmlResetLastError();
35127 if (mem_base != xmlMemBlocks()) {
35128 printf("Leak of %d blocks found in xmlUCSIsCatCo",
35129 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035130 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035131 printf(" %d", n_code);
35132 printf("\n");
35133 }
35134 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035135 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035136#endif
35137
Daniel Veillard42595322004-11-08 10:52:06 +000035138 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035139}
35140
35141
35142static int
35143test_xmlUCSIsCatCs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035144 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035145
William M. Brack21e4ef22005-01-02 09:53:13 +000035146#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035147 int mem_base;
35148 int ret_val;
35149 int code; /* UCS code point */
35150 int n_code;
35151
35152 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35153 mem_base = xmlMemBlocks();
35154 code = gen_int(n_code, 0);
35155
35156 ret_val = xmlUCSIsCatCs(code);
35157 desret_int(ret_val);
35158 call_tests++;
35159 des_int(n_code, code, 0);
35160 xmlResetLastError();
35161 if (mem_base != xmlMemBlocks()) {
35162 printf("Leak of %d blocks found in xmlUCSIsCatCs",
35163 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035164 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035165 printf(" %d", n_code);
35166 printf("\n");
35167 }
35168 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035169 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035170#endif
35171
Daniel Veillard42595322004-11-08 10:52:06 +000035172 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035173}
35174
35175
35176static int
35177test_xmlUCSIsCatL(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035178 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035179
William M. Brack21e4ef22005-01-02 09:53:13 +000035180#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035181 int mem_base;
35182 int ret_val;
35183 int code; /* UCS code point */
35184 int n_code;
35185
35186 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35187 mem_base = xmlMemBlocks();
35188 code = gen_int(n_code, 0);
35189
35190 ret_val = xmlUCSIsCatL(code);
35191 desret_int(ret_val);
35192 call_tests++;
35193 des_int(n_code, code, 0);
35194 xmlResetLastError();
35195 if (mem_base != xmlMemBlocks()) {
35196 printf("Leak of %d blocks found in xmlUCSIsCatL",
35197 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035198 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035199 printf(" %d", n_code);
35200 printf("\n");
35201 }
35202 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035203 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035204#endif
35205
Daniel Veillard42595322004-11-08 10:52:06 +000035206 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035207}
35208
35209
35210static int
35211test_xmlUCSIsCatLl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035212 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035213
William M. Brack21e4ef22005-01-02 09:53:13 +000035214#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035215 int mem_base;
35216 int ret_val;
35217 int code; /* UCS code point */
35218 int n_code;
35219
35220 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35221 mem_base = xmlMemBlocks();
35222 code = gen_int(n_code, 0);
35223
35224 ret_val = xmlUCSIsCatLl(code);
35225 desret_int(ret_val);
35226 call_tests++;
35227 des_int(n_code, code, 0);
35228 xmlResetLastError();
35229 if (mem_base != xmlMemBlocks()) {
35230 printf("Leak of %d blocks found in xmlUCSIsCatLl",
35231 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035232 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035233 printf(" %d", n_code);
35234 printf("\n");
35235 }
35236 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035237 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035238#endif
35239
Daniel Veillard42595322004-11-08 10:52:06 +000035240 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035241}
35242
35243
35244static int
35245test_xmlUCSIsCatLm(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035246 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035247
William M. Brack21e4ef22005-01-02 09:53:13 +000035248#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035249 int mem_base;
35250 int ret_val;
35251 int code; /* UCS code point */
35252 int n_code;
35253
35254 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35255 mem_base = xmlMemBlocks();
35256 code = gen_int(n_code, 0);
35257
35258 ret_val = xmlUCSIsCatLm(code);
35259 desret_int(ret_val);
35260 call_tests++;
35261 des_int(n_code, code, 0);
35262 xmlResetLastError();
35263 if (mem_base != xmlMemBlocks()) {
35264 printf("Leak of %d blocks found in xmlUCSIsCatLm",
35265 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035266 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035267 printf(" %d", n_code);
35268 printf("\n");
35269 }
35270 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035271 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035272#endif
35273
Daniel Veillard42595322004-11-08 10:52:06 +000035274 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035275}
35276
35277
35278static int
35279test_xmlUCSIsCatLo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035280 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035281
William M. Brack21e4ef22005-01-02 09:53:13 +000035282#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035283 int mem_base;
35284 int ret_val;
35285 int code; /* UCS code point */
35286 int n_code;
35287
35288 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35289 mem_base = xmlMemBlocks();
35290 code = gen_int(n_code, 0);
35291
35292 ret_val = xmlUCSIsCatLo(code);
35293 desret_int(ret_val);
35294 call_tests++;
35295 des_int(n_code, code, 0);
35296 xmlResetLastError();
35297 if (mem_base != xmlMemBlocks()) {
35298 printf("Leak of %d blocks found in xmlUCSIsCatLo",
35299 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035300 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035301 printf(" %d", n_code);
35302 printf("\n");
35303 }
35304 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035305 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035306#endif
35307
Daniel Veillard42595322004-11-08 10:52:06 +000035308 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035309}
35310
35311
35312static int
35313test_xmlUCSIsCatLt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035314 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035315
William M. Brack21e4ef22005-01-02 09:53:13 +000035316#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035317 int mem_base;
35318 int ret_val;
35319 int code; /* UCS code point */
35320 int n_code;
35321
35322 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35323 mem_base = xmlMemBlocks();
35324 code = gen_int(n_code, 0);
35325
35326 ret_val = xmlUCSIsCatLt(code);
35327 desret_int(ret_val);
35328 call_tests++;
35329 des_int(n_code, code, 0);
35330 xmlResetLastError();
35331 if (mem_base != xmlMemBlocks()) {
35332 printf("Leak of %d blocks found in xmlUCSIsCatLt",
35333 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035334 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035335 printf(" %d", n_code);
35336 printf("\n");
35337 }
35338 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035339 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035340#endif
35341
Daniel Veillard42595322004-11-08 10:52:06 +000035342 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035343}
35344
35345
35346static int
35347test_xmlUCSIsCatLu(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035348 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035349
William M. Brack21e4ef22005-01-02 09:53:13 +000035350#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035351 int mem_base;
35352 int ret_val;
35353 int code; /* UCS code point */
35354 int n_code;
35355
35356 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35357 mem_base = xmlMemBlocks();
35358 code = gen_int(n_code, 0);
35359
35360 ret_val = xmlUCSIsCatLu(code);
35361 desret_int(ret_val);
35362 call_tests++;
35363 des_int(n_code, code, 0);
35364 xmlResetLastError();
35365 if (mem_base != xmlMemBlocks()) {
35366 printf("Leak of %d blocks found in xmlUCSIsCatLu",
35367 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035368 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035369 printf(" %d", n_code);
35370 printf("\n");
35371 }
35372 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035373 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035374#endif
35375
Daniel Veillard42595322004-11-08 10:52:06 +000035376 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035377}
35378
35379
35380static int
35381test_xmlUCSIsCatM(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035382 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035383
William M. Brack21e4ef22005-01-02 09:53:13 +000035384#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035385 int mem_base;
35386 int ret_val;
35387 int code; /* UCS code point */
35388 int n_code;
35389
35390 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35391 mem_base = xmlMemBlocks();
35392 code = gen_int(n_code, 0);
35393
35394 ret_val = xmlUCSIsCatM(code);
35395 desret_int(ret_val);
35396 call_tests++;
35397 des_int(n_code, code, 0);
35398 xmlResetLastError();
35399 if (mem_base != xmlMemBlocks()) {
35400 printf("Leak of %d blocks found in xmlUCSIsCatM",
35401 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035402 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035403 printf(" %d", n_code);
35404 printf("\n");
35405 }
35406 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035407 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035408#endif
35409
Daniel Veillard42595322004-11-08 10:52:06 +000035410 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035411}
35412
35413
35414static int
35415test_xmlUCSIsCatMc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035416 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035417
William M. Brack21e4ef22005-01-02 09:53:13 +000035418#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035419 int mem_base;
35420 int ret_val;
35421 int code; /* UCS code point */
35422 int n_code;
35423
35424 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35425 mem_base = xmlMemBlocks();
35426 code = gen_int(n_code, 0);
35427
35428 ret_val = xmlUCSIsCatMc(code);
35429 desret_int(ret_val);
35430 call_tests++;
35431 des_int(n_code, code, 0);
35432 xmlResetLastError();
35433 if (mem_base != xmlMemBlocks()) {
35434 printf("Leak of %d blocks found in xmlUCSIsCatMc",
35435 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035436 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035437 printf(" %d", n_code);
35438 printf("\n");
35439 }
35440 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035441 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035442#endif
35443
Daniel Veillard42595322004-11-08 10:52:06 +000035444 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035445}
35446
35447
35448static int
35449test_xmlUCSIsCatMe(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035450 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035451
William M. Brack21e4ef22005-01-02 09:53:13 +000035452#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035453 int mem_base;
35454 int ret_val;
35455 int code; /* UCS code point */
35456 int n_code;
35457
35458 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35459 mem_base = xmlMemBlocks();
35460 code = gen_int(n_code, 0);
35461
35462 ret_val = xmlUCSIsCatMe(code);
35463 desret_int(ret_val);
35464 call_tests++;
35465 des_int(n_code, code, 0);
35466 xmlResetLastError();
35467 if (mem_base != xmlMemBlocks()) {
35468 printf("Leak of %d blocks found in xmlUCSIsCatMe",
35469 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035470 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035471 printf(" %d", n_code);
35472 printf("\n");
35473 }
35474 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035475 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035476#endif
35477
Daniel Veillard42595322004-11-08 10:52:06 +000035478 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035479}
35480
35481
35482static int
35483test_xmlUCSIsCatMn(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035484 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035485
William M. Brack21e4ef22005-01-02 09:53:13 +000035486#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035487 int mem_base;
35488 int ret_val;
35489 int code; /* UCS code point */
35490 int n_code;
35491
35492 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35493 mem_base = xmlMemBlocks();
35494 code = gen_int(n_code, 0);
35495
35496 ret_val = xmlUCSIsCatMn(code);
35497 desret_int(ret_val);
35498 call_tests++;
35499 des_int(n_code, code, 0);
35500 xmlResetLastError();
35501 if (mem_base != xmlMemBlocks()) {
35502 printf("Leak of %d blocks found in xmlUCSIsCatMn",
35503 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035504 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035505 printf(" %d", n_code);
35506 printf("\n");
35507 }
35508 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035509 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035510#endif
35511
Daniel Veillard42595322004-11-08 10:52:06 +000035512 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035513}
35514
35515
35516static int
35517test_xmlUCSIsCatN(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035518 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035519
William M. Brack21e4ef22005-01-02 09:53:13 +000035520#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035521 int mem_base;
35522 int ret_val;
35523 int code; /* UCS code point */
35524 int n_code;
35525
35526 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35527 mem_base = xmlMemBlocks();
35528 code = gen_int(n_code, 0);
35529
35530 ret_val = xmlUCSIsCatN(code);
35531 desret_int(ret_val);
35532 call_tests++;
35533 des_int(n_code, code, 0);
35534 xmlResetLastError();
35535 if (mem_base != xmlMemBlocks()) {
35536 printf("Leak of %d blocks found in xmlUCSIsCatN",
35537 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035538 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035539 printf(" %d", n_code);
35540 printf("\n");
35541 }
35542 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035543 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035544#endif
35545
Daniel Veillard42595322004-11-08 10:52:06 +000035546 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035547}
35548
35549
35550static int
35551test_xmlUCSIsCatNd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035552 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035553
William M. Brack21e4ef22005-01-02 09:53:13 +000035554#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035555 int mem_base;
35556 int ret_val;
35557 int code; /* UCS code point */
35558 int n_code;
35559
35560 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35561 mem_base = xmlMemBlocks();
35562 code = gen_int(n_code, 0);
35563
35564 ret_val = xmlUCSIsCatNd(code);
35565 desret_int(ret_val);
35566 call_tests++;
35567 des_int(n_code, code, 0);
35568 xmlResetLastError();
35569 if (mem_base != xmlMemBlocks()) {
35570 printf("Leak of %d blocks found in xmlUCSIsCatNd",
35571 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035572 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035573 printf(" %d", n_code);
35574 printf("\n");
35575 }
35576 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035577 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035578#endif
35579
Daniel Veillard42595322004-11-08 10:52:06 +000035580 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035581}
35582
35583
35584static int
35585test_xmlUCSIsCatNl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035586 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035587
William M. Brack21e4ef22005-01-02 09:53:13 +000035588#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035589 int mem_base;
35590 int ret_val;
35591 int code; /* UCS code point */
35592 int n_code;
35593
35594 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35595 mem_base = xmlMemBlocks();
35596 code = gen_int(n_code, 0);
35597
35598 ret_val = xmlUCSIsCatNl(code);
35599 desret_int(ret_val);
35600 call_tests++;
35601 des_int(n_code, code, 0);
35602 xmlResetLastError();
35603 if (mem_base != xmlMemBlocks()) {
35604 printf("Leak of %d blocks found in xmlUCSIsCatNl",
35605 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035606 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035607 printf(" %d", n_code);
35608 printf("\n");
35609 }
35610 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035611 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035612#endif
35613
Daniel Veillard42595322004-11-08 10:52:06 +000035614 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035615}
35616
35617
35618static int
35619test_xmlUCSIsCatNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035620 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035621
William M. Brack21e4ef22005-01-02 09:53:13 +000035622#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035623 int mem_base;
35624 int ret_val;
35625 int code; /* UCS code point */
35626 int n_code;
35627
35628 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35629 mem_base = xmlMemBlocks();
35630 code = gen_int(n_code, 0);
35631
35632 ret_val = xmlUCSIsCatNo(code);
35633 desret_int(ret_val);
35634 call_tests++;
35635 des_int(n_code, code, 0);
35636 xmlResetLastError();
35637 if (mem_base != xmlMemBlocks()) {
35638 printf("Leak of %d blocks found in xmlUCSIsCatNo",
35639 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035640 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035641 printf(" %d", n_code);
35642 printf("\n");
35643 }
35644 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035645 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035646#endif
35647
Daniel Veillard42595322004-11-08 10:52:06 +000035648 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035649}
35650
35651
35652static int
35653test_xmlUCSIsCatP(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035654 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035655
William M. Brack21e4ef22005-01-02 09:53:13 +000035656#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035657 int mem_base;
35658 int ret_val;
35659 int code; /* UCS code point */
35660 int n_code;
35661
35662 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35663 mem_base = xmlMemBlocks();
35664 code = gen_int(n_code, 0);
35665
35666 ret_val = xmlUCSIsCatP(code);
35667 desret_int(ret_val);
35668 call_tests++;
35669 des_int(n_code, code, 0);
35670 xmlResetLastError();
35671 if (mem_base != xmlMemBlocks()) {
35672 printf("Leak of %d blocks found in xmlUCSIsCatP",
35673 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035674 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035675 printf(" %d", n_code);
35676 printf("\n");
35677 }
35678 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035679 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035680#endif
35681
Daniel Veillard42595322004-11-08 10:52:06 +000035682 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035683}
35684
35685
35686static int
35687test_xmlUCSIsCatPc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035688 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035689
William M. Brack21e4ef22005-01-02 09:53:13 +000035690#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035691 int mem_base;
35692 int ret_val;
35693 int code; /* UCS code point */
35694 int n_code;
35695
35696 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35697 mem_base = xmlMemBlocks();
35698 code = gen_int(n_code, 0);
35699
35700 ret_val = xmlUCSIsCatPc(code);
35701 desret_int(ret_val);
35702 call_tests++;
35703 des_int(n_code, code, 0);
35704 xmlResetLastError();
35705 if (mem_base != xmlMemBlocks()) {
35706 printf("Leak of %d blocks found in xmlUCSIsCatPc",
35707 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035708 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035709 printf(" %d", n_code);
35710 printf("\n");
35711 }
35712 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035713 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035714#endif
35715
Daniel Veillard42595322004-11-08 10:52:06 +000035716 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035717}
35718
35719
35720static int
35721test_xmlUCSIsCatPd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035722 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035723
William M. Brack21e4ef22005-01-02 09:53:13 +000035724#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035725 int mem_base;
35726 int ret_val;
35727 int code; /* UCS code point */
35728 int n_code;
35729
35730 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35731 mem_base = xmlMemBlocks();
35732 code = gen_int(n_code, 0);
35733
35734 ret_val = xmlUCSIsCatPd(code);
35735 desret_int(ret_val);
35736 call_tests++;
35737 des_int(n_code, code, 0);
35738 xmlResetLastError();
35739 if (mem_base != xmlMemBlocks()) {
35740 printf("Leak of %d blocks found in xmlUCSIsCatPd",
35741 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035742 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035743 printf(" %d", n_code);
35744 printf("\n");
35745 }
35746 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035747 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035748#endif
35749
Daniel Veillard42595322004-11-08 10:52:06 +000035750 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035751}
35752
35753
35754static int
35755test_xmlUCSIsCatPe(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035756 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035757
William M. Brack21e4ef22005-01-02 09:53:13 +000035758#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035759 int mem_base;
35760 int ret_val;
35761 int code; /* UCS code point */
35762 int n_code;
35763
35764 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35765 mem_base = xmlMemBlocks();
35766 code = gen_int(n_code, 0);
35767
35768 ret_val = xmlUCSIsCatPe(code);
35769 desret_int(ret_val);
35770 call_tests++;
35771 des_int(n_code, code, 0);
35772 xmlResetLastError();
35773 if (mem_base != xmlMemBlocks()) {
35774 printf("Leak of %d blocks found in xmlUCSIsCatPe",
35775 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035776 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035777 printf(" %d", n_code);
35778 printf("\n");
35779 }
35780 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035781 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035782#endif
35783
Daniel Veillard42595322004-11-08 10:52:06 +000035784 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035785}
35786
35787
35788static int
35789test_xmlUCSIsCatPf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035790 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035791
William M. Brack21e4ef22005-01-02 09:53:13 +000035792#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035793 int mem_base;
35794 int ret_val;
35795 int code; /* UCS code point */
35796 int n_code;
35797
35798 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35799 mem_base = xmlMemBlocks();
35800 code = gen_int(n_code, 0);
35801
35802 ret_val = xmlUCSIsCatPf(code);
35803 desret_int(ret_val);
35804 call_tests++;
35805 des_int(n_code, code, 0);
35806 xmlResetLastError();
35807 if (mem_base != xmlMemBlocks()) {
35808 printf("Leak of %d blocks found in xmlUCSIsCatPf",
35809 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035810 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035811 printf(" %d", n_code);
35812 printf("\n");
35813 }
35814 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035815 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035816#endif
35817
Daniel Veillard42595322004-11-08 10:52:06 +000035818 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035819}
35820
35821
35822static int
35823test_xmlUCSIsCatPi(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035824 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035825
William M. Brack21e4ef22005-01-02 09:53:13 +000035826#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035827 int mem_base;
35828 int ret_val;
35829 int code; /* UCS code point */
35830 int n_code;
35831
35832 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35833 mem_base = xmlMemBlocks();
35834 code = gen_int(n_code, 0);
35835
35836 ret_val = xmlUCSIsCatPi(code);
35837 desret_int(ret_val);
35838 call_tests++;
35839 des_int(n_code, code, 0);
35840 xmlResetLastError();
35841 if (mem_base != xmlMemBlocks()) {
35842 printf("Leak of %d blocks found in xmlUCSIsCatPi",
35843 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035844 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035845 printf(" %d", n_code);
35846 printf("\n");
35847 }
35848 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035849 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035850#endif
35851
Daniel Veillard42595322004-11-08 10:52:06 +000035852 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035853}
35854
35855
35856static int
35857test_xmlUCSIsCatPo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035858 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035859
William M. Brack21e4ef22005-01-02 09:53:13 +000035860#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035861 int mem_base;
35862 int ret_val;
35863 int code; /* UCS code point */
35864 int n_code;
35865
35866 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35867 mem_base = xmlMemBlocks();
35868 code = gen_int(n_code, 0);
35869
35870 ret_val = xmlUCSIsCatPo(code);
35871 desret_int(ret_val);
35872 call_tests++;
35873 des_int(n_code, code, 0);
35874 xmlResetLastError();
35875 if (mem_base != xmlMemBlocks()) {
35876 printf("Leak of %d blocks found in xmlUCSIsCatPo",
35877 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035878 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035879 printf(" %d", n_code);
35880 printf("\n");
35881 }
35882 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035883 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035884#endif
35885
Daniel Veillard42595322004-11-08 10:52:06 +000035886 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035887}
35888
35889
35890static int
35891test_xmlUCSIsCatPs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035892 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035893
William M. Brack21e4ef22005-01-02 09:53:13 +000035894#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035895 int mem_base;
35896 int ret_val;
35897 int code; /* UCS code point */
35898 int n_code;
35899
35900 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35901 mem_base = xmlMemBlocks();
35902 code = gen_int(n_code, 0);
35903
35904 ret_val = xmlUCSIsCatPs(code);
35905 desret_int(ret_val);
35906 call_tests++;
35907 des_int(n_code, code, 0);
35908 xmlResetLastError();
35909 if (mem_base != xmlMemBlocks()) {
35910 printf("Leak of %d blocks found in xmlUCSIsCatPs",
35911 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035912 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035913 printf(" %d", n_code);
35914 printf("\n");
35915 }
35916 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035917 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035918#endif
35919
Daniel Veillard42595322004-11-08 10:52:06 +000035920 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035921}
35922
35923
35924static int
35925test_xmlUCSIsCatS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035926 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035927
William M. Brack21e4ef22005-01-02 09:53:13 +000035928#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035929 int mem_base;
35930 int ret_val;
35931 int code; /* UCS code point */
35932 int n_code;
35933
35934 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35935 mem_base = xmlMemBlocks();
35936 code = gen_int(n_code, 0);
35937
35938 ret_val = xmlUCSIsCatS(code);
35939 desret_int(ret_val);
35940 call_tests++;
35941 des_int(n_code, code, 0);
35942 xmlResetLastError();
35943 if (mem_base != xmlMemBlocks()) {
35944 printf("Leak of %d blocks found in xmlUCSIsCatS",
35945 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035946 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035947 printf(" %d", n_code);
35948 printf("\n");
35949 }
35950 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035951 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035952#endif
35953
Daniel Veillard42595322004-11-08 10:52:06 +000035954 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035955}
35956
35957
35958static int
35959test_xmlUCSIsCatSc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035960 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035961
William M. Brack21e4ef22005-01-02 09:53:13 +000035962#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035963 int mem_base;
35964 int ret_val;
35965 int code; /* UCS code point */
35966 int n_code;
35967
35968 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35969 mem_base = xmlMemBlocks();
35970 code = gen_int(n_code, 0);
35971
35972 ret_val = xmlUCSIsCatSc(code);
35973 desret_int(ret_val);
35974 call_tests++;
35975 des_int(n_code, code, 0);
35976 xmlResetLastError();
35977 if (mem_base != xmlMemBlocks()) {
35978 printf("Leak of %d blocks found in xmlUCSIsCatSc",
35979 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035980 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035981 printf(" %d", n_code);
35982 printf("\n");
35983 }
35984 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035985 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035986#endif
35987
Daniel Veillard42595322004-11-08 10:52:06 +000035988 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035989}
35990
35991
35992static int
35993test_xmlUCSIsCatSk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035994 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035995
William M. Brack21e4ef22005-01-02 09:53:13 +000035996#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035997 int mem_base;
35998 int ret_val;
35999 int code; /* UCS code point */
36000 int n_code;
36001
36002 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36003 mem_base = xmlMemBlocks();
36004 code = gen_int(n_code, 0);
36005
36006 ret_val = xmlUCSIsCatSk(code);
36007 desret_int(ret_val);
36008 call_tests++;
36009 des_int(n_code, code, 0);
36010 xmlResetLastError();
36011 if (mem_base != xmlMemBlocks()) {
36012 printf("Leak of %d blocks found in xmlUCSIsCatSk",
36013 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036014 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036015 printf(" %d", n_code);
36016 printf("\n");
36017 }
36018 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036019 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036020#endif
36021
Daniel Veillard42595322004-11-08 10:52:06 +000036022 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036023}
36024
36025
36026static int
36027test_xmlUCSIsCatSm(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036028 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036029
William M. Brack21e4ef22005-01-02 09:53:13 +000036030#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036031 int mem_base;
36032 int ret_val;
36033 int code; /* UCS code point */
36034 int n_code;
36035
36036 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36037 mem_base = xmlMemBlocks();
36038 code = gen_int(n_code, 0);
36039
36040 ret_val = xmlUCSIsCatSm(code);
36041 desret_int(ret_val);
36042 call_tests++;
36043 des_int(n_code, code, 0);
36044 xmlResetLastError();
36045 if (mem_base != xmlMemBlocks()) {
36046 printf("Leak of %d blocks found in xmlUCSIsCatSm",
36047 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036048 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036049 printf(" %d", n_code);
36050 printf("\n");
36051 }
36052 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036053 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036054#endif
36055
Daniel Veillard42595322004-11-08 10:52:06 +000036056 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036057}
36058
36059
36060static int
36061test_xmlUCSIsCatSo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036062 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036063
William M. Brack21e4ef22005-01-02 09:53:13 +000036064#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036065 int mem_base;
36066 int ret_val;
36067 int code; /* UCS code point */
36068 int n_code;
36069
36070 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36071 mem_base = xmlMemBlocks();
36072 code = gen_int(n_code, 0);
36073
36074 ret_val = xmlUCSIsCatSo(code);
36075 desret_int(ret_val);
36076 call_tests++;
36077 des_int(n_code, code, 0);
36078 xmlResetLastError();
36079 if (mem_base != xmlMemBlocks()) {
36080 printf("Leak of %d blocks found in xmlUCSIsCatSo",
36081 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036082 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036083 printf(" %d", n_code);
36084 printf("\n");
36085 }
36086 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036087 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036088#endif
36089
Daniel Veillard42595322004-11-08 10:52:06 +000036090 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036091}
36092
36093
36094static int
36095test_xmlUCSIsCatZ(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036096 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036097
William M. Brack21e4ef22005-01-02 09:53:13 +000036098#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036099 int mem_base;
36100 int ret_val;
36101 int code; /* UCS code point */
36102 int n_code;
36103
36104 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36105 mem_base = xmlMemBlocks();
36106 code = gen_int(n_code, 0);
36107
36108 ret_val = xmlUCSIsCatZ(code);
36109 desret_int(ret_val);
36110 call_tests++;
36111 des_int(n_code, code, 0);
36112 xmlResetLastError();
36113 if (mem_base != xmlMemBlocks()) {
36114 printf("Leak of %d blocks found in xmlUCSIsCatZ",
36115 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036116 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036117 printf(" %d", n_code);
36118 printf("\n");
36119 }
36120 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036121 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036122#endif
36123
Daniel Veillard42595322004-11-08 10:52:06 +000036124 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036125}
36126
36127
36128static int
36129test_xmlUCSIsCatZl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036130 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036131
William M. Brack21e4ef22005-01-02 09:53:13 +000036132#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036133 int mem_base;
36134 int ret_val;
36135 int code; /* UCS code point */
36136 int n_code;
36137
36138 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36139 mem_base = xmlMemBlocks();
36140 code = gen_int(n_code, 0);
36141
36142 ret_val = xmlUCSIsCatZl(code);
36143 desret_int(ret_val);
36144 call_tests++;
36145 des_int(n_code, code, 0);
36146 xmlResetLastError();
36147 if (mem_base != xmlMemBlocks()) {
36148 printf("Leak of %d blocks found in xmlUCSIsCatZl",
36149 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036150 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036151 printf(" %d", n_code);
36152 printf("\n");
36153 }
36154 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036155 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036156#endif
36157
Daniel Veillard42595322004-11-08 10:52:06 +000036158 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036159}
36160
36161
36162static int
36163test_xmlUCSIsCatZp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036164 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036165
William M. Brack21e4ef22005-01-02 09:53:13 +000036166#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036167 int mem_base;
36168 int ret_val;
36169 int code; /* UCS code point */
36170 int n_code;
36171
36172 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36173 mem_base = xmlMemBlocks();
36174 code = gen_int(n_code, 0);
36175
36176 ret_val = xmlUCSIsCatZp(code);
36177 desret_int(ret_val);
36178 call_tests++;
36179 des_int(n_code, code, 0);
36180 xmlResetLastError();
36181 if (mem_base != xmlMemBlocks()) {
36182 printf("Leak of %d blocks found in xmlUCSIsCatZp",
36183 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036184 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036185 printf(" %d", n_code);
36186 printf("\n");
36187 }
36188 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036189 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036190#endif
36191
Daniel Veillard42595322004-11-08 10:52:06 +000036192 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036193}
36194
36195
36196static int
36197test_xmlUCSIsCatZs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036198 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036199
William M. Brack21e4ef22005-01-02 09:53:13 +000036200#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036201 int mem_base;
36202 int ret_val;
36203 int code; /* UCS code point */
36204 int n_code;
36205
36206 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36207 mem_base = xmlMemBlocks();
36208 code = gen_int(n_code, 0);
36209
36210 ret_val = xmlUCSIsCatZs(code);
36211 desret_int(ret_val);
36212 call_tests++;
36213 des_int(n_code, code, 0);
36214 xmlResetLastError();
36215 if (mem_base != xmlMemBlocks()) {
36216 printf("Leak of %d blocks found in xmlUCSIsCatZs",
36217 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036218 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036219 printf(" %d", n_code);
36220 printf("\n");
36221 }
36222 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036223 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036224#endif
36225
Daniel Veillard42595322004-11-08 10:52:06 +000036226 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036227}
36228
36229
36230static int
36231test_xmlUCSIsCherokee(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036232 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036233
William M. Brack21e4ef22005-01-02 09:53:13 +000036234#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036235 int mem_base;
36236 int ret_val;
36237 int code; /* UCS code point */
36238 int n_code;
36239
36240 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36241 mem_base = xmlMemBlocks();
36242 code = gen_int(n_code, 0);
36243
36244 ret_val = xmlUCSIsCherokee(code);
36245 desret_int(ret_val);
36246 call_tests++;
36247 des_int(n_code, code, 0);
36248 xmlResetLastError();
36249 if (mem_base != xmlMemBlocks()) {
36250 printf("Leak of %d blocks found in xmlUCSIsCherokee",
36251 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036252 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036253 printf(" %d", n_code);
36254 printf("\n");
36255 }
36256 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036257 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036258#endif
36259
Daniel Veillard42595322004-11-08 10:52:06 +000036260 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036261}
36262
36263
36264static int
36265test_xmlUCSIsCombiningDiacriticalMarks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036266 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036267
William M. Brack21e4ef22005-01-02 09:53:13 +000036268#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036269 int mem_base;
36270 int ret_val;
36271 int code; /* UCS code point */
36272 int n_code;
36273
36274 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36275 mem_base = xmlMemBlocks();
36276 code = gen_int(n_code, 0);
36277
36278 ret_val = xmlUCSIsCombiningDiacriticalMarks(code);
36279 desret_int(ret_val);
36280 call_tests++;
36281 des_int(n_code, code, 0);
36282 xmlResetLastError();
36283 if (mem_base != xmlMemBlocks()) {
36284 printf("Leak of %d blocks found in xmlUCSIsCombiningDiacriticalMarks",
36285 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036286 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036287 printf(" %d", n_code);
36288 printf("\n");
36289 }
36290 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036291 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036292#endif
36293
Daniel Veillard42595322004-11-08 10:52:06 +000036294 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036295}
36296
36297
36298static int
36299test_xmlUCSIsCombiningDiacriticalMarksforSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036300 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036301
William M. Brack21e4ef22005-01-02 09:53:13 +000036302#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036303 int mem_base;
36304 int ret_val;
36305 int code; /* UCS code point */
36306 int n_code;
36307
36308 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36309 mem_base = xmlMemBlocks();
36310 code = gen_int(n_code, 0);
36311
36312 ret_val = xmlUCSIsCombiningDiacriticalMarksforSymbols(code);
36313 desret_int(ret_val);
36314 call_tests++;
36315 des_int(n_code, code, 0);
36316 xmlResetLastError();
36317 if (mem_base != xmlMemBlocks()) {
36318 printf("Leak of %d blocks found in xmlUCSIsCombiningDiacriticalMarksforSymbols",
36319 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036320 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036321 printf(" %d", n_code);
36322 printf("\n");
36323 }
36324 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036325 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036326#endif
36327
Daniel Veillard42595322004-11-08 10:52:06 +000036328 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036329}
36330
36331
36332static int
36333test_xmlUCSIsCombiningHalfMarks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036334 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036335
William M. Brack21e4ef22005-01-02 09:53:13 +000036336#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036337 int mem_base;
36338 int ret_val;
36339 int code; /* UCS code point */
36340 int n_code;
36341
36342 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36343 mem_base = xmlMemBlocks();
36344 code = gen_int(n_code, 0);
36345
36346 ret_val = xmlUCSIsCombiningHalfMarks(code);
36347 desret_int(ret_val);
36348 call_tests++;
36349 des_int(n_code, code, 0);
36350 xmlResetLastError();
36351 if (mem_base != xmlMemBlocks()) {
36352 printf("Leak of %d blocks found in xmlUCSIsCombiningHalfMarks",
36353 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036354 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036355 printf(" %d", n_code);
36356 printf("\n");
36357 }
36358 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036359 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036360#endif
36361
Daniel Veillard42595322004-11-08 10:52:06 +000036362 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036363}
36364
36365
36366static int
36367test_xmlUCSIsCombiningMarksforSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036368 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036369
William M. Brack21e4ef22005-01-02 09:53:13 +000036370#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036371 int mem_base;
36372 int ret_val;
36373 int code; /* UCS code point */
36374 int n_code;
36375
36376 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36377 mem_base = xmlMemBlocks();
36378 code = gen_int(n_code, 0);
36379
36380 ret_val = xmlUCSIsCombiningMarksforSymbols(code);
36381 desret_int(ret_val);
36382 call_tests++;
36383 des_int(n_code, code, 0);
36384 xmlResetLastError();
36385 if (mem_base != xmlMemBlocks()) {
36386 printf("Leak of %d blocks found in xmlUCSIsCombiningMarksforSymbols",
36387 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036388 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036389 printf(" %d", n_code);
36390 printf("\n");
36391 }
36392 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036393 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036394#endif
36395
Daniel Veillard42595322004-11-08 10:52:06 +000036396 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036397}
36398
36399
36400static int
36401test_xmlUCSIsControlPictures(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036402 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036403
William M. Brack21e4ef22005-01-02 09:53:13 +000036404#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036405 int mem_base;
36406 int ret_val;
36407 int code; /* UCS code point */
36408 int n_code;
36409
36410 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36411 mem_base = xmlMemBlocks();
36412 code = gen_int(n_code, 0);
36413
36414 ret_val = xmlUCSIsControlPictures(code);
36415 desret_int(ret_val);
36416 call_tests++;
36417 des_int(n_code, code, 0);
36418 xmlResetLastError();
36419 if (mem_base != xmlMemBlocks()) {
36420 printf("Leak of %d blocks found in xmlUCSIsControlPictures",
36421 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036422 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036423 printf(" %d", n_code);
36424 printf("\n");
36425 }
36426 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036427 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036428#endif
36429
Daniel Veillard42595322004-11-08 10:52:06 +000036430 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036431}
36432
36433
36434static int
36435test_xmlUCSIsCurrencySymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036436 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036437
William M. Brack21e4ef22005-01-02 09:53:13 +000036438#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036439 int mem_base;
36440 int ret_val;
36441 int code; /* UCS code point */
36442 int n_code;
36443
36444 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36445 mem_base = xmlMemBlocks();
36446 code = gen_int(n_code, 0);
36447
36448 ret_val = xmlUCSIsCurrencySymbols(code);
36449 desret_int(ret_val);
36450 call_tests++;
36451 des_int(n_code, code, 0);
36452 xmlResetLastError();
36453 if (mem_base != xmlMemBlocks()) {
36454 printf("Leak of %d blocks found in xmlUCSIsCurrencySymbols",
36455 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036456 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036457 printf(" %d", n_code);
36458 printf("\n");
36459 }
36460 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036461 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036462#endif
36463
Daniel Veillard42595322004-11-08 10:52:06 +000036464 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036465}
36466
36467
36468static int
36469test_xmlUCSIsCypriotSyllabary(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036470 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036471
William M. Brack21e4ef22005-01-02 09:53:13 +000036472#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036473 int mem_base;
36474 int ret_val;
36475 int code; /* UCS code point */
36476 int n_code;
36477
36478 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36479 mem_base = xmlMemBlocks();
36480 code = gen_int(n_code, 0);
36481
36482 ret_val = xmlUCSIsCypriotSyllabary(code);
36483 desret_int(ret_val);
36484 call_tests++;
36485 des_int(n_code, code, 0);
36486 xmlResetLastError();
36487 if (mem_base != xmlMemBlocks()) {
36488 printf("Leak of %d blocks found in xmlUCSIsCypriotSyllabary",
36489 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036490 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036491 printf(" %d", n_code);
36492 printf("\n");
36493 }
36494 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036495 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036496#endif
36497
Daniel Veillard42595322004-11-08 10:52:06 +000036498 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036499}
36500
36501
36502static int
36503test_xmlUCSIsCyrillic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036504 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036505
William M. Brack21e4ef22005-01-02 09:53:13 +000036506#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036507 int mem_base;
36508 int ret_val;
36509 int code; /* UCS code point */
36510 int n_code;
36511
36512 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36513 mem_base = xmlMemBlocks();
36514 code = gen_int(n_code, 0);
36515
36516 ret_val = xmlUCSIsCyrillic(code);
36517 desret_int(ret_val);
36518 call_tests++;
36519 des_int(n_code, code, 0);
36520 xmlResetLastError();
36521 if (mem_base != xmlMemBlocks()) {
36522 printf("Leak of %d blocks found in xmlUCSIsCyrillic",
36523 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036524 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036525 printf(" %d", n_code);
36526 printf("\n");
36527 }
36528 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036529 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036530#endif
36531
Daniel Veillard42595322004-11-08 10:52:06 +000036532 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036533}
36534
36535
36536static int
36537test_xmlUCSIsCyrillicSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036538 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036539
William M. Brack21e4ef22005-01-02 09:53:13 +000036540#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036541 int mem_base;
36542 int ret_val;
36543 int code; /* UCS code point */
36544 int n_code;
36545
36546 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36547 mem_base = xmlMemBlocks();
36548 code = gen_int(n_code, 0);
36549
36550 ret_val = xmlUCSIsCyrillicSupplement(code);
36551 desret_int(ret_val);
36552 call_tests++;
36553 des_int(n_code, code, 0);
36554 xmlResetLastError();
36555 if (mem_base != xmlMemBlocks()) {
36556 printf("Leak of %d blocks found in xmlUCSIsCyrillicSupplement",
36557 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036558 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036559 printf(" %d", n_code);
36560 printf("\n");
36561 }
36562 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036563 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036564#endif
36565
Daniel Veillard42595322004-11-08 10:52:06 +000036566 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036567}
36568
36569
36570static int
36571test_xmlUCSIsDeseret(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036572 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036573
William M. Brack21e4ef22005-01-02 09:53:13 +000036574#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036575 int mem_base;
36576 int ret_val;
36577 int code; /* UCS code point */
36578 int n_code;
36579
36580 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36581 mem_base = xmlMemBlocks();
36582 code = gen_int(n_code, 0);
36583
36584 ret_val = xmlUCSIsDeseret(code);
36585 desret_int(ret_val);
36586 call_tests++;
36587 des_int(n_code, code, 0);
36588 xmlResetLastError();
36589 if (mem_base != xmlMemBlocks()) {
36590 printf("Leak of %d blocks found in xmlUCSIsDeseret",
36591 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036592 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036593 printf(" %d", n_code);
36594 printf("\n");
36595 }
36596 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036597 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036598#endif
36599
Daniel Veillard42595322004-11-08 10:52:06 +000036600 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036601}
36602
36603
36604static int
36605test_xmlUCSIsDevanagari(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036606 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036607
William M. Brack21e4ef22005-01-02 09:53:13 +000036608#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036609 int mem_base;
36610 int ret_val;
36611 int code; /* UCS code point */
36612 int n_code;
36613
36614 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36615 mem_base = xmlMemBlocks();
36616 code = gen_int(n_code, 0);
36617
36618 ret_val = xmlUCSIsDevanagari(code);
36619 desret_int(ret_val);
36620 call_tests++;
36621 des_int(n_code, code, 0);
36622 xmlResetLastError();
36623 if (mem_base != xmlMemBlocks()) {
36624 printf("Leak of %d blocks found in xmlUCSIsDevanagari",
36625 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036626 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036627 printf(" %d", n_code);
36628 printf("\n");
36629 }
36630 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036631 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036632#endif
36633
Daniel Veillard42595322004-11-08 10:52:06 +000036634 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036635}
36636
36637
36638static int
36639test_xmlUCSIsDingbats(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036640 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036641
William M. Brack21e4ef22005-01-02 09:53:13 +000036642#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036643 int mem_base;
36644 int ret_val;
36645 int code; /* UCS code point */
36646 int n_code;
36647
36648 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36649 mem_base = xmlMemBlocks();
36650 code = gen_int(n_code, 0);
36651
36652 ret_val = xmlUCSIsDingbats(code);
36653 desret_int(ret_val);
36654 call_tests++;
36655 des_int(n_code, code, 0);
36656 xmlResetLastError();
36657 if (mem_base != xmlMemBlocks()) {
36658 printf("Leak of %d blocks found in xmlUCSIsDingbats",
36659 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036660 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036661 printf(" %d", n_code);
36662 printf("\n");
36663 }
36664 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036665 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036666#endif
36667
Daniel Veillard42595322004-11-08 10:52:06 +000036668 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036669}
36670
36671
36672static int
36673test_xmlUCSIsEnclosedAlphanumerics(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036674 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036675
William M. Brack21e4ef22005-01-02 09:53:13 +000036676#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036677 int mem_base;
36678 int ret_val;
36679 int code; /* UCS code point */
36680 int n_code;
36681
36682 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36683 mem_base = xmlMemBlocks();
36684 code = gen_int(n_code, 0);
36685
36686 ret_val = xmlUCSIsEnclosedAlphanumerics(code);
36687 desret_int(ret_val);
36688 call_tests++;
36689 des_int(n_code, code, 0);
36690 xmlResetLastError();
36691 if (mem_base != xmlMemBlocks()) {
36692 printf("Leak of %d blocks found in xmlUCSIsEnclosedAlphanumerics",
36693 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036694 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036695 printf(" %d", n_code);
36696 printf("\n");
36697 }
36698 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036699 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036700#endif
36701
Daniel Veillard42595322004-11-08 10:52:06 +000036702 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036703}
36704
36705
36706static int
36707test_xmlUCSIsEnclosedCJKLettersandMonths(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036708 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036709
William M. Brack21e4ef22005-01-02 09:53:13 +000036710#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036711 int mem_base;
36712 int ret_val;
36713 int code; /* UCS code point */
36714 int n_code;
36715
36716 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36717 mem_base = xmlMemBlocks();
36718 code = gen_int(n_code, 0);
36719
36720 ret_val = xmlUCSIsEnclosedCJKLettersandMonths(code);
36721 desret_int(ret_val);
36722 call_tests++;
36723 des_int(n_code, code, 0);
36724 xmlResetLastError();
36725 if (mem_base != xmlMemBlocks()) {
36726 printf("Leak of %d blocks found in xmlUCSIsEnclosedCJKLettersandMonths",
36727 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036728 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036729 printf(" %d", n_code);
36730 printf("\n");
36731 }
36732 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036733 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036734#endif
36735
Daniel Veillard42595322004-11-08 10:52:06 +000036736 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036737}
36738
36739
36740static int
36741test_xmlUCSIsEthiopic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036742 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036743
William M. Brack21e4ef22005-01-02 09:53:13 +000036744#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036745 int mem_base;
36746 int ret_val;
36747 int code; /* UCS code point */
36748 int n_code;
36749
36750 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36751 mem_base = xmlMemBlocks();
36752 code = gen_int(n_code, 0);
36753
36754 ret_val = xmlUCSIsEthiopic(code);
36755 desret_int(ret_val);
36756 call_tests++;
36757 des_int(n_code, code, 0);
36758 xmlResetLastError();
36759 if (mem_base != xmlMemBlocks()) {
36760 printf("Leak of %d blocks found in xmlUCSIsEthiopic",
36761 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036762 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036763 printf(" %d", n_code);
36764 printf("\n");
36765 }
36766 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036767 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036768#endif
36769
Daniel Veillard42595322004-11-08 10:52:06 +000036770 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036771}
36772
36773
36774static int
36775test_xmlUCSIsGeneralPunctuation(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036776 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036777
William M. Brack21e4ef22005-01-02 09:53:13 +000036778#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036779 int mem_base;
36780 int ret_val;
36781 int code; /* UCS code point */
36782 int n_code;
36783
36784 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36785 mem_base = xmlMemBlocks();
36786 code = gen_int(n_code, 0);
36787
36788 ret_val = xmlUCSIsGeneralPunctuation(code);
36789 desret_int(ret_val);
36790 call_tests++;
36791 des_int(n_code, code, 0);
36792 xmlResetLastError();
36793 if (mem_base != xmlMemBlocks()) {
36794 printf("Leak of %d blocks found in xmlUCSIsGeneralPunctuation",
36795 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036796 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036797 printf(" %d", n_code);
36798 printf("\n");
36799 }
36800 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036801 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036802#endif
36803
Daniel Veillard42595322004-11-08 10:52:06 +000036804 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036805}
36806
36807
36808static int
36809test_xmlUCSIsGeometricShapes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036810 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036811
William M. Brack21e4ef22005-01-02 09:53:13 +000036812#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036813 int mem_base;
36814 int ret_val;
36815 int code; /* UCS code point */
36816 int n_code;
36817
36818 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36819 mem_base = xmlMemBlocks();
36820 code = gen_int(n_code, 0);
36821
36822 ret_val = xmlUCSIsGeometricShapes(code);
36823 desret_int(ret_val);
36824 call_tests++;
36825 des_int(n_code, code, 0);
36826 xmlResetLastError();
36827 if (mem_base != xmlMemBlocks()) {
36828 printf("Leak of %d blocks found in xmlUCSIsGeometricShapes",
36829 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036830 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036831 printf(" %d", n_code);
36832 printf("\n");
36833 }
36834 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036835 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036836#endif
36837
Daniel Veillard42595322004-11-08 10:52:06 +000036838 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036839}
36840
36841
36842static int
36843test_xmlUCSIsGeorgian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036844 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036845
William M. Brack21e4ef22005-01-02 09:53:13 +000036846#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036847 int mem_base;
36848 int ret_val;
36849 int code; /* UCS code point */
36850 int n_code;
36851
36852 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36853 mem_base = xmlMemBlocks();
36854 code = gen_int(n_code, 0);
36855
36856 ret_val = xmlUCSIsGeorgian(code);
36857 desret_int(ret_val);
36858 call_tests++;
36859 des_int(n_code, code, 0);
36860 xmlResetLastError();
36861 if (mem_base != xmlMemBlocks()) {
36862 printf("Leak of %d blocks found in xmlUCSIsGeorgian",
36863 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036864 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036865 printf(" %d", n_code);
36866 printf("\n");
36867 }
36868 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036869 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036870#endif
36871
Daniel Veillard42595322004-11-08 10:52:06 +000036872 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036873}
36874
36875
36876static int
36877test_xmlUCSIsGothic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036878 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036879
William M. Brack21e4ef22005-01-02 09:53:13 +000036880#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036881 int mem_base;
36882 int ret_val;
36883 int code; /* UCS code point */
36884 int n_code;
36885
36886 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36887 mem_base = xmlMemBlocks();
36888 code = gen_int(n_code, 0);
36889
36890 ret_val = xmlUCSIsGothic(code);
36891 desret_int(ret_val);
36892 call_tests++;
36893 des_int(n_code, code, 0);
36894 xmlResetLastError();
36895 if (mem_base != xmlMemBlocks()) {
36896 printf("Leak of %d blocks found in xmlUCSIsGothic",
36897 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036898 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036899 printf(" %d", n_code);
36900 printf("\n");
36901 }
36902 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036903 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036904#endif
36905
Daniel Veillard42595322004-11-08 10:52:06 +000036906 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036907}
36908
36909
36910static int
36911test_xmlUCSIsGreek(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036912 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036913
William M. Brack21e4ef22005-01-02 09:53:13 +000036914#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036915 int mem_base;
36916 int ret_val;
36917 int code; /* UCS code point */
36918 int n_code;
36919
36920 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36921 mem_base = xmlMemBlocks();
36922 code = gen_int(n_code, 0);
36923
36924 ret_val = xmlUCSIsGreek(code);
36925 desret_int(ret_val);
36926 call_tests++;
36927 des_int(n_code, code, 0);
36928 xmlResetLastError();
36929 if (mem_base != xmlMemBlocks()) {
36930 printf("Leak of %d blocks found in xmlUCSIsGreek",
36931 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036932 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036933 printf(" %d", n_code);
36934 printf("\n");
36935 }
36936 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036937 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036938#endif
36939
Daniel Veillard42595322004-11-08 10:52:06 +000036940 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036941}
36942
36943
36944static int
36945test_xmlUCSIsGreekExtended(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036946 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036947
William M. Brack21e4ef22005-01-02 09:53:13 +000036948#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036949 int mem_base;
36950 int ret_val;
36951 int code; /* UCS code point */
36952 int n_code;
36953
36954 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36955 mem_base = xmlMemBlocks();
36956 code = gen_int(n_code, 0);
36957
36958 ret_val = xmlUCSIsGreekExtended(code);
36959 desret_int(ret_val);
36960 call_tests++;
36961 des_int(n_code, code, 0);
36962 xmlResetLastError();
36963 if (mem_base != xmlMemBlocks()) {
36964 printf("Leak of %d blocks found in xmlUCSIsGreekExtended",
36965 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036966 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036967 printf(" %d", n_code);
36968 printf("\n");
36969 }
36970 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036971 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036972#endif
36973
Daniel Veillard42595322004-11-08 10:52:06 +000036974 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036975}
36976
36977
36978static int
36979test_xmlUCSIsGreekandCoptic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036980 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036981
William M. Brack21e4ef22005-01-02 09:53:13 +000036982#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036983 int mem_base;
36984 int ret_val;
36985 int code; /* UCS code point */
36986 int n_code;
36987
36988 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36989 mem_base = xmlMemBlocks();
36990 code = gen_int(n_code, 0);
36991
36992 ret_val = xmlUCSIsGreekandCoptic(code);
36993 desret_int(ret_val);
36994 call_tests++;
36995 des_int(n_code, code, 0);
36996 xmlResetLastError();
36997 if (mem_base != xmlMemBlocks()) {
36998 printf("Leak of %d blocks found in xmlUCSIsGreekandCoptic",
36999 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037000 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037001 printf(" %d", n_code);
37002 printf("\n");
37003 }
37004 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037005 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037006#endif
37007
Daniel Veillard42595322004-11-08 10:52:06 +000037008 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037009}
37010
37011
37012static int
37013test_xmlUCSIsGujarati(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037014 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037015
William M. Brack21e4ef22005-01-02 09:53:13 +000037016#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037017 int mem_base;
37018 int ret_val;
37019 int code; /* UCS code point */
37020 int n_code;
37021
37022 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37023 mem_base = xmlMemBlocks();
37024 code = gen_int(n_code, 0);
37025
37026 ret_val = xmlUCSIsGujarati(code);
37027 desret_int(ret_val);
37028 call_tests++;
37029 des_int(n_code, code, 0);
37030 xmlResetLastError();
37031 if (mem_base != xmlMemBlocks()) {
37032 printf("Leak of %d blocks found in xmlUCSIsGujarati",
37033 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037034 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037035 printf(" %d", n_code);
37036 printf("\n");
37037 }
37038 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037039 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037040#endif
37041
Daniel Veillard42595322004-11-08 10:52:06 +000037042 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037043}
37044
37045
37046static int
37047test_xmlUCSIsGurmukhi(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037048 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037049
William M. Brack21e4ef22005-01-02 09:53:13 +000037050#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037051 int mem_base;
37052 int ret_val;
37053 int code; /* UCS code point */
37054 int n_code;
37055
37056 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37057 mem_base = xmlMemBlocks();
37058 code = gen_int(n_code, 0);
37059
37060 ret_val = xmlUCSIsGurmukhi(code);
37061 desret_int(ret_val);
37062 call_tests++;
37063 des_int(n_code, code, 0);
37064 xmlResetLastError();
37065 if (mem_base != xmlMemBlocks()) {
37066 printf("Leak of %d blocks found in xmlUCSIsGurmukhi",
37067 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037068 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037069 printf(" %d", n_code);
37070 printf("\n");
37071 }
37072 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037073 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037074#endif
37075
Daniel Veillard42595322004-11-08 10:52:06 +000037076 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037077}
37078
37079
37080static int
37081test_xmlUCSIsHalfwidthandFullwidthForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037082 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037083
William M. Brack21e4ef22005-01-02 09:53:13 +000037084#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037085 int mem_base;
37086 int ret_val;
37087 int code; /* UCS code point */
37088 int n_code;
37089
37090 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37091 mem_base = xmlMemBlocks();
37092 code = gen_int(n_code, 0);
37093
37094 ret_val = xmlUCSIsHalfwidthandFullwidthForms(code);
37095 desret_int(ret_val);
37096 call_tests++;
37097 des_int(n_code, code, 0);
37098 xmlResetLastError();
37099 if (mem_base != xmlMemBlocks()) {
37100 printf("Leak of %d blocks found in xmlUCSIsHalfwidthandFullwidthForms",
37101 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037102 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037103 printf(" %d", n_code);
37104 printf("\n");
37105 }
37106 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037107 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037108#endif
37109
Daniel Veillard42595322004-11-08 10:52:06 +000037110 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037111}
37112
37113
37114static int
37115test_xmlUCSIsHangulCompatibilityJamo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037116 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037117
William M. Brack21e4ef22005-01-02 09:53:13 +000037118#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037119 int mem_base;
37120 int ret_val;
37121 int code; /* UCS code point */
37122 int n_code;
37123
37124 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37125 mem_base = xmlMemBlocks();
37126 code = gen_int(n_code, 0);
37127
37128 ret_val = xmlUCSIsHangulCompatibilityJamo(code);
37129 desret_int(ret_val);
37130 call_tests++;
37131 des_int(n_code, code, 0);
37132 xmlResetLastError();
37133 if (mem_base != xmlMemBlocks()) {
37134 printf("Leak of %d blocks found in xmlUCSIsHangulCompatibilityJamo",
37135 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037136 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037137 printf(" %d", n_code);
37138 printf("\n");
37139 }
37140 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037141 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037142#endif
37143
Daniel Veillard42595322004-11-08 10:52:06 +000037144 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037145}
37146
37147
37148static int
37149test_xmlUCSIsHangulJamo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037150 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037151
William M. Brack21e4ef22005-01-02 09:53:13 +000037152#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037153 int mem_base;
37154 int ret_val;
37155 int code; /* UCS code point */
37156 int n_code;
37157
37158 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37159 mem_base = xmlMemBlocks();
37160 code = gen_int(n_code, 0);
37161
37162 ret_val = xmlUCSIsHangulJamo(code);
37163 desret_int(ret_val);
37164 call_tests++;
37165 des_int(n_code, code, 0);
37166 xmlResetLastError();
37167 if (mem_base != xmlMemBlocks()) {
37168 printf("Leak of %d blocks found in xmlUCSIsHangulJamo",
37169 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037170 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037171 printf(" %d", n_code);
37172 printf("\n");
37173 }
37174 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037175 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037176#endif
37177
Daniel Veillard42595322004-11-08 10:52:06 +000037178 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037179}
37180
37181
37182static int
37183test_xmlUCSIsHangulSyllables(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037184 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037185
William M. Brack21e4ef22005-01-02 09:53:13 +000037186#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037187 int mem_base;
37188 int ret_val;
37189 int code; /* UCS code point */
37190 int n_code;
37191
37192 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37193 mem_base = xmlMemBlocks();
37194 code = gen_int(n_code, 0);
37195
37196 ret_val = xmlUCSIsHangulSyllables(code);
37197 desret_int(ret_val);
37198 call_tests++;
37199 des_int(n_code, code, 0);
37200 xmlResetLastError();
37201 if (mem_base != xmlMemBlocks()) {
37202 printf("Leak of %d blocks found in xmlUCSIsHangulSyllables",
37203 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037204 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037205 printf(" %d", n_code);
37206 printf("\n");
37207 }
37208 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037209 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037210#endif
37211
Daniel Veillard42595322004-11-08 10:52:06 +000037212 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037213}
37214
37215
37216static int
37217test_xmlUCSIsHanunoo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037218 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037219
William M. Brack21e4ef22005-01-02 09:53:13 +000037220#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037221 int mem_base;
37222 int ret_val;
37223 int code; /* UCS code point */
37224 int n_code;
37225
37226 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37227 mem_base = xmlMemBlocks();
37228 code = gen_int(n_code, 0);
37229
37230 ret_val = xmlUCSIsHanunoo(code);
37231 desret_int(ret_val);
37232 call_tests++;
37233 des_int(n_code, code, 0);
37234 xmlResetLastError();
37235 if (mem_base != xmlMemBlocks()) {
37236 printf("Leak of %d blocks found in xmlUCSIsHanunoo",
37237 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037238 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037239 printf(" %d", n_code);
37240 printf("\n");
37241 }
37242 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037243 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037244#endif
37245
Daniel Veillard42595322004-11-08 10:52:06 +000037246 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037247}
37248
37249
37250static int
37251test_xmlUCSIsHebrew(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037252 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037253
William M. Brack21e4ef22005-01-02 09:53:13 +000037254#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037255 int mem_base;
37256 int ret_val;
37257 int code; /* UCS code point */
37258 int n_code;
37259
37260 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37261 mem_base = xmlMemBlocks();
37262 code = gen_int(n_code, 0);
37263
37264 ret_val = xmlUCSIsHebrew(code);
37265 desret_int(ret_val);
37266 call_tests++;
37267 des_int(n_code, code, 0);
37268 xmlResetLastError();
37269 if (mem_base != xmlMemBlocks()) {
37270 printf("Leak of %d blocks found in xmlUCSIsHebrew",
37271 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037272 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037273 printf(" %d", n_code);
37274 printf("\n");
37275 }
37276 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037277 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037278#endif
37279
Daniel Veillard42595322004-11-08 10:52:06 +000037280 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037281}
37282
37283
37284static int
37285test_xmlUCSIsHighPrivateUseSurrogates(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037286 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037287
William M. Brack21e4ef22005-01-02 09:53:13 +000037288#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037289 int mem_base;
37290 int ret_val;
37291 int code; /* UCS code point */
37292 int n_code;
37293
37294 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37295 mem_base = xmlMemBlocks();
37296 code = gen_int(n_code, 0);
37297
37298 ret_val = xmlUCSIsHighPrivateUseSurrogates(code);
37299 desret_int(ret_val);
37300 call_tests++;
37301 des_int(n_code, code, 0);
37302 xmlResetLastError();
37303 if (mem_base != xmlMemBlocks()) {
37304 printf("Leak of %d blocks found in xmlUCSIsHighPrivateUseSurrogates",
37305 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037306 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037307 printf(" %d", n_code);
37308 printf("\n");
37309 }
37310 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037311 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037312#endif
37313
Daniel Veillard42595322004-11-08 10:52:06 +000037314 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037315}
37316
37317
37318static int
37319test_xmlUCSIsHighSurrogates(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037320 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037321
William M. Brack21e4ef22005-01-02 09:53:13 +000037322#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037323 int mem_base;
37324 int ret_val;
37325 int code; /* UCS code point */
37326 int n_code;
37327
37328 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37329 mem_base = xmlMemBlocks();
37330 code = gen_int(n_code, 0);
37331
37332 ret_val = xmlUCSIsHighSurrogates(code);
37333 desret_int(ret_val);
37334 call_tests++;
37335 des_int(n_code, code, 0);
37336 xmlResetLastError();
37337 if (mem_base != xmlMemBlocks()) {
37338 printf("Leak of %d blocks found in xmlUCSIsHighSurrogates",
37339 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037340 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037341 printf(" %d", n_code);
37342 printf("\n");
37343 }
37344 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037345 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037346#endif
37347
Daniel Veillard42595322004-11-08 10:52:06 +000037348 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037349}
37350
37351
37352static int
37353test_xmlUCSIsHiragana(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037354 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037355
William M. Brack21e4ef22005-01-02 09:53:13 +000037356#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037357 int mem_base;
37358 int ret_val;
37359 int code; /* UCS code point */
37360 int n_code;
37361
37362 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37363 mem_base = xmlMemBlocks();
37364 code = gen_int(n_code, 0);
37365
37366 ret_val = xmlUCSIsHiragana(code);
37367 desret_int(ret_val);
37368 call_tests++;
37369 des_int(n_code, code, 0);
37370 xmlResetLastError();
37371 if (mem_base != xmlMemBlocks()) {
37372 printf("Leak of %d blocks found in xmlUCSIsHiragana",
37373 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037374 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037375 printf(" %d", n_code);
37376 printf("\n");
37377 }
37378 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037379 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037380#endif
37381
Daniel Veillard42595322004-11-08 10:52:06 +000037382 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037383}
37384
37385
37386static int
37387test_xmlUCSIsIPAExtensions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037388 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037389
William M. Brack21e4ef22005-01-02 09:53:13 +000037390#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037391 int mem_base;
37392 int ret_val;
37393 int code; /* UCS code point */
37394 int n_code;
37395
37396 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37397 mem_base = xmlMemBlocks();
37398 code = gen_int(n_code, 0);
37399
37400 ret_val = xmlUCSIsIPAExtensions(code);
37401 desret_int(ret_val);
37402 call_tests++;
37403 des_int(n_code, code, 0);
37404 xmlResetLastError();
37405 if (mem_base != xmlMemBlocks()) {
37406 printf("Leak of %d blocks found in xmlUCSIsIPAExtensions",
37407 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037408 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037409 printf(" %d", n_code);
37410 printf("\n");
37411 }
37412 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037413 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037414#endif
37415
Daniel Veillard42595322004-11-08 10:52:06 +000037416 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037417}
37418
37419
37420static int
37421test_xmlUCSIsIdeographicDescriptionCharacters(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037422 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037423
William M. Brack21e4ef22005-01-02 09:53:13 +000037424#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037425 int mem_base;
37426 int ret_val;
37427 int code; /* UCS code point */
37428 int n_code;
37429
37430 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37431 mem_base = xmlMemBlocks();
37432 code = gen_int(n_code, 0);
37433
37434 ret_val = xmlUCSIsIdeographicDescriptionCharacters(code);
37435 desret_int(ret_val);
37436 call_tests++;
37437 des_int(n_code, code, 0);
37438 xmlResetLastError();
37439 if (mem_base != xmlMemBlocks()) {
37440 printf("Leak of %d blocks found in xmlUCSIsIdeographicDescriptionCharacters",
37441 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037442 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037443 printf(" %d", n_code);
37444 printf("\n");
37445 }
37446 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037447 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037448#endif
37449
Daniel Veillard42595322004-11-08 10:52:06 +000037450 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037451}
37452
37453
37454static int
37455test_xmlUCSIsKanbun(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037456 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037457
William M. Brack21e4ef22005-01-02 09:53:13 +000037458#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037459 int mem_base;
37460 int ret_val;
37461 int code; /* UCS code point */
37462 int n_code;
37463
37464 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37465 mem_base = xmlMemBlocks();
37466 code = gen_int(n_code, 0);
37467
37468 ret_val = xmlUCSIsKanbun(code);
37469 desret_int(ret_val);
37470 call_tests++;
37471 des_int(n_code, code, 0);
37472 xmlResetLastError();
37473 if (mem_base != xmlMemBlocks()) {
37474 printf("Leak of %d blocks found in xmlUCSIsKanbun",
37475 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037476 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037477 printf(" %d", n_code);
37478 printf("\n");
37479 }
37480 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037481 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037482#endif
37483
Daniel Veillard42595322004-11-08 10:52:06 +000037484 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037485}
37486
37487
37488static int
37489test_xmlUCSIsKangxiRadicals(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037490 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037491
William M. Brack21e4ef22005-01-02 09:53:13 +000037492#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037493 int mem_base;
37494 int ret_val;
37495 int code; /* UCS code point */
37496 int n_code;
37497
37498 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37499 mem_base = xmlMemBlocks();
37500 code = gen_int(n_code, 0);
37501
37502 ret_val = xmlUCSIsKangxiRadicals(code);
37503 desret_int(ret_val);
37504 call_tests++;
37505 des_int(n_code, code, 0);
37506 xmlResetLastError();
37507 if (mem_base != xmlMemBlocks()) {
37508 printf("Leak of %d blocks found in xmlUCSIsKangxiRadicals",
37509 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037510 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037511 printf(" %d", n_code);
37512 printf("\n");
37513 }
37514 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037515 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037516#endif
37517
Daniel Veillard42595322004-11-08 10:52:06 +000037518 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037519}
37520
37521
37522static int
37523test_xmlUCSIsKannada(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037524 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037525
William M. Brack21e4ef22005-01-02 09:53:13 +000037526#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037527 int mem_base;
37528 int ret_val;
37529 int code; /* UCS code point */
37530 int n_code;
37531
37532 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37533 mem_base = xmlMemBlocks();
37534 code = gen_int(n_code, 0);
37535
37536 ret_val = xmlUCSIsKannada(code);
37537 desret_int(ret_val);
37538 call_tests++;
37539 des_int(n_code, code, 0);
37540 xmlResetLastError();
37541 if (mem_base != xmlMemBlocks()) {
37542 printf("Leak of %d blocks found in xmlUCSIsKannada",
37543 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037544 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037545 printf(" %d", n_code);
37546 printf("\n");
37547 }
37548 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037549 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037550#endif
37551
Daniel Veillard42595322004-11-08 10:52:06 +000037552 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037553}
37554
37555
37556static int
37557test_xmlUCSIsKatakana(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037558 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037559
William M. Brack21e4ef22005-01-02 09:53:13 +000037560#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037561 int mem_base;
37562 int ret_val;
37563 int code; /* UCS code point */
37564 int n_code;
37565
37566 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37567 mem_base = xmlMemBlocks();
37568 code = gen_int(n_code, 0);
37569
37570 ret_val = xmlUCSIsKatakana(code);
37571 desret_int(ret_val);
37572 call_tests++;
37573 des_int(n_code, code, 0);
37574 xmlResetLastError();
37575 if (mem_base != xmlMemBlocks()) {
37576 printf("Leak of %d blocks found in xmlUCSIsKatakana",
37577 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037578 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037579 printf(" %d", n_code);
37580 printf("\n");
37581 }
37582 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037583 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037584#endif
37585
Daniel Veillard42595322004-11-08 10:52:06 +000037586 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037587}
37588
37589
37590static int
37591test_xmlUCSIsKatakanaPhoneticExtensions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037592 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037593
William M. Brack21e4ef22005-01-02 09:53:13 +000037594#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037595 int mem_base;
37596 int ret_val;
37597 int code; /* UCS code point */
37598 int n_code;
37599
37600 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37601 mem_base = xmlMemBlocks();
37602 code = gen_int(n_code, 0);
37603
37604 ret_val = xmlUCSIsKatakanaPhoneticExtensions(code);
37605 desret_int(ret_val);
37606 call_tests++;
37607 des_int(n_code, code, 0);
37608 xmlResetLastError();
37609 if (mem_base != xmlMemBlocks()) {
37610 printf("Leak of %d blocks found in xmlUCSIsKatakanaPhoneticExtensions",
37611 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037612 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037613 printf(" %d", n_code);
37614 printf("\n");
37615 }
37616 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037617 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037618#endif
37619
Daniel Veillard42595322004-11-08 10:52:06 +000037620 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037621}
37622
37623
37624static int
37625test_xmlUCSIsKhmer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037626 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037627
William M. Brack21e4ef22005-01-02 09:53:13 +000037628#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037629 int mem_base;
37630 int ret_val;
37631 int code; /* UCS code point */
37632 int n_code;
37633
37634 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37635 mem_base = xmlMemBlocks();
37636 code = gen_int(n_code, 0);
37637
37638 ret_val = xmlUCSIsKhmer(code);
37639 desret_int(ret_val);
37640 call_tests++;
37641 des_int(n_code, code, 0);
37642 xmlResetLastError();
37643 if (mem_base != xmlMemBlocks()) {
37644 printf("Leak of %d blocks found in xmlUCSIsKhmer",
37645 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037646 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037647 printf(" %d", n_code);
37648 printf("\n");
37649 }
37650 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037651 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037652#endif
37653
Daniel Veillard42595322004-11-08 10:52:06 +000037654 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037655}
37656
37657
37658static int
37659test_xmlUCSIsKhmerSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037660 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037661
William M. Brack21e4ef22005-01-02 09:53:13 +000037662#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037663 int mem_base;
37664 int ret_val;
37665 int code; /* UCS code point */
37666 int n_code;
37667
37668 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37669 mem_base = xmlMemBlocks();
37670 code = gen_int(n_code, 0);
37671
37672 ret_val = xmlUCSIsKhmerSymbols(code);
37673 desret_int(ret_val);
37674 call_tests++;
37675 des_int(n_code, code, 0);
37676 xmlResetLastError();
37677 if (mem_base != xmlMemBlocks()) {
37678 printf("Leak of %d blocks found in xmlUCSIsKhmerSymbols",
37679 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037680 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037681 printf(" %d", n_code);
37682 printf("\n");
37683 }
37684 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037685 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037686#endif
37687
Daniel Veillard42595322004-11-08 10:52:06 +000037688 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037689}
37690
37691
37692static int
37693test_xmlUCSIsLao(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037694 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037695
William M. Brack21e4ef22005-01-02 09:53:13 +000037696#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037697 int mem_base;
37698 int ret_val;
37699 int code; /* UCS code point */
37700 int n_code;
37701
37702 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37703 mem_base = xmlMemBlocks();
37704 code = gen_int(n_code, 0);
37705
37706 ret_val = xmlUCSIsLao(code);
37707 desret_int(ret_val);
37708 call_tests++;
37709 des_int(n_code, code, 0);
37710 xmlResetLastError();
37711 if (mem_base != xmlMemBlocks()) {
37712 printf("Leak of %d blocks found in xmlUCSIsLao",
37713 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037714 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037715 printf(" %d", n_code);
37716 printf("\n");
37717 }
37718 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037719 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037720#endif
37721
Daniel Veillard42595322004-11-08 10:52:06 +000037722 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037723}
37724
37725
37726static int
37727test_xmlUCSIsLatin1Supplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037728 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037729
William M. Brack21e4ef22005-01-02 09:53:13 +000037730#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037731 int mem_base;
37732 int ret_val;
37733 int code; /* UCS code point */
37734 int n_code;
37735
37736 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37737 mem_base = xmlMemBlocks();
37738 code = gen_int(n_code, 0);
37739
37740 ret_val = xmlUCSIsLatin1Supplement(code);
37741 desret_int(ret_val);
37742 call_tests++;
37743 des_int(n_code, code, 0);
37744 xmlResetLastError();
37745 if (mem_base != xmlMemBlocks()) {
37746 printf("Leak of %d blocks found in xmlUCSIsLatin1Supplement",
37747 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037748 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037749 printf(" %d", n_code);
37750 printf("\n");
37751 }
37752 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037753 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037754#endif
37755
Daniel Veillard42595322004-11-08 10:52:06 +000037756 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037757}
37758
37759
37760static int
37761test_xmlUCSIsLatinExtendedA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037762 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037763
William M. Brack21e4ef22005-01-02 09:53:13 +000037764#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037765 int mem_base;
37766 int ret_val;
37767 int code; /* UCS code point */
37768 int n_code;
37769
37770 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37771 mem_base = xmlMemBlocks();
37772 code = gen_int(n_code, 0);
37773
37774 ret_val = xmlUCSIsLatinExtendedA(code);
37775 desret_int(ret_val);
37776 call_tests++;
37777 des_int(n_code, code, 0);
37778 xmlResetLastError();
37779 if (mem_base != xmlMemBlocks()) {
37780 printf("Leak of %d blocks found in xmlUCSIsLatinExtendedA",
37781 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037782 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037783 printf(" %d", n_code);
37784 printf("\n");
37785 }
37786 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037787 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037788#endif
37789
Daniel Veillard42595322004-11-08 10:52:06 +000037790 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037791}
37792
37793
37794static int
37795test_xmlUCSIsLatinExtendedAdditional(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037796 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037797
William M. Brack21e4ef22005-01-02 09:53:13 +000037798#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037799 int mem_base;
37800 int ret_val;
37801 int code; /* UCS code point */
37802 int n_code;
37803
37804 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37805 mem_base = xmlMemBlocks();
37806 code = gen_int(n_code, 0);
37807
37808 ret_val = xmlUCSIsLatinExtendedAdditional(code);
37809 desret_int(ret_val);
37810 call_tests++;
37811 des_int(n_code, code, 0);
37812 xmlResetLastError();
37813 if (mem_base != xmlMemBlocks()) {
37814 printf("Leak of %d blocks found in xmlUCSIsLatinExtendedAdditional",
37815 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037816 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037817 printf(" %d", n_code);
37818 printf("\n");
37819 }
37820 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037821 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037822#endif
37823
Daniel Veillard42595322004-11-08 10:52:06 +000037824 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037825}
37826
37827
37828static int
37829test_xmlUCSIsLatinExtendedB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037830 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037831
William M. Brack21e4ef22005-01-02 09:53:13 +000037832#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037833 int mem_base;
37834 int ret_val;
37835 int code; /* UCS code point */
37836 int n_code;
37837
37838 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37839 mem_base = xmlMemBlocks();
37840 code = gen_int(n_code, 0);
37841
37842 ret_val = xmlUCSIsLatinExtendedB(code);
37843 desret_int(ret_val);
37844 call_tests++;
37845 des_int(n_code, code, 0);
37846 xmlResetLastError();
37847 if (mem_base != xmlMemBlocks()) {
37848 printf("Leak of %d blocks found in xmlUCSIsLatinExtendedB",
37849 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037850 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037851 printf(" %d", n_code);
37852 printf("\n");
37853 }
37854 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037855 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037856#endif
37857
Daniel Veillard42595322004-11-08 10:52:06 +000037858 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037859}
37860
37861
37862static int
37863test_xmlUCSIsLetterlikeSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037864 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037865
William M. Brack21e4ef22005-01-02 09:53:13 +000037866#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037867 int mem_base;
37868 int ret_val;
37869 int code; /* UCS code point */
37870 int n_code;
37871
37872 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37873 mem_base = xmlMemBlocks();
37874 code = gen_int(n_code, 0);
37875
37876 ret_val = xmlUCSIsLetterlikeSymbols(code);
37877 desret_int(ret_val);
37878 call_tests++;
37879 des_int(n_code, code, 0);
37880 xmlResetLastError();
37881 if (mem_base != xmlMemBlocks()) {
37882 printf("Leak of %d blocks found in xmlUCSIsLetterlikeSymbols",
37883 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037884 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037885 printf(" %d", n_code);
37886 printf("\n");
37887 }
37888 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037889 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037890#endif
37891
Daniel Veillard42595322004-11-08 10:52:06 +000037892 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037893}
37894
37895
37896static int
37897test_xmlUCSIsLimbu(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037898 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037899
William M. Brack21e4ef22005-01-02 09:53:13 +000037900#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037901 int mem_base;
37902 int ret_val;
37903 int code; /* UCS code point */
37904 int n_code;
37905
37906 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37907 mem_base = xmlMemBlocks();
37908 code = gen_int(n_code, 0);
37909
37910 ret_val = xmlUCSIsLimbu(code);
37911 desret_int(ret_val);
37912 call_tests++;
37913 des_int(n_code, code, 0);
37914 xmlResetLastError();
37915 if (mem_base != xmlMemBlocks()) {
37916 printf("Leak of %d blocks found in xmlUCSIsLimbu",
37917 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037918 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037919 printf(" %d", n_code);
37920 printf("\n");
37921 }
37922 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037923 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037924#endif
37925
Daniel Veillard42595322004-11-08 10:52:06 +000037926 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037927}
37928
37929
37930static int
37931test_xmlUCSIsLinearBIdeograms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037932 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037933
William M. Brack21e4ef22005-01-02 09:53:13 +000037934#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037935 int mem_base;
37936 int ret_val;
37937 int code; /* UCS code point */
37938 int n_code;
37939
37940 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37941 mem_base = xmlMemBlocks();
37942 code = gen_int(n_code, 0);
37943
37944 ret_val = xmlUCSIsLinearBIdeograms(code);
37945 desret_int(ret_val);
37946 call_tests++;
37947 des_int(n_code, code, 0);
37948 xmlResetLastError();
37949 if (mem_base != xmlMemBlocks()) {
37950 printf("Leak of %d blocks found in xmlUCSIsLinearBIdeograms",
37951 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037952 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037953 printf(" %d", n_code);
37954 printf("\n");
37955 }
37956 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037957 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037958#endif
37959
Daniel Veillard42595322004-11-08 10:52:06 +000037960 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037961}
37962
37963
37964static int
37965test_xmlUCSIsLinearBSyllabary(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037966 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037967
William M. Brack21e4ef22005-01-02 09:53:13 +000037968#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037969 int mem_base;
37970 int ret_val;
37971 int code; /* UCS code point */
37972 int n_code;
37973
37974 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37975 mem_base = xmlMemBlocks();
37976 code = gen_int(n_code, 0);
37977
37978 ret_val = xmlUCSIsLinearBSyllabary(code);
37979 desret_int(ret_val);
37980 call_tests++;
37981 des_int(n_code, code, 0);
37982 xmlResetLastError();
37983 if (mem_base != xmlMemBlocks()) {
37984 printf("Leak of %d blocks found in xmlUCSIsLinearBSyllabary",
37985 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037986 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037987 printf(" %d", n_code);
37988 printf("\n");
37989 }
37990 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037991 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037992#endif
37993
Daniel Veillard42595322004-11-08 10:52:06 +000037994 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037995}
37996
37997
37998static int
37999test_xmlUCSIsLowSurrogates(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038000 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038001
William M. Brack21e4ef22005-01-02 09:53:13 +000038002#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038003 int mem_base;
38004 int ret_val;
38005 int code; /* UCS code point */
38006 int n_code;
38007
38008 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38009 mem_base = xmlMemBlocks();
38010 code = gen_int(n_code, 0);
38011
38012 ret_val = xmlUCSIsLowSurrogates(code);
38013 desret_int(ret_val);
38014 call_tests++;
38015 des_int(n_code, code, 0);
38016 xmlResetLastError();
38017 if (mem_base != xmlMemBlocks()) {
38018 printf("Leak of %d blocks found in xmlUCSIsLowSurrogates",
38019 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038020 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038021 printf(" %d", n_code);
38022 printf("\n");
38023 }
38024 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038025 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038026#endif
38027
Daniel Veillard42595322004-11-08 10:52:06 +000038028 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038029}
38030
38031
38032static int
38033test_xmlUCSIsMalayalam(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038034 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038035
William M. Brack21e4ef22005-01-02 09:53:13 +000038036#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038037 int mem_base;
38038 int ret_val;
38039 int code; /* UCS code point */
38040 int n_code;
38041
38042 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38043 mem_base = xmlMemBlocks();
38044 code = gen_int(n_code, 0);
38045
38046 ret_val = xmlUCSIsMalayalam(code);
38047 desret_int(ret_val);
38048 call_tests++;
38049 des_int(n_code, code, 0);
38050 xmlResetLastError();
38051 if (mem_base != xmlMemBlocks()) {
38052 printf("Leak of %d blocks found in xmlUCSIsMalayalam",
38053 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038054 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038055 printf(" %d", n_code);
38056 printf("\n");
38057 }
38058 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038059 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038060#endif
38061
Daniel Veillard42595322004-11-08 10:52:06 +000038062 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038063}
38064
38065
38066static int
38067test_xmlUCSIsMathematicalAlphanumericSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038068 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038069
William M. Brack21e4ef22005-01-02 09:53:13 +000038070#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038071 int mem_base;
38072 int ret_val;
38073 int code; /* UCS code point */
38074 int n_code;
38075
38076 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38077 mem_base = xmlMemBlocks();
38078 code = gen_int(n_code, 0);
38079
38080 ret_val = xmlUCSIsMathematicalAlphanumericSymbols(code);
38081 desret_int(ret_val);
38082 call_tests++;
38083 des_int(n_code, code, 0);
38084 xmlResetLastError();
38085 if (mem_base != xmlMemBlocks()) {
38086 printf("Leak of %d blocks found in xmlUCSIsMathematicalAlphanumericSymbols",
38087 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038088 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038089 printf(" %d", n_code);
38090 printf("\n");
38091 }
38092 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038093 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038094#endif
38095
Daniel Veillard42595322004-11-08 10:52:06 +000038096 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038097}
38098
38099
38100static int
38101test_xmlUCSIsMathematicalOperators(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038102 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038103
William M. Brack21e4ef22005-01-02 09:53:13 +000038104#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038105 int mem_base;
38106 int ret_val;
38107 int code; /* UCS code point */
38108 int n_code;
38109
38110 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38111 mem_base = xmlMemBlocks();
38112 code = gen_int(n_code, 0);
38113
38114 ret_val = xmlUCSIsMathematicalOperators(code);
38115 desret_int(ret_val);
38116 call_tests++;
38117 des_int(n_code, code, 0);
38118 xmlResetLastError();
38119 if (mem_base != xmlMemBlocks()) {
38120 printf("Leak of %d blocks found in xmlUCSIsMathematicalOperators",
38121 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038122 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038123 printf(" %d", n_code);
38124 printf("\n");
38125 }
38126 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038127 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038128#endif
38129
Daniel Veillard42595322004-11-08 10:52:06 +000038130 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038131}
38132
38133
38134static int
38135test_xmlUCSIsMiscellaneousMathematicalSymbolsA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038136 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038137
William M. Brack21e4ef22005-01-02 09:53:13 +000038138#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038139 int mem_base;
38140 int ret_val;
38141 int code; /* UCS code point */
38142 int n_code;
38143
38144 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38145 mem_base = xmlMemBlocks();
38146 code = gen_int(n_code, 0);
38147
38148 ret_val = xmlUCSIsMiscellaneousMathematicalSymbolsA(code);
38149 desret_int(ret_val);
38150 call_tests++;
38151 des_int(n_code, code, 0);
38152 xmlResetLastError();
38153 if (mem_base != xmlMemBlocks()) {
38154 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousMathematicalSymbolsA",
38155 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038156 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038157 printf(" %d", n_code);
38158 printf("\n");
38159 }
38160 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038161 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038162#endif
38163
Daniel Veillard42595322004-11-08 10:52:06 +000038164 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038165}
38166
38167
38168static int
38169test_xmlUCSIsMiscellaneousMathematicalSymbolsB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038170 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038171
William M. Brack21e4ef22005-01-02 09:53:13 +000038172#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038173 int mem_base;
38174 int ret_val;
38175 int code; /* UCS code point */
38176 int n_code;
38177
38178 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38179 mem_base = xmlMemBlocks();
38180 code = gen_int(n_code, 0);
38181
38182 ret_val = xmlUCSIsMiscellaneousMathematicalSymbolsB(code);
38183 desret_int(ret_val);
38184 call_tests++;
38185 des_int(n_code, code, 0);
38186 xmlResetLastError();
38187 if (mem_base != xmlMemBlocks()) {
38188 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousMathematicalSymbolsB",
38189 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038190 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038191 printf(" %d", n_code);
38192 printf("\n");
38193 }
38194 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038195 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038196#endif
38197
Daniel Veillard42595322004-11-08 10:52:06 +000038198 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038199}
38200
38201
38202static int
38203test_xmlUCSIsMiscellaneousSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038204 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038205
William M. Brack21e4ef22005-01-02 09:53:13 +000038206#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038207 int mem_base;
38208 int ret_val;
38209 int code; /* UCS code point */
38210 int n_code;
38211
38212 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38213 mem_base = xmlMemBlocks();
38214 code = gen_int(n_code, 0);
38215
38216 ret_val = xmlUCSIsMiscellaneousSymbols(code);
38217 desret_int(ret_val);
38218 call_tests++;
38219 des_int(n_code, code, 0);
38220 xmlResetLastError();
38221 if (mem_base != xmlMemBlocks()) {
38222 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousSymbols",
38223 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038224 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038225 printf(" %d", n_code);
38226 printf("\n");
38227 }
38228 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038229 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038230#endif
38231
Daniel Veillard42595322004-11-08 10:52:06 +000038232 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038233}
38234
38235
38236static int
38237test_xmlUCSIsMiscellaneousSymbolsandArrows(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038238 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038239
William M. Brack21e4ef22005-01-02 09:53:13 +000038240#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038241 int mem_base;
38242 int ret_val;
38243 int code; /* UCS code point */
38244 int n_code;
38245
38246 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38247 mem_base = xmlMemBlocks();
38248 code = gen_int(n_code, 0);
38249
38250 ret_val = xmlUCSIsMiscellaneousSymbolsandArrows(code);
38251 desret_int(ret_val);
38252 call_tests++;
38253 des_int(n_code, code, 0);
38254 xmlResetLastError();
38255 if (mem_base != xmlMemBlocks()) {
38256 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousSymbolsandArrows",
38257 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038258 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038259 printf(" %d", n_code);
38260 printf("\n");
38261 }
38262 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038263 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038264#endif
38265
Daniel Veillard42595322004-11-08 10:52:06 +000038266 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038267}
38268
38269
38270static int
38271test_xmlUCSIsMiscellaneousTechnical(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038272 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038273
William M. Brack21e4ef22005-01-02 09:53:13 +000038274#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038275 int mem_base;
38276 int ret_val;
38277 int code; /* UCS code point */
38278 int n_code;
38279
38280 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38281 mem_base = xmlMemBlocks();
38282 code = gen_int(n_code, 0);
38283
38284 ret_val = xmlUCSIsMiscellaneousTechnical(code);
38285 desret_int(ret_val);
38286 call_tests++;
38287 des_int(n_code, code, 0);
38288 xmlResetLastError();
38289 if (mem_base != xmlMemBlocks()) {
38290 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousTechnical",
38291 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038292 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038293 printf(" %d", n_code);
38294 printf("\n");
38295 }
38296 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038297 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038298#endif
38299
Daniel Veillard42595322004-11-08 10:52:06 +000038300 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038301}
38302
38303
38304static int
38305test_xmlUCSIsMongolian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038306 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038307
William M. Brack21e4ef22005-01-02 09:53:13 +000038308#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038309 int mem_base;
38310 int ret_val;
38311 int code; /* UCS code point */
38312 int n_code;
38313
38314 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38315 mem_base = xmlMemBlocks();
38316 code = gen_int(n_code, 0);
38317
38318 ret_val = xmlUCSIsMongolian(code);
38319 desret_int(ret_val);
38320 call_tests++;
38321 des_int(n_code, code, 0);
38322 xmlResetLastError();
38323 if (mem_base != xmlMemBlocks()) {
38324 printf("Leak of %d blocks found in xmlUCSIsMongolian",
38325 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038326 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038327 printf(" %d", n_code);
38328 printf("\n");
38329 }
38330 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038331 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038332#endif
38333
Daniel Veillard42595322004-11-08 10:52:06 +000038334 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038335}
38336
38337
38338static int
38339test_xmlUCSIsMusicalSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038340 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038341
William M. Brack21e4ef22005-01-02 09:53:13 +000038342#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038343 int mem_base;
38344 int ret_val;
38345 int code; /* UCS code point */
38346 int n_code;
38347
38348 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38349 mem_base = xmlMemBlocks();
38350 code = gen_int(n_code, 0);
38351
38352 ret_val = xmlUCSIsMusicalSymbols(code);
38353 desret_int(ret_val);
38354 call_tests++;
38355 des_int(n_code, code, 0);
38356 xmlResetLastError();
38357 if (mem_base != xmlMemBlocks()) {
38358 printf("Leak of %d blocks found in xmlUCSIsMusicalSymbols",
38359 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038360 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038361 printf(" %d", n_code);
38362 printf("\n");
38363 }
38364 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038365 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038366#endif
38367
Daniel Veillard42595322004-11-08 10:52:06 +000038368 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038369}
38370
38371
38372static int
38373test_xmlUCSIsMyanmar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038374 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038375
William M. Brack21e4ef22005-01-02 09:53:13 +000038376#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038377 int mem_base;
38378 int ret_val;
38379 int code; /* UCS code point */
38380 int n_code;
38381
38382 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38383 mem_base = xmlMemBlocks();
38384 code = gen_int(n_code, 0);
38385
38386 ret_val = xmlUCSIsMyanmar(code);
38387 desret_int(ret_val);
38388 call_tests++;
38389 des_int(n_code, code, 0);
38390 xmlResetLastError();
38391 if (mem_base != xmlMemBlocks()) {
38392 printf("Leak of %d blocks found in xmlUCSIsMyanmar",
38393 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038394 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038395 printf(" %d", n_code);
38396 printf("\n");
38397 }
38398 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038399 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038400#endif
38401
Daniel Veillard42595322004-11-08 10:52:06 +000038402 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038403}
38404
38405
38406static int
38407test_xmlUCSIsNumberForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038408 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038409
William M. Brack21e4ef22005-01-02 09:53:13 +000038410#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038411 int mem_base;
38412 int ret_val;
38413 int code; /* UCS code point */
38414 int n_code;
38415
38416 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38417 mem_base = xmlMemBlocks();
38418 code = gen_int(n_code, 0);
38419
38420 ret_val = xmlUCSIsNumberForms(code);
38421 desret_int(ret_val);
38422 call_tests++;
38423 des_int(n_code, code, 0);
38424 xmlResetLastError();
38425 if (mem_base != xmlMemBlocks()) {
38426 printf("Leak of %d blocks found in xmlUCSIsNumberForms",
38427 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038428 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038429 printf(" %d", n_code);
38430 printf("\n");
38431 }
38432 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038433 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038434#endif
38435
Daniel Veillard42595322004-11-08 10:52:06 +000038436 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038437}
38438
38439
38440static int
38441test_xmlUCSIsOgham(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038442 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038443
William M. Brack21e4ef22005-01-02 09:53:13 +000038444#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038445 int mem_base;
38446 int ret_val;
38447 int code; /* UCS code point */
38448 int n_code;
38449
38450 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38451 mem_base = xmlMemBlocks();
38452 code = gen_int(n_code, 0);
38453
38454 ret_val = xmlUCSIsOgham(code);
38455 desret_int(ret_val);
38456 call_tests++;
38457 des_int(n_code, code, 0);
38458 xmlResetLastError();
38459 if (mem_base != xmlMemBlocks()) {
38460 printf("Leak of %d blocks found in xmlUCSIsOgham",
38461 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038462 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038463 printf(" %d", n_code);
38464 printf("\n");
38465 }
38466 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038467 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038468#endif
38469
Daniel Veillard42595322004-11-08 10:52:06 +000038470 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038471}
38472
38473
38474static int
38475test_xmlUCSIsOldItalic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038476 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038477
William M. Brack21e4ef22005-01-02 09:53:13 +000038478#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038479 int mem_base;
38480 int ret_val;
38481 int code; /* UCS code point */
38482 int n_code;
38483
38484 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38485 mem_base = xmlMemBlocks();
38486 code = gen_int(n_code, 0);
38487
38488 ret_val = xmlUCSIsOldItalic(code);
38489 desret_int(ret_val);
38490 call_tests++;
38491 des_int(n_code, code, 0);
38492 xmlResetLastError();
38493 if (mem_base != xmlMemBlocks()) {
38494 printf("Leak of %d blocks found in xmlUCSIsOldItalic",
38495 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038496 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038497 printf(" %d", n_code);
38498 printf("\n");
38499 }
38500 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038501 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038502#endif
38503
Daniel Veillard42595322004-11-08 10:52:06 +000038504 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038505}
38506
38507
38508static int
38509test_xmlUCSIsOpticalCharacterRecognition(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038510 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038511
William M. Brack21e4ef22005-01-02 09:53:13 +000038512#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038513 int mem_base;
38514 int ret_val;
38515 int code; /* UCS code point */
38516 int n_code;
38517
38518 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38519 mem_base = xmlMemBlocks();
38520 code = gen_int(n_code, 0);
38521
38522 ret_val = xmlUCSIsOpticalCharacterRecognition(code);
38523 desret_int(ret_val);
38524 call_tests++;
38525 des_int(n_code, code, 0);
38526 xmlResetLastError();
38527 if (mem_base != xmlMemBlocks()) {
38528 printf("Leak of %d blocks found in xmlUCSIsOpticalCharacterRecognition",
38529 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038530 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038531 printf(" %d", n_code);
38532 printf("\n");
38533 }
38534 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038535 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038536#endif
38537
Daniel Veillard42595322004-11-08 10:52:06 +000038538 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038539}
38540
38541
38542static int
38543test_xmlUCSIsOriya(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038544 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038545
William M. Brack21e4ef22005-01-02 09:53:13 +000038546#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038547 int mem_base;
38548 int ret_val;
38549 int code; /* UCS code point */
38550 int n_code;
38551
38552 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38553 mem_base = xmlMemBlocks();
38554 code = gen_int(n_code, 0);
38555
38556 ret_val = xmlUCSIsOriya(code);
38557 desret_int(ret_val);
38558 call_tests++;
38559 des_int(n_code, code, 0);
38560 xmlResetLastError();
38561 if (mem_base != xmlMemBlocks()) {
38562 printf("Leak of %d blocks found in xmlUCSIsOriya",
38563 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038564 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038565 printf(" %d", n_code);
38566 printf("\n");
38567 }
38568 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038569 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038570#endif
38571
Daniel Veillard42595322004-11-08 10:52:06 +000038572 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038573}
38574
38575
38576static int
38577test_xmlUCSIsOsmanya(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038578 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038579
William M. Brack21e4ef22005-01-02 09:53:13 +000038580#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038581 int mem_base;
38582 int ret_val;
38583 int code; /* UCS code point */
38584 int n_code;
38585
38586 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38587 mem_base = xmlMemBlocks();
38588 code = gen_int(n_code, 0);
38589
38590 ret_val = xmlUCSIsOsmanya(code);
38591 desret_int(ret_val);
38592 call_tests++;
38593 des_int(n_code, code, 0);
38594 xmlResetLastError();
38595 if (mem_base != xmlMemBlocks()) {
38596 printf("Leak of %d blocks found in xmlUCSIsOsmanya",
38597 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038598 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038599 printf(" %d", n_code);
38600 printf("\n");
38601 }
38602 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038603 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038604#endif
38605
Daniel Veillard42595322004-11-08 10:52:06 +000038606 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038607}
38608
38609
38610static int
38611test_xmlUCSIsPhoneticExtensions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038612 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038613
William M. Brack21e4ef22005-01-02 09:53:13 +000038614#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038615 int mem_base;
38616 int ret_val;
38617 int code; /* UCS code point */
38618 int n_code;
38619
38620 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38621 mem_base = xmlMemBlocks();
38622 code = gen_int(n_code, 0);
38623
38624 ret_val = xmlUCSIsPhoneticExtensions(code);
38625 desret_int(ret_val);
38626 call_tests++;
38627 des_int(n_code, code, 0);
38628 xmlResetLastError();
38629 if (mem_base != xmlMemBlocks()) {
38630 printf("Leak of %d blocks found in xmlUCSIsPhoneticExtensions",
38631 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038632 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038633 printf(" %d", n_code);
38634 printf("\n");
38635 }
38636 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038637 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038638#endif
38639
Daniel Veillard42595322004-11-08 10:52:06 +000038640 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038641}
38642
38643
38644static int
38645test_xmlUCSIsPrivateUse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038646 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038647
William M. Brack21e4ef22005-01-02 09:53:13 +000038648#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038649 int mem_base;
38650 int ret_val;
38651 int code; /* UCS code point */
38652 int n_code;
38653
38654 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38655 mem_base = xmlMemBlocks();
38656 code = gen_int(n_code, 0);
38657
38658 ret_val = xmlUCSIsPrivateUse(code);
38659 desret_int(ret_val);
38660 call_tests++;
38661 des_int(n_code, code, 0);
38662 xmlResetLastError();
38663 if (mem_base != xmlMemBlocks()) {
38664 printf("Leak of %d blocks found in xmlUCSIsPrivateUse",
38665 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038666 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038667 printf(" %d", n_code);
38668 printf("\n");
38669 }
38670 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038671 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038672#endif
38673
Daniel Veillard42595322004-11-08 10:52:06 +000038674 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038675}
38676
38677
38678static int
38679test_xmlUCSIsPrivateUseArea(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038680 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038681
William M. Brack21e4ef22005-01-02 09:53:13 +000038682#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038683 int mem_base;
38684 int ret_val;
38685 int code; /* UCS code point */
38686 int n_code;
38687
38688 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38689 mem_base = xmlMemBlocks();
38690 code = gen_int(n_code, 0);
38691
38692 ret_val = xmlUCSIsPrivateUseArea(code);
38693 desret_int(ret_val);
38694 call_tests++;
38695 des_int(n_code, code, 0);
38696 xmlResetLastError();
38697 if (mem_base != xmlMemBlocks()) {
38698 printf("Leak of %d blocks found in xmlUCSIsPrivateUseArea",
38699 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038700 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038701 printf(" %d", n_code);
38702 printf("\n");
38703 }
38704 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038705 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038706#endif
38707
Daniel Veillard42595322004-11-08 10:52:06 +000038708 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038709}
38710
38711
38712static int
38713test_xmlUCSIsRunic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038714 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038715
William M. Brack21e4ef22005-01-02 09:53:13 +000038716#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038717 int mem_base;
38718 int ret_val;
38719 int code; /* UCS code point */
38720 int n_code;
38721
38722 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38723 mem_base = xmlMemBlocks();
38724 code = gen_int(n_code, 0);
38725
38726 ret_val = xmlUCSIsRunic(code);
38727 desret_int(ret_val);
38728 call_tests++;
38729 des_int(n_code, code, 0);
38730 xmlResetLastError();
38731 if (mem_base != xmlMemBlocks()) {
38732 printf("Leak of %d blocks found in xmlUCSIsRunic",
38733 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038734 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038735 printf(" %d", n_code);
38736 printf("\n");
38737 }
38738 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038739 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038740#endif
38741
Daniel Veillard42595322004-11-08 10:52:06 +000038742 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038743}
38744
38745
38746static int
38747test_xmlUCSIsShavian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038748 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038749
William M. Brack21e4ef22005-01-02 09:53:13 +000038750#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038751 int mem_base;
38752 int ret_val;
38753 int code; /* UCS code point */
38754 int n_code;
38755
38756 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38757 mem_base = xmlMemBlocks();
38758 code = gen_int(n_code, 0);
38759
38760 ret_val = xmlUCSIsShavian(code);
38761 desret_int(ret_val);
38762 call_tests++;
38763 des_int(n_code, code, 0);
38764 xmlResetLastError();
38765 if (mem_base != xmlMemBlocks()) {
38766 printf("Leak of %d blocks found in xmlUCSIsShavian",
38767 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038768 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038769 printf(" %d", n_code);
38770 printf("\n");
38771 }
38772 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038773 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038774#endif
38775
Daniel Veillard42595322004-11-08 10:52:06 +000038776 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038777}
38778
38779
38780static int
38781test_xmlUCSIsSinhala(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038782 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038783
William M. Brack21e4ef22005-01-02 09:53:13 +000038784#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038785 int mem_base;
38786 int ret_val;
38787 int code; /* UCS code point */
38788 int n_code;
38789
38790 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38791 mem_base = xmlMemBlocks();
38792 code = gen_int(n_code, 0);
38793
38794 ret_val = xmlUCSIsSinhala(code);
38795 desret_int(ret_val);
38796 call_tests++;
38797 des_int(n_code, code, 0);
38798 xmlResetLastError();
38799 if (mem_base != xmlMemBlocks()) {
38800 printf("Leak of %d blocks found in xmlUCSIsSinhala",
38801 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038802 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038803 printf(" %d", n_code);
38804 printf("\n");
38805 }
38806 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038807 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038808#endif
38809
Daniel Veillard42595322004-11-08 10:52:06 +000038810 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038811}
38812
38813
38814static int
38815test_xmlUCSIsSmallFormVariants(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038816 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038817
William M. Brack21e4ef22005-01-02 09:53:13 +000038818#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038819 int mem_base;
38820 int ret_val;
38821 int code; /* UCS code point */
38822 int n_code;
38823
38824 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38825 mem_base = xmlMemBlocks();
38826 code = gen_int(n_code, 0);
38827
38828 ret_val = xmlUCSIsSmallFormVariants(code);
38829 desret_int(ret_val);
38830 call_tests++;
38831 des_int(n_code, code, 0);
38832 xmlResetLastError();
38833 if (mem_base != xmlMemBlocks()) {
38834 printf("Leak of %d blocks found in xmlUCSIsSmallFormVariants",
38835 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038836 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038837 printf(" %d", n_code);
38838 printf("\n");
38839 }
38840 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038841 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038842#endif
38843
Daniel Veillard42595322004-11-08 10:52:06 +000038844 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038845}
38846
38847
38848static int
38849test_xmlUCSIsSpacingModifierLetters(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038850 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038851
William M. Brack21e4ef22005-01-02 09:53:13 +000038852#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038853 int mem_base;
38854 int ret_val;
38855 int code; /* UCS code point */
38856 int n_code;
38857
38858 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38859 mem_base = xmlMemBlocks();
38860 code = gen_int(n_code, 0);
38861
38862 ret_val = xmlUCSIsSpacingModifierLetters(code);
38863 desret_int(ret_val);
38864 call_tests++;
38865 des_int(n_code, code, 0);
38866 xmlResetLastError();
38867 if (mem_base != xmlMemBlocks()) {
38868 printf("Leak of %d blocks found in xmlUCSIsSpacingModifierLetters",
38869 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038870 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038871 printf(" %d", n_code);
38872 printf("\n");
38873 }
38874 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038875 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038876#endif
38877
Daniel Veillard42595322004-11-08 10:52:06 +000038878 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038879}
38880
38881
38882static int
38883test_xmlUCSIsSpecials(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038884 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038885
William M. Brack21e4ef22005-01-02 09:53:13 +000038886#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038887 int mem_base;
38888 int ret_val;
38889 int code; /* UCS code point */
38890 int n_code;
38891
38892 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38893 mem_base = xmlMemBlocks();
38894 code = gen_int(n_code, 0);
38895
38896 ret_val = xmlUCSIsSpecials(code);
38897 desret_int(ret_val);
38898 call_tests++;
38899 des_int(n_code, code, 0);
38900 xmlResetLastError();
38901 if (mem_base != xmlMemBlocks()) {
38902 printf("Leak of %d blocks found in xmlUCSIsSpecials",
38903 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038904 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038905 printf(" %d", n_code);
38906 printf("\n");
38907 }
38908 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038909 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038910#endif
38911
Daniel Veillard42595322004-11-08 10:52:06 +000038912 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038913}
38914
38915
38916static int
38917test_xmlUCSIsSuperscriptsandSubscripts(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038918 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038919
William M. Brack21e4ef22005-01-02 09:53:13 +000038920#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038921 int mem_base;
38922 int ret_val;
38923 int code; /* UCS code point */
38924 int n_code;
38925
38926 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38927 mem_base = xmlMemBlocks();
38928 code = gen_int(n_code, 0);
38929
38930 ret_val = xmlUCSIsSuperscriptsandSubscripts(code);
38931 desret_int(ret_val);
38932 call_tests++;
38933 des_int(n_code, code, 0);
38934 xmlResetLastError();
38935 if (mem_base != xmlMemBlocks()) {
38936 printf("Leak of %d blocks found in xmlUCSIsSuperscriptsandSubscripts",
38937 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038938 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038939 printf(" %d", n_code);
38940 printf("\n");
38941 }
38942 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038943 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038944#endif
38945
Daniel Veillard42595322004-11-08 10:52:06 +000038946 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038947}
38948
38949
38950static int
38951test_xmlUCSIsSupplementalArrowsA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038952 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038953
William M. Brack21e4ef22005-01-02 09:53:13 +000038954#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038955 int mem_base;
38956 int ret_val;
38957 int code; /* UCS code point */
38958 int n_code;
38959
38960 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38961 mem_base = xmlMemBlocks();
38962 code = gen_int(n_code, 0);
38963
38964 ret_val = xmlUCSIsSupplementalArrowsA(code);
38965 desret_int(ret_val);
38966 call_tests++;
38967 des_int(n_code, code, 0);
38968 xmlResetLastError();
38969 if (mem_base != xmlMemBlocks()) {
38970 printf("Leak of %d blocks found in xmlUCSIsSupplementalArrowsA",
38971 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038972 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038973 printf(" %d", n_code);
38974 printf("\n");
38975 }
38976 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038977 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038978#endif
38979
Daniel Veillard42595322004-11-08 10:52:06 +000038980 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038981}
38982
38983
38984static int
38985test_xmlUCSIsSupplementalArrowsB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038986 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038987
William M. Brack21e4ef22005-01-02 09:53:13 +000038988#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038989 int mem_base;
38990 int ret_val;
38991 int code; /* UCS code point */
38992 int n_code;
38993
38994 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38995 mem_base = xmlMemBlocks();
38996 code = gen_int(n_code, 0);
38997
38998 ret_val = xmlUCSIsSupplementalArrowsB(code);
38999 desret_int(ret_val);
39000 call_tests++;
39001 des_int(n_code, code, 0);
39002 xmlResetLastError();
39003 if (mem_base != xmlMemBlocks()) {
39004 printf("Leak of %d blocks found in xmlUCSIsSupplementalArrowsB",
39005 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039006 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039007 printf(" %d", n_code);
39008 printf("\n");
39009 }
39010 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039011 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039012#endif
39013
Daniel Veillard42595322004-11-08 10:52:06 +000039014 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039015}
39016
39017
39018static int
39019test_xmlUCSIsSupplementalMathematicalOperators(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039020 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039021
William M. Brack21e4ef22005-01-02 09:53:13 +000039022#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039023 int mem_base;
39024 int ret_val;
39025 int code; /* UCS code point */
39026 int n_code;
39027
39028 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39029 mem_base = xmlMemBlocks();
39030 code = gen_int(n_code, 0);
39031
39032 ret_val = xmlUCSIsSupplementalMathematicalOperators(code);
39033 desret_int(ret_val);
39034 call_tests++;
39035 des_int(n_code, code, 0);
39036 xmlResetLastError();
39037 if (mem_base != xmlMemBlocks()) {
39038 printf("Leak of %d blocks found in xmlUCSIsSupplementalMathematicalOperators",
39039 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039040 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039041 printf(" %d", n_code);
39042 printf("\n");
39043 }
39044 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039045 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039046#endif
39047
Daniel Veillard42595322004-11-08 10:52:06 +000039048 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039049}
39050
39051
39052static int
39053test_xmlUCSIsSupplementaryPrivateUseAreaA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039054 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039055
William M. Brack21e4ef22005-01-02 09:53:13 +000039056#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039057 int mem_base;
39058 int ret_val;
39059 int code; /* UCS code point */
39060 int n_code;
39061
39062 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39063 mem_base = xmlMemBlocks();
39064 code = gen_int(n_code, 0);
39065
39066 ret_val = xmlUCSIsSupplementaryPrivateUseAreaA(code);
39067 desret_int(ret_val);
39068 call_tests++;
39069 des_int(n_code, code, 0);
39070 xmlResetLastError();
39071 if (mem_base != xmlMemBlocks()) {
39072 printf("Leak of %d blocks found in xmlUCSIsSupplementaryPrivateUseAreaA",
39073 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039074 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039075 printf(" %d", n_code);
39076 printf("\n");
39077 }
39078 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039079 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039080#endif
39081
Daniel Veillard42595322004-11-08 10:52:06 +000039082 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039083}
39084
39085
39086static int
39087test_xmlUCSIsSupplementaryPrivateUseAreaB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039088 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039089
William M. Brack21e4ef22005-01-02 09:53:13 +000039090#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039091 int mem_base;
39092 int ret_val;
39093 int code; /* UCS code point */
39094 int n_code;
39095
39096 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39097 mem_base = xmlMemBlocks();
39098 code = gen_int(n_code, 0);
39099
39100 ret_val = xmlUCSIsSupplementaryPrivateUseAreaB(code);
39101 desret_int(ret_val);
39102 call_tests++;
39103 des_int(n_code, code, 0);
39104 xmlResetLastError();
39105 if (mem_base != xmlMemBlocks()) {
39106 printf("Leak of %d blocks found in xmlUCSIsSupplementaryPrivateUseAreaB",
39107 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039108 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039109 printf(" %d", n_code);
39110 printf("\n");
39111 }
39112 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039113 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039114#endif
39115
Daniel Veillard42595322004-11-08 10:52:06 +000039116 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039117}
39118
39119
39120static int
39121test_xmlUCSIsSyriac(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039122 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039123
William M. Brack21e4ef22005-01-02 09:53:13 +000039124#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039125 int mem_base;
39126 int ret_val;
39127 int code; /* UCS code point */
39128 int n_code;
39129
39130 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39131 mem_base = xmlMemBlocks();
39132 code = gen_int(n_code, 0);
39133
39134 ret_val = xmlUCSIsSyriac(code);
39135 desret_int(ret_val);
39136 call_tests++;
39137 des_int(n_code, code, 0);
39138 xmlResetLastError();
39139 if (mem_base != xmlMemBlocks()) {
39140 printf("Leak of %d blocks found in xmlUCSIsSyriac",
39141 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039142 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039143 printf(" %d", n_code);
39144 printf("\n");
39145 }
39146 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039147 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039148#endif
39149
Daniel Veillard42595322004-11-08 10:52:06 +000039150 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039151}
39152
39153
39154static int
39155test_xmlUCSIsTagalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039156 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039157
William M. Brack21e4ef22005-01-02 09:53:13 +000039158#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039159 int mem_base;
39160 int ret_val;
39161 int code; /* UCS code point */
39162 int n_code;
39163
39164 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39165 mem_base = xmlMemBlocks();
39166 code = gen_int(n_code, 0);
39167
39168 ret_val = xmlUCSIsTagalog(code);
39169 desret_int(ret_val);
39170 call_tests++;
39171 des_int(n_code, code, 0);
39172 xmlResetLastError();
39173 if (mem_base != xmlMemBlocks()) {
39174 printf("Leak of %d blocks found in xmlUCSIsTagalog",
39175 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039176 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039177 printf(" %d", n_code);
39178 printf("\n");
39179 }
39180 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039181 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039182#endif
39183
Daniel Veillard42595322004-11-08 10:52:06 +000039184 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039185}
39186
39187
39188static int
39189test_xmlUCSIsTagbanwa(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039190 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039191
William M. Brack21e4ef22005-01-02 09:53:13 +000039192#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039193 int mem_base;
39194 int ret_val;
39195 int code; /* UCS code point */
39196 int n_code;
39197
39198 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39199 mem_base = xmlMemBlocks();
39200 code = gen_int(n_code, 0);
39201
39202 ret_val = xmlUCSIsTagbanwa(code);
39203 desret_int(ret_val);
39204 call_tests++;
39205 des_int(n_code, code, 0);
39206 xmlResetLastError();
39207 if (mem_base != xmlMemBlocks()) {
39208 printf("Leak of %d blocks found in xmlUCSIsTagbanwa",
39209 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039210 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039211 printf(" %d", n_code);
39212 printf("\n");
39213 }
39214 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039215 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039216#endif
39217
Daniel Veillard42595322004-11-08 10:52:06 +000039218 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039219}
39220
39221
39222static int
39223test_xmlUCSIsTags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039224 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039225
William M. Brack21e4ef22005-01-02 09:53:13 +000039226#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039227 int mem_base;
39228 int ret_val;
39229 int code; /* UCS code point */
39230 int n_code;
39231
39232 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39233 mem_base = xmlMemBlocks();
39234 code = gen_int(n_code, 0);
39235
39236 ret_val = xmlUCSIsTags(code);
39237 desret_int(ret_val);
39238 call_tests++;
39239 des_int(n_code, code, 0);
39240 xmlResetLastError();
39241 if (mem_base != xmlMemBlocks()) {
39242 printf("Leak of %d blocks found in xmlUCSIsTags",
39243 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039244 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039245 printf(" %d", n_code);
39246 printf("\n");
39247 }
39248 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039249 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039250#endif
39251
Daniel Veillard42595322004-11-08 10:52:06 +000039252 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039253}
39254
39255
39256static int
39257test_xmlUCSIsTaiLe(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039258 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039259
William M. Brack21e4ef22005-01-02 09:53:13 +000039260#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039261 int mem_base;
39262 int ret_val;
39263 int code; /* UCS code point */
39264 int n_code;
39265
39266 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39267 mem_base = xmlMemBlocks();
39268 code = gen_int(n_code, 0);
39269
39270 ret_val = xmlUCSIsTaiLe(code);
39271 desret_int(ret_val);
39272 call_tests++;
39273 des_int(n_code, code, 0);
39274 xmlResetLastError();
39275 if (mem_base != xmlMemBlocks()) {
39276 printf("Leak of %d blocks found in xmlUCSIsTaiLe",
39277 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039278 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039279 printf(" %d", n_code);
39280 printf("\n");
39281 }
39282 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039283 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039284#endif
39285
Daniel Veillard42595322004-11-08 10:52:06 +000039286 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039287}
39288
39289
39290static int
39291test_xmlUCSIsTaiXuanJingSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039292 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039293
William M. Brack21e4ef22005-01-02 09:53:13 +000039294#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039295 int mem_base;
39296 int ret_val;
39297 int code; /* UCS code point */
39298 int n_code;
39299
39300 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39301 mem_base = xmlMemBlocks();
39302 code = gen_int(n_code, 0);
39303
39304 ret_val = xmlUCSIsTaiXuanJingSymbols(code);
39305 desret_int(ret_val);
39306 call_tests++;
39307 des_int(n_code, code, 0);
39308 xmlResetLastError();
39309 if (mem_base != xmlMemBlocks()) {
39310 printf("Leak of %d blocks found in xmlUCSIsTaiXuanJingSymbols",
39311 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039312 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039313 printf(" %d", n_code);
39314 printf("\n");
39315 }
39316 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039317 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039318#endif
39319
Daniel Veillard42595322004-11-08 10:52:06 +000039320 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039321}
39322
39323
39324static int
39325test_xmlUCSIsTamil(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039326 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039327
William M. Brack21e4ef22005-01-02 09:53:13 +000039328#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039329 int mem_base;
39330 int ret_val;
39331 int code; /* UCS code point */
39332 int n_code;
39333
39334 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39335 mem_base = xmlMemBlocks();
39336 code = gen_int(n_code, 0);
39337
39338 ret_val = xmlUCSIsTamil(code);
39339 desret_int(ret_val);
39340 call_tests++;
39341 des_int(n_code, code, 0);
39342 xmlResetLastError();
39343 if (mem_base != xmlMemBlocks()) {
39344 printf("Leak of %d blocks found in xmlUCSIsTamil",
39345 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039346 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039347 printf(" %d", n_code);
39348 printf("\n");
39349 }
39350 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039351 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039352#endif
39353
Daniel Veillard42595322004-11-08 10:52:06 +000039354 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039355}
39356
39357
39358static int
39359test_xmlUCSIsTelugu(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039360 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039361
William M. Brack21e4ef22005-01-02 09:53:13 +000039362#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039363 int mem_base;
39364 int ret_val;
39365 int code; /* UCS code point */
39366 int n_code;
39367
39368 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39369 mem_base = xmlMemBlocks();
39370 code = gen_int(n_code, 0);
39371
39372 ret_val = xmlUCSIsTelugu(code);
39373 desret_int(ret_val);
39374 call_tests++;
39375 des_int(n_code, code, 0);
39376 xmlResetLastError();
39377 if (mem_base != xmlMemBlocks()) {
39378 printf("Leak of %d blocks found in xmlUCSIsTelugu",
39379 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039380 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039381 printf(" %d", n_code);
39382 printf("\n");
39383 }
39384 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039385 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039386#endif
39387
Daniel Veillard42595322004-11-08 10:52:06 +000039388 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039389}
39390
39391
39392static int
39393test_xmlUCSIsThaana(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039394 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039395
William M. Brack21e4ef22005-01-02 09:53:13 +000039396#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039397 int mem_base;
39398 int ret_val;
39399 int code; /* UCS code point */
39400 int n_code;
39401
39402 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39403 mem_base = xmlMemBlocks();
39404 code = gen_int(n_code, 0);
39405
39406 ret_val = xmlUCSIsThaana(code);
39407 desret_int(ret_val);
39408 call_tests++;
39409 des_int(n_code, code, 0);
39410 xmlResetLastError();
39411 if (mem_base != xmlMemBlocks()) {
39412 printf("Leak of %d blocks found in xmlUCSIsThaana",
39413 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039414 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039415 printf(" %d", n_code);
39416 printf("\n");
39417 }
39418 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039419 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039420#endif
39421
Daniel Veillard42595322004-11-08 10:52:06 +000039422 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039423}
39424
39425
39426static int
39427test_xmlUCSIsThai(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039428 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039429
William M. Brack21e4ef22005-01-02 09:53:13 +000039430#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039431 int mem_base;
39432 int ret_val;
39433 int code; /* UCS code point */
39434 int n_code;
39435
39436 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39437 mem_base = xmlMemBlocks();
39438 code = gen_int(n_code, 0);
39439
39440 ret_val = xmlUCSIsThai(code);
39441 desret_int(ret_val);
39442 call_tests++;
39443 des_int(n_code, code, 0);
39444 xmlResetLastError();
39445 if (mem_base != xmlMemBlocks()) {
39446 printf("Leak of %d blocks found in xmlUCSIsThai",
39447 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039448 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039449 printf(" %d", n_code);
39450 printf("\n");
39451 }
39452 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039453 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039454#endif
39455
Daniel Veillard42595322004-11-08 10:52:06 +000039456 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039457}
39458
39459
39460static int
39461test_xmlUCSIsTibetan(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039462 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039463
William M. Brack21e4ef22005-01-02 09:53:13 +000039464#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039465 int mem_base;
39466 int ret_val;
39467 int code; /* UCS code point */
39468 int n_code;
39469
39470 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39471 mem_base = xmlMemBlocks();
39472 code = gen_int(n_code, 0);
39473
39474 ret_val = xmlUCSIsTibetan(code);
39475 desret_int(ret_val);
39476 call_tests++;
39477 des_int(n_code, code, 0);
39478 xmlResetLastError();
39479 if (mem_base != xmlMemBlocks()) {
39480 printf("Leak of %d blocks found in xmlUCSIsTibetan",
39481 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039482 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039483 printf(" %d", n_code);
39484 printf("\n");
39485 }
39486 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039487 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039488#endif
39489
Daniel Veillard42595322004-11-08 10:52:06 +000039490 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039491}
39492
39493
39494static int
39495test_xmlUCSIsUgaritic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039496 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039497
William M. Brack21e4ef22005-01-02 09:53:13 +000039498#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039499 int mem_base;
39500 int ret_val;
39501 int code; /* UCS code point */
39502 int n_code;
39503
39504 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39505 mem_base = xmlMemBlocks();
39506 code = gen_int(n_code, 0);
39507
39508 ret_val = xmlUCSIsUgaritic(code);
39509 desret_int(ret_val);
39510 call_tests++;
39511 des_int(n_code, code, 0);
39512 xmlResetLastError();
39513 if (mem_base != xmlMemBlocks()) {
39514 printf("Leak of %d blocks found in xmlUCSIsUgaritic",
39515 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039516 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039517 printf(" %d", n_code);
39518 printf("\n");
39519 }
39520 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039521 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039522#endif
39523
Daniel Veillard42595322004-11-08 10:52:06 +000039524 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039525}
39526
39527
39528static int
39529test_xmlUCSIsUnifiedCanadianAboriginalSyllabics(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039530 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039531
William M. Brack21e4ef22005-01-02 09:53:13 +000039532#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039533 int mem_base;
39534 int ret_val;
39535 int code; /* UCS code point */
39536 int n_code;
39537
39538 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39539 mem_base = xmlMemBlocks();
39540 code = gen_int(n_code, 0);
39541
39542 ret_val = xmlUCSIsUnifiedCanadianAboriginalSyllabics(code);
39543 desret_int(ret_val);
39544 call_tests++;
39545 des_int(n_code, code, 0);
39546 xmlResetLastError();
39547 if (mem_base != xmlMemBlocks()) {
39548 printf("Leak of %d blocks found in xmlUCSIsUnifiedCanadianAboriginalSyllabics",
39549 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039550 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039551 printf(" %d", n_code);
39552 printf("\n");
39553 }
39554 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039555 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039556#endif
39557
Daniel Veillard42595322004-11-08 10:52:06 +000039558 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039559}
39560
39561
39562static int
39563test_xmlUCSIsVariationSelectors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039564 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039565
William M. Brack21e4ef22005-01-02 09:53:13 +000039566#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039567 int mem_base;
39568 int ret_val;
39569 int code; /* UCS code point */
39570 int n_code;
39571
39572 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39573 mem_base = xmlMemBlocks();
39574 code = gen_int(n_code, 0);
39575
39576 ret_val = xmlUCSIsVariationSelectors(code);
39577 desret_int(ret_val);
39578 call_tests++;
39579 des_int(n_code, code, 0);
39580 xmlResetLastError();
39581 if (mem_base != xmlMemBlocks()) {
39582 printf("Leak of %d blocks found in xmlUCSIsVariationSelectors",
39583 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039584 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039585 printf(" %d", n_code);
39586 printf("\n");
39587 }
39588 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039589 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039590#endif
39591
Daniel Veillard42595322004-11-08 10:52:06 +000039592 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039593}
39594
39595
39596static int
39597test_xmlUCSIsVariationSelectorsSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039598 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039599
William M. Brack21e4ef22005-01-02 09:53:13 +000039600#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039601 int mem_base;
39602 int ret_val;
39603 int code; /* UCS code point */
39604 int n_code;
39605
39606 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39607 mem_base = xmlMemBlocks();
39608 code = gen_int(n_code, 0);
39609
39610 ret_val = xmlUCSIsVariationSelectorsSupplement(code);
39611 desret_int(ret_val);
39612 call_tests++;
39613 des_int(n_code, code, 0);
39614 xmlResetLastError();
39615 if (mem_base != xmlMemBlocks()) {
39616 printf("Leak of %d blocks found in xmlUCSIsVariationSelectorsSupplement",
39617 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039618 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039619 printf(" %d", n_code);
39620 printf("\n");
39621 }
39622 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039623 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039624#endif
39625
Daniel Veillard42595322004-11-08 10:52:06 +000039626 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039627}
39628
39629
39630static int
39631test_xmlUCSIsYiRadicals(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039632 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039633
William M. Brack21e4ef22005-01-02 09:53:13 +000039634#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039635 int mem_base;
39636 int ret_val;
39637 int code; /* UCS code point */
39638 int n_code;
39639
39640 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39641 mem_base = xmlMemBlocks();
39642 code = gen_int(n_code, 0);
39643
39644 ret_val = xmlUCSIsYiRadicals(code);
39645 desret_int(ret_val);
39646 call_tests++;
39647 des_int(n_code, code, 0);
39648 xmlResetLastError();
39649 if (mem_base != xmlMemBlocks()) {
39650 printf("Leak of %d blocks found in xmlUCSIsYiRadicals",
39651 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039652 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039653 printf(" %d", n_code);
39654 printf("\n");
39655 }
39656 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039657 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039658#endif
39659
Daniel Veillard42595322004-11-08 10:52:06 +000039660 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039661}
39662
39663
39664static int
39665test_xmlUCSIsYiSyllables(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039666 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039667
William M. Brack21e4ef22005-01-02 09:53:13 +000039668#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039669 int mem_base;
39670 int ret_val;
39671 int code; /* UCS code point */
39672 int n_code;
39673
39674 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39675 mem_base = xmlMemBlocks();
39676 code = gen_int(n_code, 0);
39677
39678 ret_val = xmlUCSIsYiSyllables(code);
39679 desret_int(ret_val);
39680 call_tests++;
39681 des_int(n_code, code, 0);
39682 xmlResetLastError();
39683 if (mem_base != xmlMemBlocks()) {
39684 printf("Leak of %d blocks found in xmlUCSIsYiSyllables",
39685 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039686 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039687 printf(" %d", n_code);
39688 printf("\n");
39689 }
39690 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039691 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039692#endif
39693
Daniel Veillard42595322004-11-08 10:52:06 +000039694 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039695}
39696
39697
39698static int
39699test_xmlUCSIsYijingHexagramSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039700 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039701
William M. Brack21e4ef22005-01-02 09:53:13 +000039702#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039703 int mem_base;
39704 int ret_val;
39705 int code; /* UCS code point */
39706 int n_code;
39707
39708 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39709 mem_base = xmlMemBlocks();
39710 code = gen_int(n_code, 0);
39711
39712 ret_val = xmlUCSIsYijingHexagramSymbols(code);
39713 desret_int(ret_val);
39714 call_tests++;
39715 des_int(n_code, code, 0);
39716 xmlResetLastError();
39717 if (mem_base != xmlMemBlocks()) {
39718 printf("Leak of %d blocks found in xmlUCSIsYijingHexagramSymbols",
39719 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039720 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039721 printf(" %d", n_code);
39722 printf("\n");
39723 }
39724 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039725 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039726#endif
39727
Daniel Veillard42595322004-11-08 10:52:06 +000039728 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039729}
39730
39731static int
39732test_xmlunicode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039733 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039734
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039735 if (quiet == 0) printf("Testing xmlunicode : 166 of 166 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000039736 test_ret += test_xmlUCSIsAegeanNumbers();
39737 test_ret += test_xmlUCSIsAlphabeticPresentationForms();
39738 test_ret += test_xmlUCSIsArabic();
39739 test_ret += test_xmlUCSIsArabicPresentationFormsA();
39740 test_ret += test_xmlUCSIsArabicPresentationFormsB();
39741 test_ret += test_xmlUCSIsArmenian();
39742 test_ret += test_xmlUCSIsArrows();
39743 test_ret += test_xmlUCSIsBasicLatin();
39744 test_ret += test_xmlUCSIsBengali();
39745 test_ret += test_xmlUCSIsBlock();
39746 test_ret += test_xmlUCSIsBlockElements();
39747 test_ret += test_xmlUCSIsBopomofo();
39748 test_ret += test_xmlUCSIsBopomofoExtended();
39749 test_ret += test_xmlUCSIsBoxDrawing();
39750 test_ret += test_xmlUCSIsBraillePatterns();
39751 test_ret += test_xmlUCSIsBuhid();
39752 test_ret += test_xmlUCSIsByzantineMusicalSymbols();
39753 test_ret += test_xmlUCSIsCJKCompatibility();
39754 test_ret += test_xmlUCSIsCJKCompatibilityForms();
39755 test_ret += test_xmlUCSIsCJKCompatibilityIdeographs();
39756 test_ret += test_xmlUCSIsCJKCompatibilityIdeographsSupplement();
39757 test_ret += test_xmlUCSIsCJKRadicalsSupplement();
39758 test_ret += test_xmlUCSIsCJKSymbolsandPunctuation();
39759 test_ret += test_xmlUCSIsCJKUnifiedIdeographs();
39760 test_ret += test_xmlUCSIsCJKUnifiedIdeographsExtensionA();
39761 test_ret += test_xmlUCSIsCJKUnifiedIdeographsExtensionB();
39762 test_ret += test_xmlUCSIsCat();
39763 test_ret += test_xmlUCSIsCatC();
39764 test_ret += test_xmlUCSIsCatCc();
39765 test_ret += test_xmlUCSIsCatCf();
39766 test_ret += test_xmlUCSIsCatCo();
39767 test_ret += test_xmlUCSIsCatCs();
39768 test_ret += test_xmlUCSIsCatL();
39769 test_ret += test_xmlUCSIsCatLl();
39770 test_ret += test_xmlUCSIsCatLm();
39771 test_ret += test_xmlUCSIsCatLo();
39772 test_ret += test_xmlUCSIsCatLt();
39773 test_ret += test_xmlUCSIsCatLu();
39774 test_ret += test_xmlUCSIsCatM();
39775 test_ret += test_xmlUCSIsCatMc();
39776 test_ret += test_xmlUCSIsCatMe();
39777 test_ret += test_xmlUCSIsCatMn();
39778 test_ret += test_xmlUCSIsCatN();
39779 test_ret += test_xmlUCSIsCatNd();
39780 test_ret += test_xmlUCSIsCatNl();
39781 test_ret += test_xmlUCSIsCatNo();
39782 test_ret += test_xmlUCSIsCatP();
39783 test_ret += test_xmlUCSIsCatPc();
39784 test_ret += test_xmlUCSIsCatPd();
39785 test_ret += test_xmlUCSIsCatPe();
39786 test_ret += test_xmlUCSIsCatPf();
39787 test_ret += test_xmlUCSIsCatPi();
39788 test_ret += test_xmlUCSIsCatPo();
39789 test_ret += test_xmlUCSIsCatPs();
39790 test_ret += test_xmlUCSIsCatS();
39791 test_ret += test_xmlUCSIsCatSc();
39792 test_ret += test_xmlUCSIsCatSk();
39793 test_ret += test_xmlUCSIsCatSm();
39794 test_ret += test_xmlUCSIsCatSo();
39795 test_ret += test_xmlUCSIsCatZ();
39796 test_ret += test_xmlUCSIsCatZl();
39797 test_ret += test_xmlUCSIsCatZp();
39798 test_ret += test_xmlUCSIsCatZs();
39799 test_ret += test_xmlUCSIsCherokee();
39800 test_ret += test_xmlUCSIsCombiningDiacriticalMarks();
39801 test_ret += test_xmlUCSIsCombiningDiacriticalMarksforSymbols();
39802 test_ret += test_xmlUCSIsCombiningHalfMarks();
39803 test_ret += test_xmlUCSIsCombiningMarksforSymbols();
39804 test_ret += test_xmlUCSIsControlPictures();
39805 test_ret += test_xmlUCSIsCurrencySymbols();
39806 test_ret += test_xmlUCSIsCypriotSyllabary();
39807 test_ret += test_xmlUCSIsCyrillic();
39808 test_ret += test_xmlUCSIsCyrillicSupplement();
39809 test_ret += test_xmlUCSIsDeseret();
39810 test_ret += test_xmlUCSIsDevanagari();
39811 test_ret += test_xmlUCSIsDingbats();
39812 test_ret += test_xmlUCSIsEnclosedAlphanumerics();
39813 test_ret += test_xmlUCSIsEnclosedCJKLettersandMonths();
39814 test_ret += test_xmlUCSIsEthiopic();
39815 test_ret += test_xmlUCSIsGeneralPunctuation();
39816 test_ret += test_xmlUCSIsGeometricShapes();
39817 test_ret += test_xmlUCSIsGeorgian();
39818 test_ret += test_xmlUCSIsGothic();
39819 test_ret += test_xmlUCSIsGreek();
39820 test_ret += test_xmlUCSIsGreekExtended();
39821 test_ret += test_xmlUCSIsGreekandCoptic();
39822 test_ret += test_xmlUCSIsGujarati();
39823 test_ret += test_xmlUCSIsGurmukhi();
39824 test_ret += test_xmlUCSIsHalfwidthandFullwidthForms();
39825 test_ret += test_xmlUCSIsHangulCompatibilityJamo();
39826 test_ret += test_xmlUCSIsHangulJamo();
39827 test_ret += test_xmlUCSIsHangulSyllables();
39828 test_ret += test_xmlUCSIsHanunoo();
39829 test_ret += test_xmlUCSIsHebrew();
39830 test_ret += test_xmlUCSIsHighPrivateUseSurrogates();
39831 test_ret += test_xmlUCSIsHighSurrogates();
39832 test_ret += test_xmlUCSIsHiragana();
39833 test_ret += test_xmlUCSIsIPAExtensions();
39834 test_ret += test_xmlUCSIsIdeographicDescriptionCharacters();
39835 test_ret += test_xmlUCSIsKanbun();
39836 test_ret += test_xmlUCSIsKangxiRadicals();
39837 test_ret += test_xmlUCSIsKannada();
39838 test_ret += test_xmlUCSIsKatakana();
39839 test_ret += test_xmlUCSIsKatakanaPhoneticExtensions();
39840 test_ret += test_xmlUCSIsKhmer();
39841 test_ret += test_xmlUCSIsKhmerSymbols();
39842 test_ret += test_xmlUCSIsLao();
39843 test_ret += test_xmlUCSIsLatin1Supplement();
39844 test_ret += test_xmlUCSIsLatinExtendedA();
39845 test_ret += test_xmlUCSIsLatinExtendedAdditional();
39846 test_ret += test_xmlUCSIsLatinExtendedB();
39847 test_ret += test_xmlUCSIsLetterlikeSymbols();
39848 test_ret += test_xmlUCSIsLimbu();
39849 test_ret += test_xmlUCSIsLinearBIdeograms();
39850 test_ret += test_xmlUCSIsLinearBSyllabary();
39851 test_ret += test_xmlUCSIsLowSurrogates();
39852 test_ret += test_xmlUCSIsMalayalam();
39853 test_ret += test_xmlUCSIsMathematicalAlphanumericSymbols();
39854 test_ret += test_xmlUCSIsMathematicalOperators();
39855 test_ret += test_xmlUCSIsMiscellaneousMathematicalSymbolsA();
39856 test_ret += test_xmlUCSIsMiscellaneousMathematicalSymbolsB();
39857 test_ret += test_xmlUCSIsMiscellaneousSymbols();
39858 test_ret += test_xmlUCSIsMiscellaneousSymbolsandArrows();
39859 test_ret += test_xmlUCSIsMiscellaneousTechnical();
39860 test_ret += test_xmlUCSIsMongolian();
39861 test_ret += test_xmlUCSIsMusicalSymbols();
39862 test_ret += test_xmlUCSIsMyanmar();
39863 test_ret += test_xmlUCSIsNumberForms();
39864 test_ret += test_xmlUCSIsOgham();
39865 test_ret += test_xmlUCSIsOldItalic();
39866 test_ret += test_xmlUCSIsOpticalCharacterRecognition();
39867 test_ret += test_xmlUCSIsOriya();
39868 test_ret += test_xmlUCSIsOsmanya();
39869 test_ret += test_xmlUCSIsPhoneticExtensions();
39870 test_ret += test_xmlUCSIsPrivateUse();
39871 test_ret += test_xmlUCSIsPrivateUseArea();
39872 test_ret += test_xmlUCSIsRunic();
39873 test_ret += test_xmlUCSIsShavian();
39874 test_ret += test_xmlUCSIsSinhala();
39875 test_ret += test_xmlUCSIsSmallFormVariants();
39876 test_ret += test_xmlUCSIsSpacingModifierLetters();
39877 test_ret += test_xmlUCSIsSpecials();
39878 test_ret += test_xmlUCSIsSuperscriptsandSubscripts();
39879 test_ret += test_xmlUCSIsSupplementalArrowsA();
39880 test_ret += test_xmlUCSIsSupplementalArrowsB();
39881 test_ret += test_xmlUCSIsSupplementalMathematicalOperators();
39882 test_ret += test_xmlUCSIsSupplementaryPrivateUseAreaA();
39883 test_ret += test_xmlUCSIsSupplementaryPrivateUseAreaB();
39884 test_ret += test_xmlUCSIsSyriac();
39885 test_ret += test_xmlUCSIsTagalog();
39886 test_ret += test_xmlUCSIsTagbanwa();
39887 test_ret += test_xmlUCSIsTags();
39888 test_ret += test_xmlUCSIsTaiLe();
39889 test_ret += test_xmlUCSIsTaiXuanJingSymbols();
39890 test_ret += test_xmlUCSIsTamil();
39891 test_ret += test_xmlUCSIsTelugu();
39892 test_ret += test_xmlUCSIsThaana();
39893 test_ret += test_xmlUCSIsThai();
39894 test_ret += test_xmlUCSIsTibetan();
39895 test_ret += test_xmlUCSIsUgaritic();
39896 test_ret += test_xmlUCSIsUnifiedCanadianAboriginalSyllabics();
39897 test_ret += test_xmlUCSIsVariationSelectors();
39898 test_ret += test_xmlUCSIsVariationSelectorsSupplement();
39899 test_ret += test_xmlUCSIsYiRadicals();
39900 test_ret += test_xmlUCSIsYiSyllables();
39901 test_ret += test_xmlUCSIsYijingHexagramSymbols();
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039902
Daniel Veillard42595322004-11-08 10:52:06 +000039903 if (test_ret != 0)
39904 printf("Module xmlunicode: %d errors\n", test_ret);
39905 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039906}
39907
39908static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000039909test_xmlNewTextWriter(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039910 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039911
William M. Brack21e4ef22005-01-02 09:53:13 +000039912#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039913 int mem_base;
39914 xmlTextWriterPtr ret_val;
39915 xmlOutputBufferPtr out; /* an xmlOutputBufferPtr */
39916 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039917
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039918 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
39919 mem_base = xmlMemBlocks();
39920 out = gen_xmlOutputBufferPtr(n_out, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039921
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039922 ret_val = xmlNewTextWriter(out);
39923 if (ret_val != NULL) out = NULL;
39924 desret_xmlTextWriterPtr(ret_val);
39925 call_tests++;
39926 des_xmlOutputBufferPtr(n_out, out, 0);
39927 xmlResetLastError();
39928 if (mem_base != xmlMemBlocks()) {
39929 printf("Leak of %d blocks found in xmlNewTextWriter",
39930 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039931 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039932 printf(" %d", n_out);
39933 printf("\n");
39934 }
39935 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039936 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039937#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000039938
Daniel Veillard42595322004-11-08 10:52:06 +000039939 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039940}
39941
39942
39943static int
39944test_xmlNewTextWriterFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039945 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039946
William M. Brack21e4ef22005-01-02 09:53:13 +000039947#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039948 int mem_base;
39949 xmlTextWriterPtr ret_val;
39950 const char * uri; /* the URI of the resource for the output */
39951 int n_uri;
39952 int compression; /* compress the output? */
39953 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039954
Daniel Veillard42595322004-11-08 10:52:06 +000039955 for (n_uri = 0;n_uri < gen_nb_fileoutput;n_uri++) {
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039956 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
39957 mem_base = xmlMemBlocks();
Daniel Veillard42595322004-11-08 10:52:06 +000039958 uri = gen_fileoutput(n_uri, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039959 compression = gen_int(n_compression, 1);
39960
39961 ret_val = xmlNewTextWriterFilename(uri, compression);
39962 desret_xmlTextWriterPtr(ret_val);
39963 call_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039964 des_fileoutput(n_uri, uri, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039965 des_int(n_compression, compression, 1);
39966 xmlResetLastError();
39967 if (mem_base != xmlMemBlocks()) {
39968 printf("Leak of %d blocks found in xmlNewTextWriterFilename",
39969 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039970 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039971 printf(" %d", n_uri);
39972 printf(" %d", n_compression);
39973 printf("\n");
39974 }
39975 }
39976 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039977 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039978#endif
39979
Daniel Veillard42595322004-11-08 10:52:06 +000039980 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039981}
39982
39983
39984static int
39985test_xmlNewTextWriterMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039986 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039987
William M. Brack21e4ef22005-01-02 09:53:13 +000039988#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039989 int mem_base;
39990 xmlTextWriterPtr ret_val;
39991 xmlBufferPtr buf; /* xmlBufferPtr */
39992 int n_buf;
39993 int compression; /* compress the output? */
39994 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039995
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039996 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
39997 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
39998 mem_base = xmlMemBlocks();
39999 buf = gen_xmlBufferPtr(n_buf, 0);
40000 compression = gen_int(n_compression, 1);
40001
40002 ret_val = xmlNewTextWriterMemory(buf, compression);
40003 desret_xmlTextWriterPtr(ret_val);
40004 call_tests++;
40005 des_xmlBufferPtr(n_buf, buf, 0);
40006 des_int(n_compression, compression, 1);
40007 xmlResetLastError();
40008 if (mem_base != xmlMemBlocks()) {
40009 printf("Leak of %d blocks found in xmlNewTextWriterMemory",
40010 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040011 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040012 printf(" %d", n_buf);
40013 printf(" %d", n_compression);
40014 printf("\n");
40015 }
40016 }
40017 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040018 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040019#endif
40020
Daniel Veillard42595322004-11-08 10:52:06 +000040021 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040022}
40023
40024
40025static int
40026test_xmlNewTextWriterPushParser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040027 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040028
William M. Brack21e4ef22005-01-02 09:53:13 +000040029#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040030 int mem_base;
40031 xmlTextWriterPtr ret_val;
40032 xmlParserCtxtPtr ctxt; /* xmlParserCtxtPtr to hold the new XML document tree */
40033 int n_ctxt;
40034 int compression; /* compress the output? */
40035 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040036
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040037 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
40038 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
40039 mem_base = xmlMemBlocks();
40040 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
40041 compression = gen_int(n_compression, 1);
40042
40043 ret_val = xmlNewTextWriterPushParser(ctxt, compression);
Daniel Veillarda521d282004-11-09 14:59:59 +000040044 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;} if (ret_val != NULL) ctxt = NULL;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040045 desret_xmlTextWriterPtr(ret_val);
40046 call_tests++;
40047 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
40048 des_int(n_compression, compression, 1);
40049 xmlResetLastError();
40050 if (mem_base != xmlMemBlocks()) {
40051 printf("Leak of %d blocks found in xmlNewTextWriterPushParser",
40052 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040053 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040054 printf(" %d", n_ctxt);
40055 printf(" %d", n_compression);
40056 printf("\n");
40057 }
40058 }
40059 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040060 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040061#endif
40062
Daniel Veillard42595322004-11-08 10:52:06 +000040063 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040064}
40065
40066
40067static int
40068test_xmlNewTextWriterTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040069 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040070
William M. Brack21e4ef22005-01-02 09:53:13 +000040071#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040072 int mem_base;
40073 xmlTextWriterPtr ret_val;
40074 xmlDocPtr doc; /* xmlDocPtr */
40075 int n_doc;
40076 xmlNodePtr node; /* xmlNodePtr or NULL for doc->children */
40077 int n_node;
40078 int compression; /* compress the output? */
40079 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040080
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040081 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
40082 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
40083 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
40084 mem_base = xmlMemBlocks();
40085 doc = gen_xmlDocPtr(n_doc, 0);
40086 node = gen_xmlNodePtr(n_node, 1);
40087 compression = gen_int(n_compression, 2);
40088
40089 ret_val = xmlNewTextWriterTree(doc, node, compression);
40090 desret_xmlTextWriterPtr(ret_val);
40091 call_tests++;
40092 des_xmlDocPtr(n_doc, doc, 0);
40093 des_xmlNodePtr(n_node, node, 1);
40094 des_int(n_compression, compression, 2);
40095 xmlResetLastError();
40096 if (mem_base != xmlMemBlocks()) {
40097 printf("Leak of %d blocks found in xmlNewTextWriterTree",
40098 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040099 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040100 printf(" %d", n_doc);
40101 printf(" %d", n_node);
40102 printf(" %d", n_compression);
40103 printf("\n");
40104 }
40105 }
40106 }
40107 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040108 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040109#endif
40110
Daniel Veillard42595322004-11-08 10:52:06 +000040111 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040112}
40113
40114
40115static int
40116test_xmlTextWriterEndAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040117 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040118
William M. Brack21e4ef22005-01-02 09:53:13 +000040119#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040120 int mem_base;
40121 int ret_val;
40122 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40123 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040124
Daniel Veillarde43cc572004-11-03 11:50:29 +000040125 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40126 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040127 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040128
40129 ret_val = xmlTextWriterEndAttribute(writer);
40130 desret_int(ret_val);
40131 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040132 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040133 xmlResetLastError();
40134 if (mem_base != xmlMemBlocks()) {
40135 printf("Leak of %d blocks found in xmlTextWriterEndAttribute",
40136 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040137 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040138 printf(" %d", n_writer);
40139 printf("\n");
40140 }
40141 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040142 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040143#endif
40144
Daniel Veillard42595322004-11-08 10:52:06 +000040145 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040146}
40147
40148
40149static int
40150test_xmlTextWriterEndCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040151 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040152
William M. Brack21e4ef22005-01-02 09:53:13 +000040153#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040154 int mem_base;
40155 int ret_val;
40156 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40157 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040158
Daniel Veillarde43cc572004-11-03 11:50:29 +000040159 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40160 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040161 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040162
40163 ret_val = xmlTextWriterEndCDATA(writer);
40164 desret_int(ret_val);
40165 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040166 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040167 xmlResetLastError();
40168 if (mem_base != xmlMemBlocks()) {
40169 printf("Leak of %d blocks found in xmlTextWriterEndCDATA",
40170 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040171 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040172 printf(" %d", n_writer);
40173 printf("\n");
40174 }
40175 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040176 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040177#endif
40178
Daniel Veillard42595322004-11-08 10:52:06 +000040179 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040180}
40181
40182
40183static int
40184test_xmlTextWriterEndComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040185 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040186
William M. Brack21e4ef22005-01-02 09:53:13 +000040187#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040188 int mem_base;
40189 int ret_val;
40190 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40191 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040192
Daniel Veillarde43cc572004-11-03 11:50:29 +000040193 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40194 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040195 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040196
40197 ret_val = xmlTextWriterEndComment(writer);
40198 desret_int(ret_val);
40199 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040200 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040201 xmlResetLastError();
40202 if (mem_base != xmlMemBlocks()) {
40203 printf("Leak of %d blocks found in xmlTextWriterEndComment",
40204 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040205 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040206 printf(" %d", n_writer);
40207 printf("\n");
40208 }
40209 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040210 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040211#endif
40212
Daniel Veillard42595322004-11-08 10:52:06 +000040213 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040214}
40215
40216
40217static int
40218test_xmlTextWriterEndDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040219 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040220
William M. Brack21e4ef22005-01-02 09:53:13 +000040221#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040222 int mem_base;
40223 int ret_val;
40224 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40225 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040226
Daniel Veillarde43cc572004-11-03 11:50:29 +000040227 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40228 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040229 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040230
40231 ret_val = xmlTextWriterEndDTD(writer);
40232 desret_int(ret_val);
40233 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040234 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040235 xmlResetLastError();
40236 if (mem_base != xmlMemBlocks()) {
40237 printf("Leak of %d blocks found in xmlTextWriterEndDTD",
40238 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040239 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040240 printf(" %d", n_writer);
40241 printf("\n");
40242 }
40243 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040244 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040245#endif
40246
Daniel Veillard42595322004-11-08 10:52:06 +000040247 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040248}
40249
40250
40251static int
40252test_xmlTextWriterEndDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040253 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040254
William M. Brack21e4ef22005-01-02 09:53:13 +000040255#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040256 int mem_base;
40257 int ret_val;
40258 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40259 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040260
Daniel Veillarde43cc572004-11-03 11:50:29 +000040261 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40262 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040263 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040264
40265 ret_val = xmlTextWriterEndDTDAttlist(writer);
40266 desret_int(ret_val);
40267 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040268 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040269 xmlResetLastError();
40270 if (mem_base != xmlMemBlocks()) {
40271 printf("Leak of %d blocks found in xmlTextWriterEndDTDAttlist",
40272 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040273 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040274 printf(" %d", n_writer);
40275 printf("\n");
40276 }
40277 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040278 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040279#endif
40280
Daniel Veillard42595322004-11-08 10:52:06 +000040281 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040282}
40283
40284
40285static int
40286test_xmlTextWriterEndDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040287 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040288
William M. Brack21e4ef22005-01-02 09:53:13 +000040289#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040290 int mem_base;
40291 int ret_val;
40292 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40293 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040294
Daniel Veillarde43cc572004-11-03 11:50:29 +000040295 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40296 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040297 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040298
40299 ret_val = xmlTextWriterEndDTDElement(writer);
40300 desret_int(ret_val);
40301 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040302 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040303 xmlResetLastError();
40304 if (mem_base != xmlMemBlocks()) {
40305 printf("Leak of %d blocks found in xmlTextWriterEndDTDElement",
40306 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040307 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040308 printf(" %d", n_writer);
40309 printf("\n");
40310 }
40311 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040312 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040313#endif
40314
Daniel Veillard42595322004-11-08 10:52:06 +000040315 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040316}
40317
40318
40319static int
40320test_xmlTextWriterEndDTDEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040321 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040322
William M. Brack21e4ef22005-01-02 09:53:13 +000040323#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040324 int mem_base;
40325 int ret_val;
40326 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40327 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040328
Daniel Veillarde43cc572004-11-03 11:50:29 +000040329 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40330 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040331 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040332
40333 ret_val = xmlTextWriterEndDTDEntity(writer);
40334 desret_int(ret_val);
40335 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040336 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040337 xmlResetLastError();
40338 if (mem_base != xmlMemBlocks()) {
40339 printf("Leak of %d blocks found in xmlTextWriterEndDTDEntity",
40340 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040341 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040342 printf(" %d", n_writer);
40343 printf("\n");
40344 }
40345 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040346 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040347#endif
40348
Daniel Veillard42595322004-11-08 10:52:06 +000040349 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040350}
40351
40352
40353static int
40354test_xmlTextWriterEndDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040355 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040356
William M. Brack21e4ef22005-01-02 09:53:13 +000040357#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040358 int mem_base;
40359 int ret_val;
40360 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40361 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040362
Daniel Veillarde43cc572004-11-03 11:50:29 +000040363 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40364 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040365 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040366
40367 ret_val = xmlTextWriterEndDocument(writer);
40368 desret_int(ret_val);
40369 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040370 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040371 xmlResetLastError();
40372 if (mem_base != xmlMemBlocks()) {
40373 printf("Leak of %d blocks found in xmlTextWriterEndDocument",
40374 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040375 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040376 printf(" %d", n_writer);
40377 printf("\n");
40378 }
40379 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040380 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040381#endif
40382
Daniel Veillard42595322004-11-08 10:52:06 +000040383 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040384}
40385
40386
40387static int
40388test_xmlTextWriterEndElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040389 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040390
William M. Brack21e4ef22005-01-02 09:53:13 +000040391#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040392 int mem_base;
40393 int ret_val;
40394 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40395 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040396
Daniel Veillarde43cc572004-11-03 11:50:29 +000040397 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40398 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040399 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040400
40401 ret_val = xmlTextWriterEndElement(writer);
40402 desret_int(ret_val);
40403 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040404 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040405 xmlResetLastError();
40406 if (mem_base != xmlMemBlocks()) {
40407 printf("Leak of %d blocks found in xmlTextWriterEndElement",
40408 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040409 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040410 printf(" %d", n_writer);
40411 printf("\n");
40412 }
40413 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040414 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040415#endif
40416
Daniel Veillard42595322004-11-08 10:52:06 +000040417 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040418}
40419
40420
40421static int
40422test_xmlTextWriterEndPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040423 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040424
William M. Brack21e4ef22005-01-02 09:53:13 +000040425#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040426 int mem_base;
40427 int ret_val;
40428 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40429 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040430
Daniel Veillarde43cc572004-11-03 11:50:29 +000040431 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40432 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040433 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040434
40435 ret_val = xmlTextWriterEndPI(writer);
40436 desret_int(ret_val);
40437 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040438 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040439 xmlResetLastError();
40440 if (mem_base != xmlMemBlocks()) {
40441 printf("Leak of %d blocks found in xmlTextWriterEndPI",
40442 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040443 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040444 printf(" %d", n_writer);
40445 printf("\n");
40446 }
40447 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040448 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040449#endif
40450
Daniel Veillard42595322004-11-08 10:52:06 +000040451 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040452}
40453
40454
40455static int
40456test_xmlTextWriterFlush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040457 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040458
William M. Brack21e4ef22005-01-02 09:53:13 +000040459#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040460 int mem_base;
40461 int ret_val;
40462 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40463 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040464
Daniel Veillarde43cc572004-11-03 11:50:29 +000040465 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40466 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040467 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040468
40469 ret_val = xmlTextWriterFlush(writer);
40470 desret_int(ret_val);
40471 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040472 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040473 xmlResetLastError();
40474 if (mem_base != xmlMemBlocks()) {
40475 printf("Leak of %d blocks found in xmlTextWriterFlush",
40476 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040477 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040478 printf(" %d", n_writer);
40479 printf("\n");
40480 }
40481 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040482 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040483#endif
40484
Daniel Veillard42595322004-11-08 10:52:06 +000040485 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040486}
40487
40488
40489static int
40490test_xmlTextWriterFullEndElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040491 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040492
William M. Brack21e4ef22005-01-02 09:53:13 +000040493#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040494 int mem_base;
40495 int ret_val;
40496 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40497 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040498
Daniel Veillarde43cc572004-11-03 11:50:29 +000040499 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40500 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040501 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040502
40503 ret_val = xmlTextWriterFullEndElement(writer);
40504 desret_int(ret_val);
40505 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040506 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040507 xmlResetLastError();
40508 if (mem_base != xmlMemBlocks()) {
40509 printf("Leak of %d blocks found in xmlTextWriterFullEndElement",
40510 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040511 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040512 printf(" %d", n_writer);
40513 printf("\n");
40514 }
40515 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040516 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040517#endif
40518
Daniel Veillard42595322004-11-08 10:52:06 +000040519 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040520}
40521
40522
40523static int
40524test_xmlTextWriterSetIndent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040525 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040526
William M. Brack21e4ef22005-01-02 09:53:13 +000040527#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040528 int mem_base;
40529 int ret_val;
40530 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40531 int n_writer;
40532 int indent; /* do indentation? */
40533 int n_indent;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040534
Daniel Veillarde43cc572004-11-03 11:50:29 +000040535 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40536 for (n_indent = 0;n_indent < gen_nb_int;n_indent++) {
40537 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040538 writer = gen_xmlTextWriterPtr(n_writer, 0);
40539 indent = gen_int(n_indent, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040540
40541 ret_val = xmlTextWriterSetIndent(writer, indent);
40542 desret_int(ret_val);
40543 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040544 des_xmlTextWriterPtr(n_writer, writer, 0);
40545 des_int(n_indent, indent, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040546 xmlResetLastError();
40547 if (mem_base != xmlMemBlocks()) {
40548 printf("Leak of %d blocks found in xmlTextWriterSetIndent",
40549 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040550 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040551 printf(" %d", n_writer);
40552 printf(" %d", n_indent);
40553 printf("\n");
40554 }
40555 }
40556 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040557 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040558#endif
40559
Daniel Veillard42595322004-11-08 10:52:06 +000040560 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040561}
40562
40563
40564static int
40565test_xmlTextWriterSetIndentString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040566 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040567
William M. Brack21e4ef22005-01-02 09:53:13 +000040568#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040569 int mem_base;
40570 int ret_val;
40571 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40572 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040573 xmlChar * str; /* the xmlChar string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040574 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040575
Daniel Veillarde43cc572004-11-03 11:50:29 +000040576 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40577 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
40578 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040579 writer = gen_xmlTextWriterPtr(n_writer, 0);
40580 str = gen_const_xmlChar_ptr(n_str, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040581
William M. Brackf13f77f2004-11-12 16:03:48 +000040582 ret_val = xmlTextWriterSetIndentString(writer, (const xmlChar *)str);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040583 desret_int(ret_val);
40584 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040585 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000040586 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040587 xmlResetLastError();
40588 if (mem_base != xmlMemBlocks()) {
40589 printf("Leak of %d blocks found in xmlTextWriterSetIndentString",
40590 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040591 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040592 printf(" %d", n_writer);
40593 printf(" %d", n_str);
40594 printf("\n");
40595 }
40596 }
40597 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040598 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040599#endif
40600
Daniel Veillard42595322004-11-08 10:52:06 +000040601 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040602}
40603
40604
40605static int
40606test_xmlTextWriterStartAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040607 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040608
William M. Brack21e4ef22005-01-02 09:53:13 +000040609#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040610 int mem_base;
40611 int ret_val;
40612 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40613 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040614 xmlChar * name; /* element name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040615 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040616
Daniel Veillarde43cc572004-11-03 11:50:29 +000040617 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40618 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40619 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040620 writer = gen_xmlTextWriterPtr(n_writer, 0);
40621 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040622
William M. Brackf13f77f2004-11-12 16:03:48 +000040623 ret_val = xmlTextWriterStartAttribute(writer, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040624 desret_int(ret_val);
40625 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040626 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000040627 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040628 xmlResetLastError();
40629 if (mem_base != xmlMemBlocks()) {
40630 printf("Leak of %d blocks found in xmlTextWriterStartAttribute",
40631 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040632 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040633 printf(" %d", n_writer);
40634 printf(" %d", n_name);
40635 printf("\n");
40636 }
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_xmlTextWriterStartAttributeNS(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 Veillardce682bc2004-11-05 17:22:25 +000040655 xmlChar * prefix; /* namespace prefix or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040656 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040657 xmlChar * name; /* element local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040658 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040659 xmlChar * namespaceURI; /* namespace URI or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040660 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040661
Daniel Veillarde43cc572004-11-03 11:50:29 +000040662 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40663 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
40664 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40665 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
40666 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040667 writer = gen_xmlTextWriterPtr(n_writer, 0);
40668 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
40669 name = gen_const_xmlChar_ptr(n_name, 2);
40670 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040671
William M. Brackf13f77f2004-11-12 16:03:48 +000040672 ret_val = xmlTextWriterStartAttributeNS(writer, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)namespaceURI);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040673 desret_int(ret_val);
40674 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040675 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000040676 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
40677 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
40678 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040679 xmlResetLastError();
40680 if (mem_base != xmlMemBlocks()) {
40681 printf("Leak of %d blocks found in xmlTextWriterStartAttributeNS",
40682 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040683 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040684 printf(" %d", n_writer);
40685 printf(" %d", n_prefix);
40686 printf(" %d", n_name);
40687 printf(" %d", n_namespaceURI);
40688 printf("\n");
40689 }
40690 }
40691 }
40692 }
40693 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040694 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040695#endif
40696
Daniel Veillard42595322004-11-08 10:52:06 +000040697 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040698}
40699
40700
40701static int
40702test_xmlTextWriterStartCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040703 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040704
William M. Brack21e4ef22005-01-02 09:53:13 +000040705#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040706 int mem_base;
40707 int ret_val;
40708 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40709 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040710
Daniel Veillarde43cc572004-11-03 11:50:29 +000040711 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40712 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040713 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040714
40715 ret_val = xmlTextWriterStartCDATA(writer);
40716 desret_int(ret_val);
40717 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040718 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040719 xmlResetLastError();
40720 if (mem_base != xmlMemBlocks()) {
40721 printf("Leak of %d blocks found in xmlTextWriterStartCDATA",
40722 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040723 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040724 printf(" %d", n_writer);
40725 printf("\n");
40726 }
40727 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040728 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040729#endif
40730
Daniel Veillard42595322004-11-08 10:52:06 +000040731 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040732}
40733
40734
40735static int
40736test_xmlTextWriterStartComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040737 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040738
William M. Brack21e4ef22005-01-02 09:53:13 +000040739#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040740 int mem_base;
40741 int ret_val;
40742 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40743 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040744
Daniel Veillarde43cc572004-11-03 11:50:29 +000040745 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40746 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040747 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040748
40749 ret_val = xmlTextWriterStartComment(writer);
40750 desret_int(ret_val);
40751 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040752 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040753 xmlResetLastError();
40754 if (mem_base != xmlMemBlocks()) {
40755 printf("Leak of %d blocks found in xmlTextWriterStartComment",
40756 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040757 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040758 printf(" %d", n_writer);
40759 printf("\n");
40760 }
40761 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040762 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040763#endif
40764
Daniel Veillard42595322004-11-08 10:52:06 +000040765 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040766}
40767
40768
40769static int
40770test_xmlTextWriterStartDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040771 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040772
William M. Brack21e4ef22005-01-02 09:53:13 +000040773#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040774 int mem_base;
40775 int ret_val;
40776 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40777 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040778 xmlChar * name; /* the name of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040779 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040780 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040781 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040782 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040783 int n_sysid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040784
Daniel Veillarde43cc572004-11-03 11:50:29 +000040785 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40786 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40787 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
40788 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
40789 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040790 writer = gen_xmlTextWriterPtr(n_writer, 0);
40791 name = gen_const_xmlChar_ptr(n_name, 1);
40792 pubid = gen_const_xmlChar_ptr(n_pubid, 2);
40793 sysid = gen_const_xmlChar_ptr(n_sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040794
William M. Brackf13f77f2004-11-12 16:03:48 +000040795 ret_val = xmlTextWriterStartDTD(writer, (const xmlChar *)name, (const xmlChar *)pubid, (const xmlChar *)sysid);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040796 desret_int(ret_val);
40797 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040798 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000040799 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
40800 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 2);
40801 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040802 xmlResetLastError();
40803 if (mem_base != xmlMemBlocks()) {
40804 printf("Leak of %d blocks found in xmlTextWriterStartDTD",
40805 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040806 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040807 printf(" %d", n_writer);
40808 printf(" %d", n_name);
40809 printf(" %d", n_pubid);
40810 printf(" %d", n_sysid);
40811 printf("\n");
40812 }
40813 }
40814 }
40815 }
40816 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040817 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040818#endif
40819
Daniel Veillard42595322004-11-08 10:52:06 +000040820 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040821}
40822
40823
40824static int
40825test_xmlTextWriterStartDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040826 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040827
William M. Brack21e4ef22005-01-02 09:53:13 +000040828#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040829 int mem_base;
40830 int ret_val;
40831 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40832 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040833 xmlChar * name; /* the name of the DTD ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040834 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040835
Daniel Veillarde43cc572004-11-03 11:50:29 +000040836 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40837 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40838 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040839 writer = gen_xmlTextWriterPtr(n_writer, 0);
40840 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040841
William M. Brackf13f77f2004-11-12 16:03:48 +000040842 ret_val = xmlTextWriterStartDTDAttlist(writer, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040843 desret_int(ret_val);
40844 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040845 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000040846 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040847 xmlResetLastError();
40848 if (mem_base != xmlMemBlocks()) {
40849 printf("Leak of %d blocks found in xmlTextWriterStartDTDAttlist",
40850 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040851 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040852 printf(" %d", n_writer);
40853 printf(" %d", n_name);
40854 printf("\n");
40855 }
40856 }
40857 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040858 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040859#endif
40860
Daniel Veillard42595322004-11-08 10:52:06 +000040861 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040862}
40863
40864
40865static int
40866test_xmlTextWriterStartDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040867 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040868
William M. Brack21e4ef22005-01-02 09:53:13 +000040869#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040870 int mem_base;
40871 int ret_val;
40872 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40873 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040874 xmlChar * name; /* the name of the DTD element */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040875 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040876
Daniel Veillarde43cc572004-11-03 11:50:29 +000040877 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40878 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40879 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040880 writer = gen_xmlTextWriterPtr(n_writer, 0);
40881 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040882
William M. Brackf13f77f2004-11-12 16:03:48 +000040883 ret_val = xmlTextWriterStartDTDElement(writer, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040884 desret_int(ret_val);
40885 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040886 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000040887 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040888 xmlResetLastError();
40889 if (mem_base != xmlMemBlocks()) {
40890 printf("Leak of %d blocks found in xmlTextWriterStartDTDElement",
40891 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040892 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040893 printf(" %d", n_writer);
40894 printf(" %d", n_name);
40895 printf("\n");
40896 }
40897 }
40898 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040899 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040900#endif
40901
Daniel Veillard42595322004-11-08 10:52:06 +000040902 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040903}
40904
40905
40906static int
40907test_xmlTextWriterStartDTDEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040908 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040909
William M. Brack21e4ef22005-01-02 09:53:13 +000040910#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040911 int mem_base;
40912 int ret_val;
40913 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40914 int n_writer;
40915 int pe; /* TRUE if this is a parameter entity, FALSE if not */
40916 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040917 xmlChar * name; /* the name of the DTD ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040918 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040919
Daniel Veillarde43cc572004-11-03 11:50:29 +000040920 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40921 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
40922 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40923 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040924 writer = gen_xmlTextWriterPtr(n_writer, 0);
40925 pe = gen_int(n_pe, 1);
40926 name = gen_const_xmlChar_ptr(n_name, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040927
William M. Brackf13f77f2004-11-12 16:03:48 +000040928 ret_val = xmlTextWriterStartDTDEntity(writer, pe, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040929 desret_int(ret_val);
40930 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040931 des_xmlTextWriterPtr(n_writer, writer, 0);
40932 des_int(n_pe, pe, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000040933 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040934 xmlResetLastError();
40935 if (mem_base != xmlMemBlocks()) {
40936 printf("Leak of %d blocks found in xmlTextWriterStartDTDEntity",
40937 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040938 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040939 printf(" %d", n_writer);
40940 printf(" %d", n_pe);
40941 printf(" %d", n_name);
40942 printf("\n");
40943 }
40944 }
40945 }
40946 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040947 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040948#endif
40949
Daniel Veillard42595322004-11-08 10:52:06 +000040950 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040951}
40952
40953
40954static int
40955test_xmlTextWriterStartDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040956 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040957
William M. Brack21e4ef22005-01-02 09:53:13 +000040958#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040959 int mem_base;
40960 int ret_val;
40961 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40962 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040963 char * version; /* the xml version ("1.0") or NULL for default ("1.0") */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040964 int n_version;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040965 char * encoding; /* the encoding or NULL for default */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040966 int n_encoding;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040967 char * standalone; /* "yes" or "no" or NULL for default */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040968 int n_standalone;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040969
Daniel Veillarde43cc572004-11-03 11:50:29 +000040970 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40971 for (n_version = 0;n_version < gen_nb_const_char_ptr;n_version++) {
40972 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
40973 for (n_standalone = 0;n_standalone < gen_nb_const_char_ptr;n_standalone++) {
40974 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040975 writer = gen_xmlTextWriterPtr(n_writer, 0);
40976 version = gen_const_char_ptr(n_version, 1);
40977 encoding = gen_const_char_ptr(n_encoding, 2);
40978 standalone = gen_const_char_ptr(n_standalone, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040979
William M. Brackf13f77f2004-11-12 16:03:48 +000040980 ret_val = xmlTextWriterStartDocument(writer, (const char *)version, (const char *)encoding, (const char *)standalone);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040981 desret_int(ret_val);
40982 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040983 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000040984 des_const_char_ptr(n_version, (const char *)version, 1);
40985 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
40986 des_const_char_ptr(n_standalone, (const char *)standalone, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040987 xmlResetLastError();
40988 if (mem_base != xmlMemBlocks()) {
40989 printf("Leak of %d blocks found in xmlTextWriterStartDocument",
40990 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040991 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040992 printf(" %d", n_writer);
40993 printf(" %d", n_version);
40994 printf(" %d", n_encoding);
40995 printf(" %d", n_standalone);
40996 printf("\n");
40997 }
40998 }
40999 }
41000 }
41001 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041002 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041003#endif
41004
Daniel Veillard42595322004-11-08 10:52:06 +000041005 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041006}
41007
41008
41009static int
41010test_xmlTextWriterStartElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041011 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041012
William M. Brack21e4ef22005-01-02 09:53:13 +000041013#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041014 int mem_base;
41015 int ret_val;
41016 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41017 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041018 xmlChar * name; /* element name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041019 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041020
Daniel Veillarde43cc572004-11-03 11:50:29 +000041021 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41022 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41023 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041024 writer = gen_xmlTextWriterPtr(n_writer, 0);
41025 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041026
William M. Brackf13f77f2004-11-12 16:03:48 +000041027 ret_val = xmlTextWriterStartElement(writer, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041028 desret_int(ret_val);
41029 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041030 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041031 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041032 xmlResetLastError();
41033 if (mem_base != xmlMemBlocks()) {
41034 printf("Leak of %d blocks found in xmlTextWriterStartElement",
41035 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041036 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041037 printf(" %d", n_writer);
41038 printf(" %d", n_name);
41039 printf("\n");
41040 }
41041 }
41042 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041043 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041044#endif
41045
Daniel Veillard42595322004-11-08 10:52:06 +000041046 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041047}
41048
41049
41050static int
41051test_xmlTextWriterStartElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041052 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041053
William M. Brack21e4ef22005-01-02 09:53:13 +000041054#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041055 int mem_base;
41056 int ret_val;
41057 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41058 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041059 xmlChar * prefix; /* namespace prefix or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041060 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041061 xmlChar * name; /* element local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041062 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041063 xmlChar * namespaceURI; /* namespace URI or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041064 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041065
Daniel Veillarde43cc572004-11-03 11:50:29 +000041066 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41067 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
41068 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41069 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
41070 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041071 writer = gen_xmlTextWriterPtr(n_writer, 0);
41072 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
41073 name = gen_const_xmlChar_ptr(n_name, 2);
41074 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041075
William M. Brackf13f77f2004-11-12 16:03:48 +000041076 ret_val = xmlTextWriterStartElementNS(writer, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)namespaceURI);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041077 desret_int(ret_val);
41078 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041079 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041080 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
41081 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
41082 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041083 xmlResetLastError();
41084 if (mem_base != xmlMemBlocks()) {
41085 printf("Leak of %d blocks found in xmlTextWriterStartElementNS",
41086 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041087 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041088 printf(" %d", n_writer);
41089 printf(" %d", n_prefix);
41090 printf(" %d", n_name);
41091 printf(" %d", n_namespaceURI);
41092 printf("\n");
41093 }
41094 }
41095 }
41096 }
41097 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041098 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041099#endif
41100
Daniel Veillard42595322004-11-08 10:52:06 +000041101 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041102}
41103
41104
41105static int
41106test_xmlTextWriterStartPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041107 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041108
William M. Brack21e4ef22005-01-02 09:53:13 +000041109#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041110 int mem_base;
41111 int ret_val;
41112 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41113 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041114 xmlChar * target; /* PI target */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041115 int n_target;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041116
Daniel Veillarde43cc572004-11-03 11:50:29 +000041117 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41118 for (n_target = 0;n_target < gen_nb_const_xmlChar_ptr;n_target++) {
41119 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041120 writer = gen_xmlTextWriterPtr(n_writer, 0);
41121 target = gen_const_xmlChar_ptr(n_target, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041122
William M. Brackf13f77f2004-11-12 16:03:48 +000041123 ret_val = xmlTextWriterStartPI(writer, (const xmlChar *)target);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041124 desret_int(ret_val);
41125 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041126 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041127 des_const_xmlChar_ptr(n_target, (const xmlChar *)target, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041128 xmlResetLastError();
41129 if (mem_base != xmlMemBlocks()) {
41130 printf("Leak of %d blocks found in xmlTextWriterStartPI",
41131 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041132 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041133 printf(" %d", n_writer);
41134 printf(" %d", n_target);
41135 printf("\n");
41136 }
41137 }
41138 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041139 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041140#endif
41141
Daniel Veillard42595322004-11-08 10:52:06 +000041142 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041143}
41144
41145
41146static int
41147test_xmlTextWriterWriteAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041148 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041149
William M. Brack21e4ef22005-01-02 09:53:13 +000041150#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041151 int mem_base;
41152 int ret_val;
41153 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41154 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041155 xmlChar * name; /* attribute name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041156 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041157 xmlChar * content; /* attribute content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041158 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041159
Daniel Veillarde43cc572004-11-03 11:50:29 +000041160 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41161 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41162 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41163 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041164 writer = gen_xmlTextWriterPtr(n_writer, 0);
41165 name = gen_const_xmlChar_ptr(n_name, 1);
41166 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041167
William M. Brackf13f77f2004-11-12 16:03:48 +000041168 ret_val = xmlTextWriterWriteAttribute(writer, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041169 desret_int(ret_val);
41170 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041171 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041172 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
41173 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041174 xmlResetLastError();
41175 if (mem_base != xmlMemBlocks()) {
41176 printf("Leak of %d blocks found in xmlTextWriterWriteAttribute",
41177 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041178 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041179 printf(" %d", n_writer);
41180 printf(" %d", n_name);
41181 printf(" %d", n_content);
41182 printf("\n");
41183 }
41184 }
41185 }
41186 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041187 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041188#endif
41189
Daniel Veillard42595322004-11-08 10:52:06 +000041190 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041191}
41192
41193
41194static int
41195test_xmlTextWriterWriteAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041196 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041197
William M. Brack21e4ef22005-01-02 09:53:13 +000041198#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041199 int mem_base;
41200 int ret_val;
41201 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41202 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041203 xmlChar * prefix; /* namespace prefix */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041204 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041205 xmlChar * name; /* attribute local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041206 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041207 xmlChar * namespaceURI; /* namespace URI */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041208 int n_namespaceURI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041209 xmlChar * content; /* attribute content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041210 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041211
Daniel Veillarde43cc572004-11-03 11:50:29 +000041212 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41213 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
41214 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41215 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
41216 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41217 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041218 writer = gen_xmlTextWriterPtr(n_writer, 0);
41219 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
41220 name = gen_const_xmlChar_ptr(n_name, 2);
41221 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
41222 content = gen_const_xmlChar_ptr(n_content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041223
William M. Brackf13f77f2004-11-12 16:03:48 +000041224 ret_val = xmlTextWriterWriteAttributeNS(writer, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)namespaceURI, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041225 desret_int(ret_val);
41226 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041227 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041228 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
41229 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
41230 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 3);
41231 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041232 xmlResetLastError();
41233 if (mem_base != xmlMemBlocks()) {
41234 printf("Leak of %d blocks found in xmlTextWriterWriteAttributeNS",
41235 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041236 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041237 printf(" %d", n_writer);
41238 printf(" %d", n_prefix);
41239 printf(" %d", n_name);
41240 printf(" %d", n_namespaceURI);
41241 printf(" %d", n_content);
41242 printf("\n");
41243 }
41244 }
41245 }
41246 }
41247 }
41248 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041249 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041250#endif
41251
Daniel Veillard42595322004-11-08 10:52:06 +000041252 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041253}
41254
41255
41256static int
41257test_xmlTextWriterWriteBase64(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041258 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041259
William M. Brack21e4ef22005-01-02 09:53:13 +000041260#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041261 int mem_base;
41262 int ret_val;
41263 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41264 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041265 char * data; /* binary data */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041266 int n_data;
41267 int start; /* the position within the data of the first byte to encode */
41268 int n_start;
41269 int len; /* the number of bytes to encode */
41270 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041271
Daniel Veillarde43cc572004-11-03 11:50:29 +000041272 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41273 for (n_data = 0;n_data < gen_nb_const_char_ptr;n_data++) {
41274 for (n_start = 0;n_start < gen_nb_int;n_start++) {
41275 for (n_len = 0;n_len < gen_nb_int;n_len++) {
41276 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041277 writer = gen_xmlTextWriterPtr(n_writer, 0);
41278 data = gen_const_char_ptr(n_data, 1);
41279 start = gen_int(n_start, 2);
41280 len = gen_int(n_len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041281
William M. Brackf13f77f2004-11-12 16:03:48 +000041282 ret_val = xmlTextWriterWriteBase64(writer, (const char *)data, start, len);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041283 desret_int(ret_val);
41284 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041285 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041286 des_const_char_ptr(n_data, (const char *)data, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000041287 des_int(n_start, start, 2);
41288 des_int(n_len, len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041289 xmlResetLastError();
41290 if (mem_base != xmlMemBlocks()) {
41291 printf("Leak of %d blocks found in xmlTextWriterWriteBase64",
41292 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041293 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041294 printf(" %d", n_writer);
41295 printf(" %d", n_data);
41296 printf(" %d", n_start);
41297 printf(" %d", n_len);
41298 printf("\n");
41299 }
41300 }
41301 }
41302 }
41303 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041304 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041305#endif
41306
Daniel Veillard42595322004-11-08 10:52:06 +000041307 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041308}
41309
41310
41311static int
41312test_xmlTextWriterWriteBinHex(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041313 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041314
William M. Brack21e4ef22005-01-02 09:53:13 +000041315#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041316 int mem_base;
41317 int ret_val;
41318 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41319 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041320 char * data; /* binary data */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041321 int n_data;
41322 int start; /* the position within the data of the first byte to encode */
41323 int n_start;
41324 int len; /* the number of bytes to encode */
41325 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041326
Daniel Veillarde43cc572004-11-03 11:50:29 +000041327 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41328 for (n_data = 0;n_data < gen_nb_const_char_ptr;n_data++) {
41329 for (n_start = 0;n_start < gen_nb_int;n_start++) {
41330 for (n_len = 0;n_len < gen_nb_int;n_len++) {
41331 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041332 writer = gen_xmlTextWriterPtr(n_writer, 0);
41333 data = gen_const_char_ptr(n_data, 1);
41334 start = gen_int(n_start, 2);
41335 len = gen_int(n_len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041336
William M. Brackf13f77f2004-11-12 16:03:48 +000041337 ret_val = xmlTextWriterWriteBinHex(writer, (const char *)data, start, len);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041338 desret_int(ret_val);
41339 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041340 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041341 des_const_char_ptr(n_data, (const char *)data, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000041342 des_int(n_start, start, 2);
41343 des_int(n_len, len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041344 xmlResetLastError();
41345 if (mem_base != xmlMemBlocks()) {
41346 printf("Leak of %d blocks found in xmlTextWriterWriteBinHex",
41347 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041348 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041349 printf(" %d", n_writer);
41350 printf(" %d", n_data);
41351 printf(" %d", n_start);
41352 printf(" %d", n_len);
41353 printf("\n");
41354 }
41355 }
41356 }
41357 }
41358 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041359 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041360#endif
41361
Daniel Veillard42595322004-11-08 10:52:06 +000041362 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041363}
41364
41365
41366static int
41367test_xmlTextWriterWriteCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041368 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041369
William M. Brack21e4ef22005-01-02 09:53:13 +000041370#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041371 int mem_base;
41372 int ret_val;
41373 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41374 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041375 xmlChar * content; /* CDATA content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041376 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041377
Daniel Veillarde43cc572004-11-03 11:50:29 +000041378 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41379 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41380 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041381 writer = gen_xmlTextWriterPtr(n_writer, 0);
41382 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041383
William M. Brackf13f77f2004-11-12 16:03:48 +000041384 ret_val = xmlTextWriterWriteCDATA(writer, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041385 desret_int(ret_val);
41386 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041387 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041388 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041389 xmlResetLastError();
41390 if (mem_base != xmlMemBlocks()) {
41391 printf("Leak of %d blocks found in xmlTextWriterWriteCDATA",
41392 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041393 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041394 printf(" %d", n_writer);
41395 printf(" %d", n_content);
41396 printf("\n");
41397 }
41398 }
41399 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041400 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041401#endif
41402
Daniel Veillard42595322004-11-08 10:52:06 +000041403 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041404}
41405
41406
41407static int
41408test_xmlTextWriterWriteComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041409 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041410
William M. Brack21e4ef22005-01-02 09:53:13 +000041411#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041412 int mem_base;
41413 int ret_val;
41414 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41415 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041416 xmlChar * content; /* comment string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041417 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041418
Daniel Veillarde43cc572004-11-03 11:50:29 +000041419 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41420 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41421 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041422 writer = gen_xmlTextWriterPtr(n_writer, 0);
41423 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041424
William M. Brackf13f77f2004-11-12 16:03:48 +000041425 ret_val = xmlTextWriterWriteComment(writer, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041426 desret_int(ret_val);
41427 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041428 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041429 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041430 xmlResetLastError();
41431 if (mem_base != xmlMemBlocks()) {
41432 printf("Leak of %d blocks found in xmlTextWriterWriteComment",
41433 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041434 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041435 printf(" %d", n_writer);
41436 printf(" %d", n_content);
41437 printf("\n");
41438 }
41439 }
41440 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041441 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041442#endif
41443
Daniel Veillard42595322004-11-08 10:52:06 +000041444 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041445}
41446
41447
41448static int
41449test_xmlTextWriterWriteDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041450 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041451
William M. Brack21e4ef22005-01-02 09:53:13 +000041452#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041453 int mem_base;
41454 int ret_val;
41455 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41456 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041457 xmlChar * name; /* the name of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041458 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041459 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041460 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041461 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041462 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041463 xmlChar * subset; /* string content of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041464 int n_subset;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041465
Daniel Veillarde43cc572004-11-03 11:50:29 +000041466 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41467 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41468 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
41469 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
41470 for (n_subset = 0;n_subset < gen_nb_const_xmlChar_ptr;n_subset++) {
41471 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041472 writer = gen_xmlTextWriterPtr(n_writer, 0);
41473 name = gen_const_xmlChar_ptr(n_name, 1);
41474 pubid = gen_const_xmlChar_ptr(n_pubid, 2);
41475 sysid = gen_const_xmlChar_ptr(n_sysid, 3);
41476 subset = gen_const_xmlChar_ptr(n_subset, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041477
William M. Brackf13f77f2004-11-12 16:03:48 +000041478 ret_val = xmlTextWriterWriteDTD(writer, (const xmlChar *)name, (const xmlChar *)pubid, (const xmlChar *)sysid, (const xmlChar *)subset);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041479 desret_int(ret_val);
41480 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041481 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041482 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
41483 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 2);
41484 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 3);
41485 des_const_xmlChar_ptr(n_subset, (const xmlChar *)subset, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041486 xmlResetLastError();
41487 if (mem_base != xmlMemBlocks()) {
41488 printf("Leak of %d blocks found in xmlTextWriterWriteDTD",
41489 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041490 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041491 printf(" %d", n_writer);
41492 printf(" %d", n_name);
41493 printf(" %d", n_pubid);
41494 printf(" %d", n_sysid);
41495 printf(" %d", n_subset);
41496 printf("\n");
41497 }
41498 }
41499 }
41500 }
41501 }
41502 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041503 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041504#endif
41505
Daniel Veillard42595322004-11-08 10:52:06 +000041506 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041507}
41508
41509
41510static int
41511test_xmlTextWriterWriteDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041512 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041513
William M. Brack21e4ef22005-01-02 09:53:13 +000041514#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041515 int mem_base;
41516 int ret_val;
41517 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41518 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041519 xmlChar * name; /* the name of the DTD ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041520 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041521 xmlChar * content; /* content of the ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041522 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041523
Daniel Veillarde43cc572004-11-03 11:50:29 +000041524 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41525 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41526 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41527 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041528 writer = gen_xmlTextWriterPtr(n_writer, 0);
41529 name = gen_const_xmlChar_ptr(n_name, 1);
41530 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041531
William M. Brackf13f77f2004-11-12 16:03:48 +000041532 ret_val = xmlTextWriterWriteDTDAttlist(writer, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041533 desret_int(ret_val);
41534 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041535 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041536 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
41537 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041538 xmlResetLastError();
41539 if (mem_base != xmlMemBlocks()) {
41540 printf("Leak of %d blocks found in xmlTextWriterWriteDTDAttlist",
41541 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041542 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041543 printf(" %d", n_writer);
41544 printf(" %d", n_name);
41545 printf(" %d", n_content);
41546 printf("\n");
41547 }
41548 }
41549 }
41550 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041551 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041552#endif
41553
Daniel Veillard42595322004-11-08 10:52:06 +000041554 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041555}
41556
41557
41558static int
41559test_xmlTextWriterWriteDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041560 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041561
William M. Brack21e4ef22005-01-02 09:53:13 +000041562#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041563 int mem_base;
41564 int ret_val;
41565 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41566 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041567 xmlChar * name; /* the name of the DTD element */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041568 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041569 xmlChar * content; /* content of the element */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041570 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041571
Daniel Veillarde43cc572004-11-03 11:50:29 +000041572 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41573 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41574 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41575 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041576 writer = gen_xmlTextWriterPtr(n_writer, 0);
41577 name = gen_const_xmlChar_ptr(n_name, 1);
41578 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041579
William M. Brackf13f77f2004-11-12 16:03:48 +000041580 ret_val = xmlTextWriterWriteDTDElement(writer, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041581 desret_int(ret_val);
41582 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041583 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041584 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
41585 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041586 xmlResetLastError();
41587 if (mem_base != xmlMemBlocks()) {
41588 printf("Leak of %d blocks found in xmlTextWriterWriteDTDElement",
41589 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041590 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041591 printf(" %d", n_writer);
41592 printf(" %d", n_name);
41593 printf(" %d", n_content);
41594 printf("\n");
41595 }
41596 }
41597 }
41598 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041599 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041600#endif
41601
Daniel Veillard42595322004-11-08 10:52:06 +000041602 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041603}
41604
41605
41606static int
41607test_xmlTextWriterWriteDTDEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041608 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041609
William M. Brack21e4ef22005-01-02 09:53:13 +000041610#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041611 int mem_base;
41612 int ret_val;
41613 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41614 int n_writer;
41615 int pe; /* TRUE if this is a parameter entity, FALSE if not */
41616 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041617 xmlChar * name; /* the name of the DTD entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041618 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041619 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041620 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041621 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041622 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041623 xmlChar * ndataid; /* the xml notation name. */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041624 int n_ndataid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041625 xmlChar * content; /* content of the entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041626 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041627
Daniel Veillarde43cc572004-11-03 11:50:29 +000041628 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41629 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
41630 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41631 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
41632 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
41633 for (n_ndataid = 0;n_ndataid < gen_nb_const_xmlChar_ptr;n_ndataid++) {
41634 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41635 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041636 writer = gen_xmlTextWriterPtr(n_writer, 0);
41637 pe = gen_int(n_pe, 1);
41638 name = gen_const_xmlChar_ptr(n_name, 2);
41639 pubid = gen_const_xmlChar_ptr(n_pubid, 3);
41640 sysid = gen_const_xmlChar_ptr(n_sysid, 4);
41641 ndataid = gen_const_xmlChar_ptr(n_ndataid, 5);
41642 content = gen_const_xmlChar_ptr(n_content, 6);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041643
William M. Brackf13f77f2004-11-12 16:03:48 +000041644 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 +000041645 desret_int(ret_val);
41646 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041647 des_xmlTextWriterPtr(n_writer, writer, 0);
41648 des_int(n_pe, pe, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000041649 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
41650 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 3);
41651 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 4);
41652 des_const_xmlChar_ptr(n_ndataid, (const xmlChar *)ndataid, 5);
41653 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 6);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041654 xmlResetLastError();
41655 if (mem_base != xmlMemBlocks()) {
41656 printf("Leak of %d blocks found in xmlTextWriterWriteDTDEntity",
41657 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041658 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041659 printf(" %d", n_writer);
41660 printf(" %d", n_pe);
41661 printf(" %d", n_name);
41662 printf(" %d", n_pubid);
41663 printf(" %d", n_sysid);
41664 printf(" %d", n_ndataid);
41665 printf(" %d", n_content);
41666 printf("\n");
41667 }
41668 }
41669 }
41670 }
41671 }
41672 }
41673 }
41674 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041675 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041676#endif
41677
Daniel Veillard42595322004-11-08 10:52:06 +000041678 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041679}
41680
41681
41682static int
41683test_xmlTextWriterWriteDTDExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041684 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041685
William M. Brack21e4ef22005-01-02 09:53:13 +000041686#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041687 int mem_base;
41688 int ret_val;
41689 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41690 int n_writer;
41691 int pe; /* TRUE if this is a parameter entity, FALSE if not */
41692 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041693 xmlChar * name; /* the name of the DTD entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041694 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041695 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041696 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041697 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041698 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041699 xmlChar * ndataid; /* the xml notation name. */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041700 int n_ndataid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041701
Daniel Veillarde43cc572004-11-03 11:50:29 +000041702 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41703 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
41704 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41705 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
41706 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
41707 for (n_ndataid = 0;n_ndataid < gen_nb_const_xmlChar_ptr;n_ndataid++) {
41708 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041709 writer = gen_xmlTextWriterPtr(n_writer, 0);
41710 pe = gen_int(n_pe, 1);
41711 name = gen_const_xmlChar_ptr(n_name, 2);
41712 pubid = gen_const_xmlChar_ptr(n_pubid, 3);
41713 sysid = gen_const_xmlChar_ptr(n_sysid, 4);
41714 ndataid = gen_const_xmlChar_ptr(n_ndataid, 5);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041715
William M. Brackf13f77f2004-11-12 16:03:48 +000041716 ret_val = xmlTextWriterWriteDTDExternalEntity(writer, pe, (const xmlChar *)name, (const xmlChar *)pubid, (const xmlChar *)sysid, (const xmlChar *)ndataid);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041717 desret_int(ret_val);
41718 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041719 des_xmlTextWriterPtr(n_writer, writer, 0);
41720 des_int(n_pe, pe, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000041721 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
41722 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 3);
41723 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 4);
41724 des_const_xmlChar_ptr(n_ndataid, (const xmlChar *)ndataid, 5);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041725 xmlResetLastError();
41726 if (mem_base != xmlMemBlocks()) {
41727 printf("Leak of %d blocks found in xmlTextWriterWriteDTDExternalEntity",
41728 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041729 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041730 printf(" %d", n_writer);
41731 printf(" %d", n_pe);
41732 printf(" %d", n_name);
41733 printf(" %d", n_pubid);
41734 printf(" %d", n_sysid);
41735 printf(" %d", n_ndataid);
41736 printf("\n");
41737 }
41738 }
41739 }
41740 }
41741 }
41742 }
41743 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041744 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041745#endif
41746
Daniel Veillard42595322004-11-08 10:52:06 +000041747 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041748}
41749
41750
41751static int
41752test_xmlTextWriterWriteDTDExternalEntityContents(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041753 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041754
William M. Brack21e4ef22005-01-02 09:53:13 +000041755#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041756 int mem_base;
41757 int ret_val;
41758 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41759 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041760 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041761 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041762 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041763 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041764 xmlChar * ndataid; /* the xml notation name. */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041765 int n_ndataid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041766
Daniel Veillarde43cc572004-11-03 11:50:29 +000041767 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41768 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
41769 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
41770 for (n_ndataid = 0;n_ndataid < gen_nb_const_xmlChar_ptr;n_ndataid++) {
41771 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041772 writer = gen_xmlTextWriterPtr(n_writer, 0);
41773 pubid = gen_const_xmlChar_ptr(n_pubid, 1);
41774 sysid = gen_const_xmlChar_ptr(n_sysid, 2);
41775 ndataid = gen_const_xmlChar_ptr(n_ndataid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041776
William M. Brackf13f77f2004-11-12 16:03:48 +000041777 ret_val = xmlTextWriterWriteDTDExternalEntityContents(writer, (const xmlChar *)pubid, (const xmlChar *)sysid, (const xmlChar *)ndataid);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041778 desret_int(ret_val);
41779 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041780 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041781 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 1);
41782 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 2);
41783 des_const_xmlChar_ptr(n_ndataid, (const xmlChar *)ndataid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041784 xmlResetLastError();
41785 if (mem_base != xmlMemBlocks()) {
41786 printf("Leak of %d blocks found in xmlTextWriterWriteDTDExternalEntityContents",
41787 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041788 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041789 printf(" %d", n_writer);
41790 printf(" %d", n_pubid);
41791 printf(" %d", n_sysid);
41792 printf(" %d", n_ndataid);
41793 printf("\n");
41794 }
41795 }
41796 }
41797 }
41798 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041799 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041800#endif
41801
Daniel Veillard42595322004-11-08 10:52:06 +000041802 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041803}
41804
41805
41806static int
41807test_xmlTextWriterWriteDTDInternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041808 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041809
William M. Brack21e4ef22005-01-02 09:53:13 +000041810#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041811 int mem_base;
41812 int ret_val;
41813 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41814 int n_writer;
41815 int pe; /* TRUE if this is a parameter entity, FALSE if not */
41816 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041817 xmlChar * name; /* the name of the DTD entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041818 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041819 xmlChar * content; /* content of the entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041820 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041821
Daniel Veillarde43cc572004-11-03 11:50:29 +000041822 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41823 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
41824 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41825 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41826 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041827 writer = gen_xmlTextWriterPtr(n_writer, 0);
41828 pe = gen_int(n_pe, 1);
41829 name = gen_const_xmlChar_ptr(n_name, 2);
41830 content = gen_const_xmlChar_ptr(n_content, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041831
William M. Brackf13f77f2004-11-12 16:03:48 +000041832 ret_val = xmlTextWriterWriteDTDInternalEntity(writer, pe, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041833 desret_int(ret_val);
41834 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041835 des_xmlTextWriterPtr(n_writer, writer, 0);
41836 des_int(n_pe, pe, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000041837 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
41838 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041839 xmlResetLastError();
41840 if (mem_base != xmlMemBlocks()) {
41841 printf("Leak of %d blocks found in xmlTextWriterWriteDTDInternalEntity",
41842 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041843 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041844 printf(" %d", n_writer);
41845 printf(" %d", n_pe);
41846 printf(" %d", n_name);
41847 printf(" %d", n_content);
41848 printf("\n");
41849 }
41850 }
41851 }
41852 }
41853 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041854 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041855#endif
41856
Daniel Veillard42595322004-11-08 10:52:06 +000041857 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041858}
41859
41860
41861static int
41862test_xmlTextWriterWriteDTDNotation(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041863 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041864
William M. Brack21e4ef22005-01-02 09:53:13 +000041865#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041866 int mem_base;
41867 int ret_val;
41868 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41869 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041870 xmlChar * name; /* the name of the xml notation */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041871 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041872 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041873 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041874 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041875 int n_sysid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041876
Daniel Veillarde43cc572004-11-03 11:50:29 +000041877 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41878 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41879 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
41880 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
41881 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041882 writer = gen_xmlTextWriterPtr(n_writer, 0);
41883 name = gen_const_xmlChar_ptr(n_name, 1);
41884 pubid = gen_const_xmlChar_ptr(n_pubid, 2);
41885 sysid = gen_const_xmlChar_ptr(n_sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041886
William M. Brackf13f77f2004-11-12 16:03:48 +000041887 ret_val = xmlTextWriterWriteDTDNotation(writer, (const xmlChar *)name, (const xmlChar *)pubid, (const xmlChar *)sysid);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041888 desret_int(ret_val);
41889 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041890 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041891 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
41892 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 2);
41893 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041894 xmlResetLastError();
41895 if (mem_base != xmlMemBlocks()) {
41896 printf("Leak of %d blocks found in xmlTextWriterWriteDTDNotation",
41897 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041898 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041899 printf(" %d", n_writer);
41900 printf(" %d", n_name);
41901 printf(" %d", n_pubid);
41902 printf(" %d", n_sysid);
41903 printf("\n");
41904 }
41905 }
41906 }
41907 }
41908 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041909 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041910#endif
41911
Daniel Veillard42595322004-11-08 10:52:06 +000041912 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041913}
41914
41915
41916static int
41917test_xmlTextWriterWriteElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041918 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041919
William M. Brack21e4ef22005-01-02 09:53:13 +000041920#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041921 int mem_base;
41922 int ret_val;
41923 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41924 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041925 xmlChar * name; /* element name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041926 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041927 xmlChar * content; /* element content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041928 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041929
Daniel Veillarde43cc572004-11-03 11:50:29 +000041930 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41931 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41932 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41933 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041934 writer = gen_xmlTextWriterPtr(n_writer, 0);
41935 name = gen_const_xmlChar_ptr(n_name, 1);
41936 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041937
William M. Brackf13f77f2004-11-12 16:03:48 +000041938 ret_val = xmlTextWriterWriteElement(writer, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041939 desret_int(ret_val);
41940 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041941 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041942 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
41943 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041944 xmlResetLastError();
41945 if (mem_base != xmlMemBlocks()) {
41946 printf("Leak of %d blocks found in xmlTextWriterWriteElement",
41947 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041948 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041949 printf(" %d", n_writer);
41950 printf(" %d", n_name);
41951 printf(" %d", n_content);
41952 printf("\n");
41953 }
41954 }
41955 }
41956 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041957 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041958#endif
41959
Daniel Veillard42595322004-11-08 10:52:06 +000041960 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041961}
41962
41963
41964static int
41965test_xmlTextWriterWriteElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041966 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041967
William M. Brack21e4ef22005-01-02 09:53:13 +000041968#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041969 int mem_base;
41970 int ret_val;
41971 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41972 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041973 xmlChar * prefix; /* namespace prefix */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041974 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041975 xmlChar * name; /* element local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041976 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041977 xmlChar * namespaceURI; /* namespace URI */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041978 int n_namespaceURI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041979 xmlChar * content; /* element content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041980 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041981
Daniel Veillarde43cc572004-11-03 11:50:29 +000041982 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41983 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
41984 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41985 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
41986 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41987 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041988 writer = gen_xmlTextWriterPtr(n_writer, 0);
41989 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
41990 name = gen_const_xmlChar_ptr(n_name, 2);
41991 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
41992 content = gen_const_xmlChar_ptr(n_content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041993
William M. Brackf13f77f2004-11-12 16:03:48 +000041994 ret_val = xmlTextWriterWriteElementNS(writer, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)namespaceURI, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041995 desret_int(ret_val);
41996 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041997 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041998 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
41999 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
42000 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 3);
42001 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042002 xmlResetLastError();
42003 if (mem_base != xmlMemBlocks()) {
42004 printf("Leak of %d blocks found in xmlTextWriterWriteElementNS",
42005 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042006 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042007 printf(" %d", n_writer);
42008 printf(" %d", n_prefix);
42009 printf(" %d", n_name);
42010 printf(" %d", n_namespaceURI);
42011 printf(" %d", n_content);
42012 printf("\n");
42013 }
42014 }
42015 }
42016 }
42017 }
42018 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042019 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042020#endif
42021
Daniel Veillard42595322004-11-08 10:52:06 +000042022 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042023}
42024
42025
42026static int
42027test_xmlTextWriterWriteFormatAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042028 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042029
42030
42031 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042032 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042033}
42034
42035
42036static int
42037test_xmlTextWriterWriteFormatAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042038 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042039
42040
42041 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042042 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042043}
42044
42045
42046static int
42047test_xmlTextWriterWriteFormatCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042048 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042049
42050
42051 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042052 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042053}
42054
42055
42056static int
42057test_xmlTextWriterWriteFormatComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042058 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042059
42060
42061 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042062 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042063}
42064
42065
42066static int
42067test_xmlTextWriterWriteFormatDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042068 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042069
42070
42071 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042072 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042073}
42074
42075
42076static int
42077test_xmlTextWriterWriteFormatDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042078 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042079
42080
42081 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042082 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042083}
42084
42085
42086static int
42087test_xmlTextWriterWriteFormatDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042088 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042089
42090
42091 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042092 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042093}
42094
42095
42096static int
42097test_xmlTextWriterWriteFormatDTDInternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042098 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042099
42100
42101 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042102 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042103}
42104
42105
42106static int
42107test_xmlTextWriterWriteFormatElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042108 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042109
42110
42111 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042112 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042113}
42114
42115
42116static int
42117test_xmlTextWriterWriteFormatElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042118 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042119
42120
42121 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042122 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042123}
42124
42125
42126static int
42127test_xmlTextWriterWriteFormatPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042128 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042129
42130
42131 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042132 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042133}
42134
42135
42136static int
42137test_xmlTextWriterWriteFormatRaw(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042138 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042139
42140
42141 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042142 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042143}
42144
42145
42146static int
42147test_xmlTextWriterWriteFormatString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042148 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042149
42150
42151 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042152 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042153}
42154
42155
42156static int
42157test_xmlTextWriterWritePI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042158 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042159
William M. Brack21e4ef22005-01-02 09:53:13 +000042160#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042161 int mem_base;
42162 int ret_val;
42163 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42164 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042165 xmlChar * target; /* PI target */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042166 int n_target;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042167 xmlChar * content; /* PI content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042168 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042169
Daniel Veillarde43cc572004-11-03 11:50:29 +000042170 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42171 for (n_target = 0;n_target < gen_nb_const_xmlChar_ptr;n_target++) {
42172 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42173 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042174 writer = gen_xmlTextWriterPtr(n_writer, 0);
42175 target = gen_const_xmlChar_ptr(n_target, 1);
42176 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042177
William M. Brackf13f77f2004-11-12 16:03:48 +000042178 ret_val = xmlTextWriterWritePI(writer, (const xmlChar *)target, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042179 desret_int(ret_val);
42180 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042181 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042182 des_const_xmlChar_ptr(n_target, (const xmlChar *)target, 1);
42183 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042184 xmlResetLastError();
42185 if (mem_base != xmlMemBlocks()) {
42186 printf("Leak of %d blocks found in xmlTextWriterWritePI",
42187 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042188 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042189 printf(" %d", n_writer);
42190 printf(" %d", n_target);
42191 printf(" %d", n_content);
42192 printf("\n");
42193 }
42194 }
42195 }
42196 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042197 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042198#endif
42199
Daniel Veillard42595322004-11-08 10:52:06 +000042200 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042201}
42202
42203
42204static int
42205test_xmlTextWriterWriteRaw(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042206 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042207
William M. Brack21e4ef22005-01-02 09:53:13 +000042208#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042209 int mem_base;
42210 int ret_val;
42211 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42212 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042213 xmlChar * content; /* text string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042214 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042215
Daniel Veillarde43cc572004-11-03 11:50:29 +000042216 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42217 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42218 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042219 writer = gen_xmlTextWriterPtr(n_writer, 0);
42220 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042221
William M. Brackf13f77f2004-11-12 16:03:48 +000042222 ret_val = xmlTextWriterWriteRaw(writer, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042223 desret_int(ret_val);
42224 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042225 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042226 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042227 xmlResetLastError();
42228 if (mem_base != xmlMemBlocks()) {
42229 printf("Leak of %d blocks found in xmlTextWriterWriteRaw",
42230 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042231 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042232 printf(" %d", n_writer);
42233 printf(" %d", n_content);
42234 printf("\n");
42235 }
42236 }
42237 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042238 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042239#endif
42240
Daniel Veillard42595322004-11-08 10:52:06 +000042241 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042242}
42243
42244
42245static int
42246test_xmlTextWriterWriteRawLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042247 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042248
William M. Brack21e4ef22005-01-02 09:53:13 +000042249#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042250 int mem_base;
42251 int ret_val;
42252 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42253 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042254 xmlChar * content; /* text string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042255 int n_content;
42256 int len; /* length of the text string */
42257 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042258
Daniel Veillarde43cc572004-11-03 11:50:29 +000042259 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42260 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42261 for (n_len = 0;n_len < gen_nb_int;n_len++) {
42262 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042263 writer = gen_xmlTextWriterPtr(n_writer, 0);
42264 content = gen_const_xmlChar_ptr(n_content, 1);
42265 len = gen_int(n_len, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042266
William M. Brackf13f77f2004-11-12 16:03:48 +000042267 ret_val = xmlTextWriterWriteRawLen(writer, (const xmlChar *)content, len);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042268 desret_int(ret_val);
42269 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042270 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042271 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000042272 des_int(n_len, len, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042273 xmlResetLastError();
42274 if (mem_base != xmlMemBlocks()) {
42275 printf("Leak of %d blocks found in xmlTextWriterWriteRawLen",
42276 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042277 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042278 printf(" %d", n_writer);
42279 printf(" %d", n_content);
42280 printf(" %d", n_len);
42281 printf("\n");
42282 }
42283 }
42284 }
42285 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042286 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042287#endif
42288
Daniel Veillard42595322004-11-08 10:52:06 +000042289 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042290}
42291
42292
42293static int
42294test_xmlTextWriterWriteString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042295 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042296
William M. Brack21e4ef22005-01-02 09:53:13 +000042297#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042298 int mem_base;
42299 int ret_val;
42300 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42301 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042302 xmlChar * content; /* text string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042303 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042304
Daniel Veillarde43cc572004-11-03 11:50:29 +000042305 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42306 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42307 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042308 writer = gen_xmlTextWriterPtr(n_writer, 0);
42309 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042310
William M. Brackf13f77f2004-11-12 16:03:48 +000042311 ret_val = xmlTextWriterWriteString(writer, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042312 desret_int(ret_val);
42313 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042314 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042315 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042316 xmlResetLastError();
42317 if (mem_base != xmlMemBlocks()) {
42318 printf("Leak of %d blocks found in xmlTextWriterWriteString",
42319 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042320 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042321 printf(" %d", n_writer);
42322 printf(" %d", n_content);
42323 printf("\n");
42324 }
42325 }
42326 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042327 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042328#endif
42329
Daniel Veillard42595322004-11-08 10:52:06 +000042330 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042331}
42332
42333
42334static int
42335test_xmlTextWriterWriteVFormatAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042336 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042337
42338
42339 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042340 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042341}
42342
42343
42344static int
42345test_xmlTextWriterWriteVFormatAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042346 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042347
42348
42349 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042350 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042351}
42352
42353
42354static int
42355test_xmlTextWriterWriteVFormatCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042356 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042357
42358
42359 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042360 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042361}
42362
42363
42364static int
42365test_xmlTextWriterWriteVFormatComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042366 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042367
42368
42369 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042370 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042371}
42372
42373
42374static int
42375test_xmlTextWriterWriteVFormatDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042376 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042377
42378
42379 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042380 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042381}
42382
42383
42384static int
42385test_xmlTextWriterWriteVFormatDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042386 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042387
42388
42389 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042390 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042391}
42392
42393
42394static int
42395test_xmlTextWriterWriteVFormatDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042396 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042397
42398
42399 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042400 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042401}
42402
42403
42404static int
42405test_xmlTextWriterWriteVFormatDTDInternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042406 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042407
42408
42409 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042410 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042411}
42412
42413
42414static int
42415test_xmlTextWriterWriteVFormatElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042416 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042417
42418
42419 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042420 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042421}
42422
42423
42424static int
42425test_xmlTextWriterWriteVFormatElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042426 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042427
42428
42429 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042430 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042431}
42432
42433
42434static int
42435test_xmlTextWriterWriteVFormatPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042436 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042437
42438
42439 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042440 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042441}
42442
42443
42444static int
42445test_xmlTextWriterWriteVFormatRaw(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042446 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042447
42448
42449 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042450 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042451}
42452
42453
42454static int
42455test_xmlTextWriterWriteVFormatString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042456 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042457
42458
42459 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042460 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042461}
42462
42463static int
42464test_xmlwriter(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042465 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042466
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042467 if (quiet == 0) printf("Testing xmlwriter : 51 of 79 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000042468 test_ret += test_xmlNewTextWriter();
42469 test_ret += test_xmlNewTextWriterFilename();
42470 test_ret += test_xmlNewTextWriterMemory();
42471 test_ret += test_xmlNewTextWriterPushParser();
42472 test_ret += test_xmlNewTextWriterTree();
42473 test_ret += test_xmlTextWriterEndAttribute();
42474 test_ret += test_xmlTextWriterEndCDATA();
42475 test_ret += test_xmlTextWriterEndComment();
42476 test_ret += test_xmlTextWriterEndDTD();
42477 test_ret += test_xmlTextWriterEndDTDAttlist();
42478 test_ret += test_xmlTextWriterEndDTDElement();
42479 test_ret += test_xmlTextWriterEndDTDEntity();
42480 test_ret += test_xmlTextWriterEndDocument();
42481 test_ret += test_xmlTextWriterEndElement();
42482 test_ret += test_xmlTextWriterEndPI();
42483 test_ret += test_xmlTextWriterFlush();
42484 test_ret += test_xmlTextWriterFullEndElement();
42485 test_ret += test_xmlTextWriterSetIndent();
42486 test_ret += test_xmlTextWriterSetIndentString();
42487 test_ret += test_xmlTextWriterStartAttribute();
42488 test_ret += test_xmlTextWriterStartAttributeNS();
42489 test_ret += test_xmlTextWriterStartCDATA();
42490 test_ret += test_xmlTextWriterStartComment();
42491 test_ret += test_xmlTextWriterStartDTD();
42492 test_ret += test_xmlTextWriterStartDTDAttlist();
42493 test_ret += test_xmlTextWriterStartDTDElement();
42494 test_ret += test_xmlTextWriterStartDTDEntity();
42495 test_ret += test_xmlTextWriterStartDocument();
42496 test_ret += test_xmlTextWriterStartElement();
42497 test_ret += test_xmlTextWriterStartElementNS();
42498 test_ret += test_xmlTextWriterStartPI();
42499 test_ret += test_xmlTextWriterWriteAttribute();
42500 test_ret += test_xmlTextWriterWriteAttributeNS();
42501 test_ret += test_xmlTextWriterWriteBase64();
42502 test_ret += test_xmlTextWriterWriteBinHex();
42503 test_ret += test_xmlTextWriterWriteCDATA();
42504 test_ret += test_xmlTextWriterWriteComment();
42505 test_ret += test_xmlTextWriterWriteDTD();
42506 test_ret += test_xmlTextWriterWriteDTDAttlist();
42507 test_ret += test_xmlTextWriterWriteDTDElement();
42508 test_ret += test_xmlTextWriterWriteDTDEntity();
42509 test_ret += test_xmlTextWriterWriteDTDExternalEntity();
42510 test_ret += test_xmlTextWriterWriteDTDExternalEntityContents();
42511 test_ret += test_xmlTextWriterWriteDTDInternalEntity();
42512 test_ret += test_xmlTextWriterWriteDTDNotation();
42513 test_ret += test_xmlTextWriterWriteElement();
42514 test_ret += test_xmlTextWriterWriteElementNS();
42515 test_ret += test_xmlTextWriterWriteFormatAttribute();
42516 test_ret += test_xmlTextWriterWriteFormatAttributeNS();
42517 test_ret += test_xmlTextWriterWriteFormatCDATA();
42518 test_ret += test_xmlTextWriterWriteFormatComment();
42519 test_ret += test_xmlTextWriterWriteFormatDTD();
42520 test_ret += test_xmlTextWriterWriteFormatDTDAttlist();
42521 test_ret += test_xmlTextWriterWriteFormatDTDElement();
42522 test_ret += test_xmlTextWriterWriteFormatDTDInternalEntity();
42523 test_ret += test_xmlTextWriterWriteFormatElement();
42524 test_ret += test_xmlTextWriterWriteFormatElementNS();
42525 test_ret += test_xmlTextWriterWriteFormatPI();
42526 test_ret += test_xmlTextWriterWriteFormatRaw();
42527 test_ret += test_xmlTextWriterWriteFormatString();
42528 test_ret += test_xmlTextWriterWritePI();
42529 test_ret += test_xmlTextWriterWriteRaw();
42530 test_ret += test_xmlTextWriterWriteRawLen();
42531 test_ret += test_xmlTextWriterWriteString();
42532 test_ret += test_xmlTextWriterWriteVFormatAttribute();
42533 test_ret += test_xmlTextWriterWriteVFormatAttributeNS();
42534 test_ret += test_xmlTextWriterWriteVFormatCDATA();
42535 test_ret += test_xmlTextWriterWriteVFormatComment();
42536 test_ret += test_xmlTextWriterWriteVFormatDTD();
42537 test_ret += test_xmlTextWriterWriteVFormatDTDAttlist();
42538 test_ret += test_xmlTextWriterWriteVFormatDTDElement();
42539 test_ret += test_xmlTextWriterWriteVFormatDTDInternalEntity();
42540 test_ret += test_xmlTextWriterWriteVFormatElement();
42541 test_ret += test_xmlTextWriterWriteVFormatElementNS();
42542 test_ret += test_xmlTextWriterWriteVFormatPI();
42543 test_ret += test_xmlTextWriterWriteVFormatRaw();
42544 test_ret += test_xmlTextWriterWriteVFormatString();
Daniel Veillardd93f6252004-11-02 15:53:51 +000042545
Daniel Veillard42595322004-11-08 10:52:06 +000042546 if (test_ret != 0)
42547 printf("Module xmlwriter: %d errors\n", test_ret);
42548 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042549}
42550
42551static int
42552test_xmlXPathCastBooleanToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042553 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042554
William M. Brack21e4ef22005-01-02 09:53:13 +000042555#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042556 int mem_base;
42557 double ret_val;
42558 int val; /* a boolean */
42559 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042560
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042561 for (n_val = 0;n_val < gen_nb_int;n_val++) {
42562 mem_base = xmlMemBlocks();
42563 val = gen_int(n_val, 0);
42564
42565 ret_val = xmlXPathCastBooleanToNumber(val);
42566 desret_double(ret_val);
42567 call_tests++;
42568 des_int(n_val, val, 0);
42569 xmlResetLastError();
42570 if (mem_base != xmlMemBlocks()) {
42571 printf("Leak of %d blocks found in xmlXPathCastBooleanToNumber",
42572 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042573 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042574 printf(" %d", n_val);
42575 printf("\n");
42576 }
42577 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042578 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042579#endif
42580
Daniel Veillard42595322004-11-08 10:52:06 +000042581 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042582}
42583
42584
42585static int
42586test_xmlXPathCastBooleanToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042587 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042588
William M. Brack21e4ef22005-01-02 09:53:13 +000042589#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042590 int mem_base;
42591 xmlChar * ret_val;
42592 int val; /* a boolean */
42593 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042594
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042595 for (n_val = 0;n_val < gen_nb_int;n_val++) {
42596 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042597 val = gen_int(n_val, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042598
42599 ret_val = xmlXPathCastBooleanToString(val);
42600 desret_xmlChar_ptr(ret_val);
42601 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042602 des_int(n_val, val, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042603 xmlResetLastError();
42604 if (mem_base != xmlMemBlocks()) {
42605 printf("Leak of %d blocks found in xmlXPathCastBooleanToString",
42606 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042607 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042608 printf(" %d", n_val);
42609 printf("\n");
42610 }
42611 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042612 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042613#endif
42614
Daniel Veillard42595322004-11-08 10:52:06 +000042615 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042616}
42617
42618
42619static int
42620test_xmlXPathCastNodeSetToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042621 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042622
William M. Brack21e4ef22005-01-02 09:53:13 +000042623#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000042624 int mem_base;
42625 int ret_val;
42626 xmlNodeSetPtr ns; /* a node-set */
42627 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042628
Daniel Veillardce682bc2004-11-05 17:22:25 +000042629 for (n_ns = 0;n_ns < gen_nb_xmlNodeSetPtr;n_ns++) {
42630 mem_base = xmlMemBlocks();
42631 ns = gen_xmlNodeSetPtr(n_ns, 0);
42632
42633 ret_val = xmlXPathCastNodeSetToBoolean(ns);
42634 desret_int(ret_val);
42635 call_tests++;
42636 des_xmlNodeSetPtr(n_ns, ns, 0);
42637 xmlResetLastError();
42638 if (mem_base != xmlMemBlocks()) {
42639 printf("Leak of %d blocks found in xmlXPathCastNodeSetToBoolean",
42640 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042641 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042642 printf(" %d", n_ns);
42643 printf("\n");
42644 }
42645 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042646 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042647#endif
42648
Daniel Veillard42595322004-11-08 10:52:06 +000042649 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042650}
42651
42652
42653static int
42654test_xmlXPathCastNodeSetToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042655 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042656
William M. Brack21e4ef22005-01-02 09:53:13 +000042657#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000042658 int mem_base;
42659 double ret_val;
42660 xmlNodeSetPtr ns; /* a node-set */
42661 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042662
Daniel Veillardce682bc2004-11-05 17:22:25 +000042663 for (n_ns = 0;n_ns < gen_nb_xmlNodeSetPtr;n_ns++) {
42664 mem_base = xmlMemBlocks();
42665 ns = gen_xmlNodeSetPtr(n_ns, 0);
42666
42667 ret_val = xmlXPathCastNodeSetToNumber(ns);
42668 desret_double(ret_val);
42669 call_tests++;
42670 des_xmlNodeSetPtr(n_ns, ns, 0);
42671 xmlResetLastError();
42672 if (mem_base != xmlMemBlocks()) {
42673 printf("Leak of %d blocks found in xmlXPathCastNodeSetToNumber",
42674 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042675 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042676 printf(" %d", n_ns);
42677 printf("\n");
42678 }
42679 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042680 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042681#endif
42682
Daniel Veillard42595322004-11-08 10:52:06 +000042683 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042684}
42685
42686
42687static int
42688test_xmlXPathCastNodeSetToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042689 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042690
William M. Brack21e4ef22005-01-02 09:53:13 +000042691#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000042692 int mem_base;
42693 xmlChar * ret_val;
42694 xmlNodeSetPtr ns; /* a node-set */
42695 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042696
Daniel Veillardce682bc2004-11-05 17:22:25 +000042697 for (n_ns = 0;n_ns < gen_nb_xmlNodeSetPtr;n_ns++) {
42698 mem_base = xmlMemBlocks();
42699 ns = gen_xmlNodeSetPtr(n_ns, 0);
42700
42701 ret_val = xmlXPathCastNodeSetToString(ns);
42702 desret_xmlChar_ptr(ret_val);
42703 call_tests++;
42704 des_xmlNodeSetPtr(n_ns, ns, 0);
42705 xmlResetLastError();
42706 if (mem_base != xmlMemBlocks()) {
42707 printf("Leak of %d blocks found in xmlXPathCastNodeSetToString",
42708 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042709 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042710 printf(" %d", n_ns);
42711 printf("\n");
42712 }
42713 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042714 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042715#endif
42716
Daniel Veillard42595322004-11-08 10:52:06 +000042717 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042718}
42719
42720
42721static int
42722test_xmlXPathCastNodeToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042723 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042724
William M. Brack21e4ef22005-01-02 09:53:13 +000042725#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042726 int mem_base;
42727 double ret_val;
42728 xmlNodePtr node; /* a node */
42729 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042730
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042731 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
42732 mem_base = xmlMemBlocks();
42733 node = gen_xmlNodePtr(n_node, 0);
42734
42735 ret_val = xmlXPathCastNodeToNumber(node);
42736 desret_double(ret_val);
42737 call_tests++;
42738 des_xmlNodePtr(n_node, node, 0);
42739 xmlResetLastError();
42740 if (mem_base != xmlMemBlocks()) {
42741 printf("Leak of %d blocks found in xmlXPathCastNodeToNumber",
42742 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042743 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042744 printf(" %d", n_node);
42745 printf("\n");
42746 }
42747 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042748 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042749#endif
42750
Daniel Veillard42595322004-11-08 10:52:06 +000042751 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042752}
42753
42754
42755static int
42756test_xmlXPathCastNodeToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042757 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042758
William M. Brack21e4ef22005-01-02 09:53:13 +000042759#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042760 int mem_base;
42761 xmlChar * ret_val;
42762 xmlNodePtr node; /* a node */
42763 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042764
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042765 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
42766 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042767 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042768
42769 ret_val = xmlXPathCastNodeToString(node);
42770 desret_xmlChar_ptr(ret_val);
42771 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042772 des_xmlNodePtr(n_node, node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042773 xmlResetLastError();
42774 if (mem_base != xmlMemBlocks()) {
42775 printf("Leak of %d blocks found in xmlXPathCastNodeToString",
42776 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042777 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042778 printf(" %d", n_node);
42779 printf("\n");
42780 }
42781 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042782 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042783#endif
42784
Daniel Veillard42595322004-11-08 10:52:06 +000042785 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042786}
42787
42788
42789static int
42790test_xmlXPathCastNumberToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042791 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042792
William M. Brack21e4ef22005-01-02 09:53:13 +000042793#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000042794 int mem_base;
42795 int ret_val;
42796 double val; /* a number */
42797 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042798
Daniel Veillard3d95c732004-11-06 22:25:14 +000042799 for (n_val = 0;n_val < gen_nb_double;n_val++) {
42800 mem_base = xmlMemBlocks();
42801 val = gen_double(n_val, 0);
42802
42803 ret_val = xmlXPathCastNumberToBoolean(val);
42804 desret_int(ret_val);
42805 call_tests++;
42806 des_double(n_val, val, 0);
42807 xmlResetLastError();
42808 if (mem_base != xmlMemBlocks()) {
42809 printf("Leak of %d blocks found in xmlXPathCastNumberToBoolean",
42810 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042811 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000042812 printf(" %d", n_val);
42813 printf("\n");
42814 }
42815 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042816 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000042817#endif
42818
Daniel Veillard42595322004-11-08 10:52:06 +000042819 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042820}
42821
42822
42823static int
42824test_xmlXPathCastNumberToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042825 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042826
William M. Brack21e4ef22005-01-02 09:53:13 +000042827#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000042828 int mem_base;
42829 xmlChar * ret_val;
42830 double val; /* a number */
42831 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042832
Daniel Veillard3d95c732004-11-06 22:25:14 +000042833 for (n_val = 0;n_val < gen_nb_double;n_val++) {
42834 mem_base = xmlMemBlocks();
42835 val = gen_double(n_val, 0);
42836
42837 ret_val = xmlXPathCastNumberToString(val);
42838 desret_xmlChar_ptr(ret_val);
42839 call_tests++;
42840 des_double(n_val, val, 0);
42841 xmlResetLastError();
42842 if (mem_base != xmlMemBlocks()) {
42843 printf("Leak of %d blocks found in xmlXPathCastNumberToString",
42844 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042845 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000042846 printf(" %d", n_val);
42847 printf("\n");
42848 }
42849 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042850 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000042851#endif
42852
Daniel Veillard42595322004-11-08 10:52:06 +000042853 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042854}
42855
42856
42857static int
42858test_xmlXPathCastStringToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042859 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042860
William M. Brack21e4ef22005-01-02 09:53:13 +000042861#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000042862 int mem_base;
42863 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042864 xmlChar * val; /* a string */
Daniel Veillardd93f6252004-11-02 15:53:51 +000042865 int n_val;
42866
42867 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
42868 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042869 val = gen_const_xmlChar_ptr(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042870
William M. Brackf13f77f2004-11-12 16:03:48 +000042871 ret_val = xmlXPathCastStringToBoolean((const xmlChar *)val);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042872 desret_int(ret_val);
42873 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000042874 des_const_xmlChar_ptr(n_val, (const xmlChar *)val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042875 xmlResetLastError();
42876 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000042877 printf("Leak of %d blocks found in xmlXPathCastStringToBoolean",
Daniel Veillardd93f6252004-11-02 15:53:51 +000042878 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042879 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000042880 printf(" %d", n_val);
42881 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000042882 }
42883 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042884 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042885#endif
42886
Daniel Veillard42595322004-11-08 10:52:06 +000042887 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042888}
42889
42890
42891static int
42892test_xmlXPathCastStringToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042893 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042894
William M. Brack21e4ef22005-01-02 09:53:13 +000042895#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042896 int mem_base;
42897 double ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042898 xmlChar * val; /* a string */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042899 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042900
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042901 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
42902 mem_base = xmlMemBlocks();
42903 val = gen_const_xmlChar_ptr(n_val, 0);
42904
William M. Brackf13f77f2004-11-12 16:03:48 +000042905 ret_val = xmlXPathCastStringToNumber((const xmlChar *)val);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042906 desret_double(ret_val);
42907 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000042908 des_const_xmlChar_ptr(n_val, (const xmlChar *)val, 0);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042909 xmlResetLastError();
42910 if (mem_base != xmlMemBlocks()) {
42911 printf("Leak of %d blocks found in xmlXPathCastStringToNumber",
42912 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042913 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042914 printf(" %d", n_val);
42915 printf("\n");
42916 }
42917 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042918 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042919#endif
42920
Daniel Veillard42595322004-11-08 10:52:06 +000042921 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042922}
42923
42924
42925static int
42926test_xmlXPathCastToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042927 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042928
William M. Brack21e4ef22005-01-02 09:53:13 +000042929#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042930 int mem_base;
42931 int ret_val;
42932 xmlXPathObjectPtr val; /* an XPath object */
42933 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042934
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042935 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
42936 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042937 val = gen_xmlXPathObjectPtr(n_val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042938
42939 ret_val = xmlXPathCastToBoolean(val);
42940 desret_int(ret_val);
42941 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042942 des_xmlXPathObjectPtr(n_val, val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042943 xmlResetLastError();
42944 if (mem_base != xmlMemBlocks()) {
42945 printf("Leak of %d blocks found in xmlXPathCastToBoolean",
42946 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042947 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042948 printf(" %d", n_val);
42949 printf("\n");
42950 }
42951 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042952 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042953#endif
42954
Daniel Veillard42595322004-11-08 10:52:06 +000042955 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042956}
42957
42958
42959static int
42960test_xmlXPathCastToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042961 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042962
William M. Brack21e4ef22005-01-02 09:53:13 +000042963#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042964 int mem_base;
42965 double ret_val;
42966 xmlXPathObjectPtr val; /* an XPath object */
42967 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042968
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042969 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
42970 mem_base = xmlMemBlocks();
42971 val = gen_xmlXPathObjectPtr(n_val, 0);
42972
42973 ret_val = xmlXPathCastToNumber(val);
42974 desret_double(ret_val);
42975 call_tests++;
42976 des_xmlXPathObjectPtr(n_val, val, 0);
42977 xmlResetLastError();
42978 if (mem_base != xmlMemBlocks()) {
42979 printf("Leak of %d blocks found in xmlXPathCastToNumber",
42980 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042981 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042982 printf(" %d", n_val);
42983 printf("\n");
42984 }
42985 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042986 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042987#endif
42988
Daniel Veillard42595322004-11-08 10:52:06 +000042989 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042990}
42991
42992
42993static int
42994test_xmlXPathCastToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042995 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042996
William M. Brack21e4ef22005-01-02 09:53:13 +000042997#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042998 int mem_base;
42999 xmlChar * ret_val;
43000 xmlXPathObjectPtr val; /* an XPath object */
43001 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043002
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043003 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43004 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000043005 val = gen_xmlXPathObjectPtr(n_val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043006
43007 ret_val = xmlXPathCastToString(val);
43008 desret_xmlChar_ptr(ret_val);
43009 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043010 des_xmlXPathObjectPtr(n_val, val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043011 xmlResetLastError();
43012 if (mem_base != xmlMemBlocks()) {
43013 printf("Leak of %d blocks found in xmlXPathCastToString",
43014 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043015 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043016 printf(" %d", n_val);
43017 printf("\n");
43018 }
43019 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043020 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043021#endif
43022
Daniel Veillard42595322004-11-08 10:52:06 +000043023 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043024}
43025
43026
43027static int
43028test_xmlXPathCmpNodes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043029 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043030
William M. Brack21e4ef22005-01-02 09:53:13 +000043031#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000043032 int mem_base;
43033 int ret_val;
43034 xmlNodePtr node1; /* the first node */
43035 int n_node1;
43036 xmlNodePtr node2; /* the second node */
43037 int n_node2;
43038
43039 for (n_node1 = 0;n_node1 < gen_nb_xmlNodePtr;n_node1++) {
43040 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
43041 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000043042 node1 = gen_xmlNodePtr(n_node1, 0);
43043 node2 = gen_xmlNodePtr(n_node2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043044
43045 ret_val = xmlXPathCmpNodes(node1, node2);
43046 desret_int(ret_val);
43047 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043048 des_xmlNodePtr(n_node1, node1, 0);
43049 des_xmlNodePtr(n_node2, node2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043050 xmlResetLastError();
43051 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000043052 printf("Leak of %d blocks found in xmlXPathCmpNodes",
Daniel Veillardd93f6252004-11-02 15:53:51 +000043053 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043054 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000043055 printf(" %d", n_node1);
43056 printf(" %d", n_node2);
43057 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000043058 }
43059 }
43060 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043061 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043062#endif
43063
Daniel Veillard42595322004-11-08 10:52:06 +000043064 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043065}
43066
43067
43068static int
43069test_xmlXPathCompile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043070 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043071
43072
43073 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043074 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043075}
43076
Daniel Veillarda521d282004-11-09 14:59:59 +000043077#ifdef LIBXML_XPATH_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000043078
Daniel Veillardce682bc2004-11-05 17:22:25 +000043079#define gen_nb_xmlXPathCompExprPtr 1
43080static xmlXPathCompExprPtr gen_xmlXPathCompExprPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
43081 return(NULL);
43082}
43083static void des_xmlXPathCompExprPtr(int no ATTRIBUTE_UNUSED, xmlXPathCompExprPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
43084}
Daniel Veillarda521d282004-11-09 14:59:59 +000043085#endif
43086
43087#ifdef LIBXML_XPATH_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000043088
43089#define gen_nb_xmlXPathContextPtr 1
43090static xmlXPathContextPtr gen_xmlXPathContextPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
43091 return(NULL);
43092}
43093static void des_xmlXPathContextPtr(int no ATTRIBUTE_UNUSED, xmlXPathContextPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
43094}
Daniel Veillarda521d282004-11-09 14:59:59 +000043095#endif
43096
Daniel Veillardce682bc2004-11-05 17:22:25 +000043097
Daniel Veillardd93f6252004-11-02 15:53:51 +000043098static int
43099test_xmlXPathCompiledEval(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043100 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043101
William M. Brack21e4ef22005-01-02 09:53:13 +000043102#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000043103 int mem_base;
43104 xmlXPathObjectPtr ret_val;
43105 xmlXPathCompExprPtr comp; /* the compiled XPath expression */
43106 int n_comp;
43107 xmlXPathContextPtr ctx; /* the XPath context */
43108 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043109
Daniel Veillardce682bc2004-11-05 17:22:25 +000043110 for (n_comp = 0;n_comp < gen_nb_xmlXPathCompExprPtr;n_comp++) {
43111 for (n_ctx = 0;n_ctx < gen_nb_xmlXPathContextPtr;n_ctx++) {
43112 mem_base = xmlMemBlocks();
43113 comp = gen_xmlXPathCompExprPtr(n_comp, 0);
43114 ctx = gen_xmlXPathContextPtr(n_ctx, 1);
43115
43116 ret_val = xmlXPathCompiledEval(comp, ctx);
43117 desret_xmlXPathObjectPtr(ret_val);
43118 call_tests++;
43119 des_xmlXPathCompExprPtr(n_comp, comp, 0);
43120 des_xmlXPathContextPtr(n_ctx, ctx, 1);
43121 xmlResetLastError();
43122 if (mem_base != xmlMemBlocks()) {
43123 printf("Leak of %d blocks found in xmlXPathCompiledEval",
43124 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043125 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043126 printf(" %d", n_comp);
43127 printf(" %d", n_ctx);
43128 printf("\n");
43129 }
43130 }
43131 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043132 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043133#endif
43134
Daniel Veillard42595322004-11-08 10:52:06 +000043135 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043136}
43137
43138
43139static int
43140test_xmlXPathConvertBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043141 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043142
William M. Brack21e4ef22005-01-02 09:53:13 +000043143#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000043144 int mem_base;
43145 xmlXPathObjectPtr ret_val;
43146 xmlXPathObjectPtr val; /* an XPath object */
43147 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043148
Daniel Veillard3d97e662004-11-04 10:49:00 +000043149 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43150 mem_base = xmlMemBlocks();
43151 val = gen_xmlXPathObjectPtr(n_val, 0);
43152
43153 ret_val = xmlXPathConvertBoolean(val);
43154 val = NULL;
43155 desret_xmlXPathObjectPtr(ret_val);
43156 call_tests++;
43157 des_xmlXPathObjectPtr(n_val, val, 0);
43158 xmlResetLastError();
43159 if (mem_base != xmlMemBlocks()) {
43160 printf("Leak of %d blocks found in xmlXPathConvertBoolean",
43161 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043162 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043163 printf(" %d", n_val);
43164 printf("\n");
43165 }
43166 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043167 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043168#endif
43169
Daniel Veillard42595322004-11-08 10:52:06 +000043170 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043171}
43172
43173
43174static int
43175test_xmlXPathConvertNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043176 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043177
William M. Brack21e4ef22005-01-02 09:53:13 +000043178#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000043179 int mem_base;
43180 xmlXPathObjectPtr ret_val;
43181 xmlXPathObjectPtr val; /* an XPath object */
43182 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043183
Daniel Veillard3d97e662004-11-04 10:49:00 +000043184 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43185 mem_base = xmlMemBlocks();
43186 val = gen_xmlXPathObjectPtr(n_val, 0);
43187
43188 ret_val = xmlXPathConvertNumber(val);
43189 val = NULL;
43190 desret_xmlXPathObjectPtr(ret_val);
43191 call_tests++;
43192 des_xmlXPathObjectPtr(n_val, val, 0);
43193 xmlResetLastError();
43194 if (mem_base != xmlMemBlocks()) {
43195 printf("Leak of %d blocks found in xmlXPathConvertNumber",
43196 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043197 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043198 printf(" %d", n_val);
43199 printf("\n");
43200 }
43201 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043202 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043203#endif
43204
Daniel Veillard42595322004-11-08 10:52:06 +000043205 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043206}
43207
43208
43209static int
43210test_xmlXPathConvertString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043211 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043212
William M. Brack21e4ef22005-01-02 09:53:13 +000043213#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000043214 int mem_base;
43215 xmlXPathObjectPtr ret_val;
43216 xmlXPathObjectPtr val; /* an XPath object */
43217 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043218
Daniel Veillard3d97e662004-11-04 10:49:00 +000043219 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43220 mem_base = xmlMemBlocks();
43221 val = gen_xmlXPathObjectPtr(n_val, 0);
43222
43223 ret_val = xmlXPathConvertString(val);
43224 val = NULL;
43225 desret_xmlXPathObjectPtr(ret_val);
43226 call_tests++;
43227 des_xmlXPathObjectPtr(n_val, val, 0);
43228 xmlResetLastError();
43229 if (mem_base != xmlMemBlocks()) {
43230 printf("Leak of %d blocks found in xmlXPathConvertString",
43231 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043232 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043233 printf(" %d", n_val);
43234 printf("\n");
43235 }
43236 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043237 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043238#endif
43239
Daniel Veillard42595322004-11-08 10:52:06 +000043240 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043241}
43242
43243
43244static int
43245test_xmlXPathCtxtCompile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043246 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043247
43248
43249 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043250 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043251}
43252
43253
43254static int
43255test_xmlXPathEval(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043256 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043257
William M. Brack21e4ef22005-01-02 09:53:13 +000043258#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000043259 int mem_base;
43260 xmlXPathObjectPtr ret_val;
43261 xmlChar * str; /* the XPath expression */
43262 int n_str;
43263 xmlXPathContextPtr ctx; /* the XPath context */
43264 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043265
Daniel Veillardce682bc2004-11-05 17:22:25 +000043266 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
43267 for (n_ctx = 0;n_ctx < gen_nb_xmlXPathContextPtr;n_ctx++) {
43268 mem_base = xmlMemBlocks();
43269 str = gen_const_xmlChar_ptr(n_str, 0);
43270 ctx = gen_xmlXPathContextPtr(n_ctx, 1);
43271
William M. Brackf13f77f2004-11-12 16:03:48 +000043272 ret_val = xmlXPathEval((const xmlChar *)str, ctx);
Daniel Veillardce682bc2004-11-05 17:22:25 +000043273 desret_xmlXPathObjectPtr(ret_val);
43274 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000043275 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000043276 des_xmlXPathContextPtr(n_ctx, ctx, 1);
43277 xmlResetLastError();
43278 if (mem_base != xmlMemBlocks()) {
43279 printf("Leak of %d blocks found in xmlXPathEval",
43280 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043281 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043282 printf(" %d", n_str);
43283 printf(" %d", n_ctx);
43284 printf("\n");
43285 }
43286 }
43287 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043288 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043289#endif
43290
Daniel Veillard42595322004-11-08 10:52:06 +000043291 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043292}
43293
43294
43295static int
43296test_xmlXPathEvalExpression(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043297 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043298
William M. Brack21e4ef22005-01-02 09:53:13 +000043299#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000043300 int mem_base;
43301 xmlXPathObjectPtr ret_val;
43302 xmlChar * str; /* the XPath expression */
43303 int n_str;
43304 xmlXPathContextPtr ctxt; /* the XPath context */
43305 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043306
Daniel Veillardce682bc2004-11-05 17:22:25 +000043307 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
43308 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
43309 mem_base = xmlMemBlocks();
43310 str = gen_const_xmlChar_ptr(n_str, 0);
43311 ctxt = gen_xmlXPathContextPtr(n_ctxt, 1);
43312
William M. Brackf13f77f2004-11-12 16:03:48 +000043313 ret_val = xmlXPathEvalExpression((const xmlChar *)str, ctxt);
Daniel Veillardce682bc2004-11-05 17:22:25 +000043314 desret_xmlXPathObjectPtr(ret_val);
43315 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000043316 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000043317 des_xmlXPathContextPtr(n_ctxt, ctxt, 1);
43318 xmlResetLastError();
43319 if (mem_base != xmlMemBlocks()) {
43320 printf("Leak of %d blocks found in xmlXPathEvalExpression",
43321 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043322 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043323 printf(" %d", n_str);
43324 printf(" %d", n_ctxt);
43325 printf("\n");
43326 }
43327 }
43328 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043329 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043330#endif
43331
Daniel Veillard42595322004-11-08 10:52:06 +000043332 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043333}
43334
43335
43336static int
43337test_xmlXPathEvalPredicate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043338 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043339
William M. Brack21e4ef22005-01-02 09:53:13 +000043340#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000043341 int mem_base;
43342 int ret_val;
43343 xmlXPathContextPtr ctxt; /* the XPath context */
43344 int n_ctxt;
43345 xmlXPathObjectPtr res; /* the Predicate Expression evaluation result */
43346 int n_res;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043347
Daniel Veillardce682bc2004-11-05 17:22:25 +000043348 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
43349 for (n_res = 0;n_res < gen_nb_xmlXPathObjectPtr;n_res++) {
43350 mem_base = xmlMemBlocks();
43351 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
43352 res = gen_xmlXPathObjectPtr(n_res, 1);
43353
43354 ret_val = xmlXPathEvalPredicate(ctxt, res);
43355 desret_int(ret_val);
43356 call_tests++;
43357 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
43358 des_xmlXPathObjectPtr(n_res, res, 1);
43359 xmlResetLastError();
43360 if (mem_base != xmlMemBlocks()) {
43361 printf("Leak of %d blocks found in xmlXPathEvalPredicate",
43362 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043363 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043364 printf(" %d", n_ctxt);
43365 printf(" %d", n_res);
43366 printf("\n");
43367 }
43368 }
43369 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043370 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043371#endif
43372
Daniel Veillard42595322004-11-08 10:52:06 +000043373 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043374}
43375
43376
43377static int
43378test_xmlXPathInit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043379 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043380
William M. Brack21e4ef22005-01-02 09:53:13 +000043381#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000043382 int mem_base;
43383
43384 mem_base = xmlMemBlocks();
43385
43386 xmlXPathInit();
43387 call_tests++;
43388 xmlResetLastError();
43389 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000043390 printf("Leak of %d blocks found in xmlXPathInit",
Daniel Veillardd93f6252004-11-02 15:53:51 +000043391 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043392 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000043393 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000043394 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043395 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043396#endif
43397
Daniel Veillard42595322004-11-08 10:52:06 +000043398 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043399}
43400
43401
43402static int
43403test_xmlXPathIsInf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043404 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043405
William M. Brack21e4ef22005-01-02 09:53:13 +000043406#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000043407 int mem_base;
43408 int ret_val;
43409 double val; /* a double value */
43410 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043411
Daniel Veillard3d95c732004-11-06 22:25:14 +000043412 for (n_val = 0;n_val < gen_nb_double;n_val++) {
43413 mem_base = xmlMemBlocks();
43414 val = gen_double(n_val, 0);
43415
43416 ret_val = xmlXPathIsInf(val);
43417 desret_int(ret_val);
43418 call_tests++;
43419 des_double(n_val, val, 0);
43420 xmlResetLastError();
43421 if (mem_base != xmlMemBlocks()) {
43422 printf("Leak of %d blocks found in xmlXPathIsInf",
43423 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043424 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043425 printf(" %d", n_val);
43426 printf("\n");
43427 }
43428 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043429 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043430#endif
43431
Daniel Veillard42595322004-11-08 10:52:06 +000043432 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043433}
43434
43435
43436static int
43437test_xmlXPathIsNaN(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043438 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043439
William M. Brack21e4ef22005-01-02 09:53:13 +000043440#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000043441 int mem_base;
43442 int ret_val;
43443 double val; /* a double value */
43444 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043445
Daniel Veillard3d95c732004-11-06 22:25:14 +000043446 for (n_val = 0;n_val < gen_nb_double;n_val++) {
43447 mem_base = xmlMemBlocks();
43448 val = gen_double(n_val, 0);
43449
43450 ret_val = xmlXPathIsNaN(val);
43451 desret_int(ret_val);
43452 call_tests++;
43453 des_double(n_val, val, 0);
43454 xmlResetLastError();
43455 if (mem_base != xmlMemBlocks()) {
43456 printf("Leak of %d blocks found in xmlXPathIsNaN",
43457 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043458 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043459 printf(" %d", n_val);
43460 printf("\n");
43461 }
43462 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043463 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043464#endif
43465
Daniel Veillard42595322004-11-08 10:52:06 +000043466 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043467}
43468
43469
43470static int
43471test_xmlXPathNewContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043472 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043473
43474
43475 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043476 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043477}
43478
43479
43480static int
43481test_xmlXPathNodeSetCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043482 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043483
William M. Brack21e4ef22005-01-02 09:53:13 +000043484#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000043485 int mem_base;
43486 xmlNodeSetPtr ret_val;
43487 xmlNodePtr val; /* an initial xmlNodePtr, or NULL */
43488 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043489
Daniel Veillardf2a36f92004-11-08 17:55:01 +000043490 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
43491 mem_base = xmlMemBlocks();
43492 val = gen_xmlNodePtr(n_val, 0);
43493
43494 ret_val = xmlXPathNodeSetCreate(val);
43495 desret_xmlNodeSetPtr(ret_val);
43496 call_tests++;
43497 des_xmlNodePtr(n_val, val, 0);
43498 xmlResetLastError();
43499 if (mem_base != xmlMemBlocks()) {
43500 printf("Leak of %d blocks found in xmlXPathNodeSetCreate",
43501 xmlMemBlocks() - mem_base);
43502 test_ret++;
43503 printf(" %d", n_val);
43504 printf("\n");
43505 }
43506 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043507 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000043508#endif
43509
Daniel Veillard42595322004-11-08 10:52:06 +000043510 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043511}
43512
43513
43514static int
43515test_xmlXPathObjectCopy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043516 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043517
William M. Brack21e4ef22005-01-02 09:53:13 +000043518#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000043519 int mem_base;
43520 xmlXPathObjectPtr ret_val;
43521 xmlXPathObjectPtr val; /* the original object */
43522 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043523
Daniel Veillard3d97e662004-11-04 10:49:00 +000043524 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43525 mem_base = xmlMemBlocks();
43526 val = gen_xmlXPathObjectPtr(n_val, 0);
43527
43528 ret_val = xmlXPathObjectCopy(val);
43529 desret_xmlXPathObjectPtr(ret_val);
43530 call_tests++;
43531 des_xmlXPathObjectPtr(n_val, val, 0);
43532 xmlResetLastError();
43533 if (mem_base != xmlMemBlocks()) {
43534 printf("Leak of %d blocks found in xmlXPathObjectCopy",
43535 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043536 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043537 printf(" %d", n_val);
43538 printf("\n");
43539 }
43540 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043541 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043542#endif
43543
Daniel Veillard42595322004-11-08 10:52:06 +000043544 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043545}
43546
43547
43548static int
43549test_xmlXPathOrderDocElems(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043550 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043551
William M. Brack21e4ef22005-01-02 09:53:13 +000043552#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043553 int mem_base;
43554 long ret_val;
43555 xmlDocPtr doc; /* an input document */
43556 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043557
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043558 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
43559 mem_base = xmlMemBlocks();
43560 doc = gen_xmlDocPtr(n_doc, 0);
43561
43562 ret_val = xmlXPathOrderDocElems(doc);
43563 desret_long(ret_val);
43564 call_tests++;
43565 des_xmlDocPtr(n_doc, doc, 0);
43566 xmlResetLastError();
43567 if (mem_base != xmlMemBlocks()) {
43568 printf("Leak of %d blocks found in xmlXPathOrderDocElems",
43569 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043570 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043571 printf(" %d", n_doc);
43572 printf("\n");
43573 }
43574 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043575 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043576#endif
43577
Daniel Veillard42595322004-11-08 10:52:06 +000043578 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043579}
43580
43581static int
43582test_xpath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043583 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043584
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043585 if (quiet == 0) printf("Testing xpath : 28 of 36 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000043586 test_ret += test_xmlXPathCastBooleanToNumber();
43587 test_ret += test_xmlXPathCastBooleanToString();
43588 test_ret += test_xmlXPathCastNodeSetToBoolean();
43589 test_ret += test_xmlXPathCastNodeSetToNumber();
43590 test_ret += test_xmlXPathCastNodeSetToString();
43591 test_ret += test_xmlXPathCastNodeToNumber();
43592 test_ret += test_xmlXPathCastNodeToString();
43593 test_ret += test_xmlXPathCastNumberToBoolean();
43594 test_ret += test_xmlXPathCastNumberToString();
43595 test_ret += test_xmlXPathCastStringToBoolean();
43596 test_ret += test_xmlXPathCastStringToNumber();
43597 test_ret += test_xmlXPathCastToBoolean();
43598 test_ret += test_xmlXPathCastToNumber();
43599 test_ret += test_xmlXPathCastToString();
43600 test_ret += test_xmlXPathCmpNodes();
43601 test_ret += test_xmlXPathCompile();
43602 test_ret += test_xmlXPathCompiledEval();
43603 test_ret += test_xmlXPathConvertBoolean();
43604 test_ret += test_xmlXPathConvertNumber();
43605 test_ret += test_xmlXPathConvertString();
43606 test_ret += test_xmlXPathCtxtCompile();
43607 test_ret += test_xmlXPathEval();
43608 test_ret += test_xmlXPathEvalExpression();
43609 test_ret += test_xmlXPathEvalPredicate();
43610 test_ret += test_xmlXPathInit();
43611 test_ret += test_xmlXPathIsInf();
43612 test_ret += test_xmlXPathIsNaN();
43613 test_ret += test_xmlXPathNewContext();
43614 test_ret += test_xmlXPathNodeSetCreate();
43615 test_ret += test_xmlXPathObjectCopy();
43616 test_ret += test_xmlXPathOrderDocElems();
Daniel Veillardd93f6252004-11-02 15:53:51 +000043617
Daniel Veillard42595322004-11-08 10:52:06 +000043618 if (test_ret != 0)
43619 printf("Module xpath: %d errors\n", test_ret);
43620 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043621}
Daniel Veillarda521d282004-11-09 14:59:59 +000043622#ifdef LIBXML_XPATH_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000043623
Daniel Veillarda82b1822004-11-08 16:24:57 +000043624#define gen_nb_xmlXPathParserContextPtr 1
43625static xmlXPathParserContextPtr gen_xmlXPathParserContextPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
43626 return(NULL);
43627}
43628static void des_xmlXPathParserContextPtr(int no ATTRIBUTE_UNUSED, xmlXPathParserContextPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
43629}
Daniel Veillarda521d282004-11-09 14:59:59 +000043630#endif
43631
Daniel Veillarda82b1822004-11-08 16:24:57 +000043632
43633static int
43634test_valuePop(void) {
43635 int test_ret = 0;
43636
William M. Brack21e4ef22005-01-02 09:53:13 +000043637#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000043638 int mem_base;
43639 xmlXPathObjectPtr ret_val;
43640 xmlXPathParserContextPtr ctxt; /* an XPath evaluation context */
43641 int n_ctxt;
43642
43643 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43644 mem_base = xmlMemBlocks();
43645 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43646
43647 ret_val = valuePop(ctxt);
43648 desret_xmlXPathObjectPtr(ret_val);
43649 call_tests++;
43650 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43651 xmlResetLastError();
43652 if (mem_base != xmlMemBlocks()) {
43653 printf("Leak of %d blocks found in valuePop",
43654 xmlMemBlocks() - mem_base);
43655 test_ret++;
43656 printf(" %d", n_ctxt);
43657 printf("\n");
43658 }
43659 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043660 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043661#endif
43662
Daniel Veillarda82b1822004-11-08 16:24:57 +000043663 return(test_ret);
43664}
43665
43666
43667static int
43668test_valuePush(void) {
43669 int test_ret = 0;
43670
William M. Brack21e4ef22005-01-02 09:53:13 +000043671#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000043672 int mem_base;
43673 int ret_val;
43674 xmlXPathParserContextPtr ctxt; /* an XPath evaluation context */
43675 int n_ctxt;
43676 xmlXPathObjectPtr value; /* the XPath object */
43677 int n_value;
43678
43679 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43680 for (n_value = 0;n_value < gen_nb_xmlXPathObjectPtr;n_value++) {
43681 mem_base = xmlMemBlocks();
43682 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43683 value = gen_xmlXPathObjectPtr(n_value, 1);
43684
43685 ret_val = valuePush(ctxt, value);
43686 desret_int(ret_val);
43687 call_tests++;
43688 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43689 des_xmlXPathObjectPtr(n_value, value, 1);
43690 xmlResetLastError();
43691 if (mem_base != xmlMemBlocks()) {
43692 printf("Leak of %d blocks found in valuePush",
43693 xmlMemBlocks() - mem_base);
43694 test_ret++;
43695 printf(" %d", n_ctxt);
43696 printf(" %d", n_value);
43697 printf("\n");
43698 }
43699 }
43700 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043701 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043702#endif
43703
Daniel Veillarda82b1822004-11-08 16:24:57 +000043704 return(test_ret);
43705}
43706
43707
43708static int
43709test_xmlXPathAddValues(void) {
43710 int test_ret = 0;
43711
William M. Brack21e4ef22005-01-02 09:53:13 +000043712#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000043713 int mem_base;
43714 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43715 int n_ctxt;
43716
43717 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43718 mem_base = xmlMemBlocks();
43719 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43720
43721 xmlXPathAddValues(ctxt);
43722 call_tests++;
43723 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43724 xmlResetLastError();
43725 if (mem_base != xmlMemBlocks()) {
43726 printf("Leak of %d blocks found in xmlXPathAddValues",
43727 xmlMemBlocks() - mem_base);
43728 test_ret++;
43729 printf(" %d", n_ctxt);
43730 printf("\n");
43731 }
43732 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043733 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043734#endif
43735
Daniel Veillarda82b1822004-11-08 16:24:57 +000043736 return(test_ret);
43737}
43738
43739
43740static int
43741test_xmlXPathBooleanFunction(void) {
43742 int test_ret = 0;
43743
William M. Brack21e4ef22005-01-02 09:53:13 +000043744#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000043745 int mem_base;
43746 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43747 int n_ctxt;
43748 int nargs; /* the number of arguments */
43749 int n_nargs;
43750
43751 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43752 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
43753 mem_base = xmlMemBlocks();
43754 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43755 nargs = gen_int(n_nargs, 1);
43756
43757 xmlXPathBooleanFunction(ctxt, nargs);
43758 call_tests++;
43759 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43760 des_int(n_nargs, nargs, 1);
43761 xmlResetLastError();
43762 if (mem_base != xmlMemBlocks()) {
43763 printf("Leak of %d blocks found in xmlXPathBooleanFunction",
43764 xmlMemBlocks() - mem_base);
43765 test_ret++;
43766 printf(" %d", n_ctxt);
43767 printf(" %d", n_nargs);
43768 printf("\n");
43769 }
43770 }
43771 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043772 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043773#endif
43774
Daniel Veillarda82b1822004-11-08 16:24:57 +000043775 return(test_ret);
43776}
43777
43778
43779static int
43780test_xmlXPathCeilingFunction(void) {
43781 int test_ret = 0;
43782
William M. Brack21e4ef22005-01-02 09:53:13 +000043783#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000043784 int mem_base;
43785 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43786 int n_ctxt;
43787 int nargs; /* the number of arguments */
43788 int n_nargs;
43789
43790 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43791 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
43792 mem_base = xmlMemBlocks();
43793 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43794 nargs = gen_int(n_nargs, 1);
43795
43796 xmlXPathCeilingFunction(ctxt, nargs);
43797 call_tests++;
43798 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43799 des_int(n_nargs, nargs, 1);
43800 xmlResetLastError();
43801 if (mem_base != xmlMemBlocks()) {
43802 printf("Leak of %d blocks found in xmlXPathCeilingFunction",
43803 xmlMemBlocks() - mem_base);
43804 test_ret++;
43805 printf(" %d", n_ctxt);
43806 printf(" %d", n_nargs);
43807 printf("\n");
43808 }
43809 }
43810 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043811 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043812#endif
43813
Daniel Veillarda82b1822004-11-08 16:24:57 +000043814 return(test_ret);
43815}
43816
43817
43818static int
43819test_xmlXPathCompareValues(void) {
43820 int test_ret = 0;
43821
William M. Brack21e4ef22005-01-02 09:53:13 +000043822#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000043823 int mem_base;
43824 int ret_val;
43825 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43826 int n_ctxt;
43827 int inf; /* less than (1) or greater than (0) */
43828 int n_inf;
43829 int strict; /* is the comparison strict */
43830 int n_strict;
43831
43832 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43833 for (n_inf = 0;n_inf < gen_nb_int;n_inf++) {
43834 for (n_strict = 0;n_strict < gen_nb_int;n_strict++) {
43835 mem_base = xmlMemBlocks();
43836 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43837 inf = gen_int(n_inf, 1);
43838 strict = gen_int(n_strict, 2);
43839
43840 ret_val = xmlXPathCompareValues(ctxt, inf, strict);
43841 desret_int(ret_val);
43842 call_tests++;
43843 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43844 des_int(n_inf, inf, 1);
43845 des_int(n_strict, strict, 2);
43846 xmlResetLastError();
43847 if (mem_base != xmlMemBlocks()) {
43848 printf("Leak of %d blocks found in xmlXPathCompareValues",
43849 xmlMemBlocks() - mem_base);
43850 test_ret++;
43851 printf(" %d", n_ctxt);
43852 printf(" %d", n_inf);
43853 printf(" %d", n_strict);
43854 printf("\n");
43855 }
43856 }
43857 }
43858 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043859 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043860#endif
43861
Daniel Veillarda82b1822004-11-08 16:24:57 +000043862 return(test_ret);
43863}
43864
43865
43866static int
43867test_xmlXPathConcatFunction(void) {
43868 int test_ret = 0;
43869
William M. Brack21e4ef22005-01-02 09:53:13 +000043870#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000043871 int mem_base;
43872 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43873 int n_ctxt;
43874 int nargs; /* the number of arguments */
43875 int n_nargs;
43876
43877 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43878 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
43879 mem_base = xmlMemBlocks();
43880 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43881 nargs = gen_int(n_nargs, 1);
43882
43883 xmlXPathConcatFunction(ctxt, nargs);
43884 call_tests++;
43885 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43886 des_int(n_nargs, nargs, 1);
43887 xmlResetLastError();
43888 if (mem_base != xmlMemBlocks()) {
43889 printf("Leak of %d blocks found in xmlXPathConcatFunction",
43890 xmlMemBlocks() - mem_base);
43891 test_ret++;
43892 printf(" %d", n_ctxt);
43893 printf(" %d", n_nargs);
43894 printf("\n");
43895 }
43896 }
43897 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043898 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043899#endif
43900
Daniel Veillarda82b1822004-11-08 16:24:57 +000043901 return(test_ret);
43902}
43903
43904
43905static int
43906test_xmlXPathContainsFunction(void) {
43907 int test_ret = 0;
43908
William M. Brack21e4ef22005-01-02 09:53:13 +000043909#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000043910 int mem_base;
43911 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43912 int n_ctxt;
43913 int nargs; /* the number of arguments */
43914 int n_nargs;
43915
43916 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43917 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
43918 mem_base = xmlMemBlocks();
43919 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43920 nargs = gen_int(n_nargs, 1);
43921
43922 xmlXPathContainsFunction(ctxt, nargs);
43923 call_tests++;
43924 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43925 des_int(n_nargs, nargs, 1);
43926 xmlResetLastError();
43927 if (mem_base != xmlMemBlocks()) {
43928 printf("Leak of %d blocks found in xmlXPathContainsFunction",
43929 xmlMemBlocks() - mem_base);
43930 test_ret++;
43931 printf(" %d", n_ctxt);
43932 printf(" %d", n_nargs);
43933 printf("\n");
43934 }
43935 }
43936 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043937 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043938#endif
43939
Daniel Veillarda82b1822004-11-08 16:24:57 +000043940 return(test_ret);
43941}
43942
43943
43944static int
43945test_xmlXPathCountFunction(void) {
43946 int test_ret = 0;
43947
William M. Brack21e4ef22005-01-02 09:53:13 +000043948#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000043949 int mem_base;
43950 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43951 int n_ctxt;
43952 int nargs; /* the number of arguments */
43953 int n_nargs;
43954
43955 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43956 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
43957 mem_base = xmlMemBlocks();
43958 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43959 nargs = gen_int(n_nargs, 1);
43960
43961 xmlXPathCountFunction(ctxt, nargs);
43962 call_tests++;
43963 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43964 des_int(n_nargs, nargs, 1);
43965 xmlResetLastError();
43966 if (mem_base != xmlMemBlocks()) {
43967 printf("Leak of %d blocks found in xmlXPathCountFunction",
43968 xmlMemBlocks() - mem_base);
43969 test_ret++;
43970 printf(" %d", n_ctxt);
43971 printf(" %d", n_nargs);
43972 printf("\n");
43973 }
43974 }
43975 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043976 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043977#endif
43978
Daniel Veillarda82b1822004-11-08 16:24:57 +000043979 return(test_ret);
43980}
43981
43982
43983static int
43984test_xmlXPathDebugDumpCompExpr(void) {
43985 int test_ret = 0;
43986
William M. Brack21e4ef22005-01-02 09:53:13 +000043987#if defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000043988 int mem_base;
43989 FILE * output; /* the FILE * for the output */
43990 int n_output;
43991 xmlXPathCompExprPtr comp; /* the precompiled XPath expression */
43992 int n_comp;
43993 int depth; /* the indentation level. */
43994 int n_depth;
43995
43996 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
43997 for (n_comp = 0;n_comp < gen_nb_xmlXPathCompExprPtr;n_comp++) {
43998 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
43999 mem_base = xmlMemBlocks();
44000 output = gen_FILE_ptr(n_output, 0);
44001 comp = gen_xmlXPathCompExprPtr(n_comp, 1);
44002 depth = gen_int(n_depth, 2);
44003
44004 xmlXPathDebugDumpCompExpr(output, comp, depth);
44005 call_tests++;
44006 des_FILE_ptr(n_output, output, 0);
44007 des_xmlXPathCompExprPtr(n_comp, comp, 1);
44008 des_int(n_depth, depth, 2);
44009 xmlResetLastError();
44010 if (mem_base != xmlMemBlocks()) {
44011 printf("Leak of %d blocks found in xmlXPathDebugDumpCompExpr",
44012 xmlMemBlocks() - mem_base);
44013 test_ret++;
44014 printf(" %d", n_output);
44015 printf(" %d", n_comp);
44016 printf(" %d", n_depth);
44017 printf("\n");
44018 }
44019 }
44020 }
44021 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044022 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044023#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +000044024
Daniel Veillarda82b1822004-11-08 16:24:57 +000044025 return(test_ret);
44026}
44027
44028
44029static int
44030test_xmlXPathDebugDumpObject(void) {
44031 int test_ret = 0;
44032
William M. Brack21e4ef22005-01-02 09:53:13 +000044033#if defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044034 int mem_base;
44035 FILE * output; /* the FILE * to dump the output */
44036 int n_output;
44037 xmlXPathObjectPtr cur; /* the object to inspect */
44038 int n_cur;
44039 int depth; /* indentation level */
44040 int n_depth;
44041
44042 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
44043 for (n_cur = 0;n_cur < gen_nb_xmlXPathObjectPtr;n_cur++) {
44044 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
44045 mem_base = xmlMemBlocks();
44046 output = gen_FILE_ptr(n_output, 0);
44047 cur = gen_xmlXPathObjectPtr(n_cur, 1);
44048 depth = gen_int(n_depth, 2);
44049
44050 xmlXPathDebugDumpObject(output, cur, depth);
44051 call_tests++;
44052 des_FILE_ptr(n_output, output, 0);
44053 des_xmlXPathObjectPtr(n_cur, cur, 1);
44054 des_int(n_depth, depth, 2);
44055 xmlResetLastError();
44056 if (mem_base != xmlMemBlocks()) {
44057 printf("Leak of %d blocks found in xmlXPathDebugDumpObject",
44058 xmlMemBlocks() - mem_base);
44059 test_ret++;
44060 printf(" %d", n_output);
44061 printf(" %d", n_cur);
44062 printf(" %d", n_depth);
44063 printf("\n");
44064 }
44065 }
44066 }
44067 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044068 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044069#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +000044070
Daniel Veillarda82b1822004-11-08 16:24:57 +000044071 return(test_ret);
44072}
44073
44074
44075static int
44076test_xmlXPathDifference(void) {
44077 int test_ret = 0;
44078
William M. Brack21e4ef22005-01-02 09:53:13 +000044079#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044080 int mem_base;
44081 xmlNodeSetPtr ret_val;
44082 xmlNodeSetPtr nodes1; /* a node-set */
44083 int n_nodes1;
44084 xmlNodeSetPtr nodes2; /* a node-set */
44085 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044086
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044087 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
44088 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
44089 mem_base = xmlMemBlocks();
44090 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
44091 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
44092
44093 ret_val = xmlXPathDifference(nodes1, nodes2);
44094 desret_xmlNodeSetPtr(ret_val);
44095 call_tests++;
44096 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
44097 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
44098 xmlResetLastError();
44099 if (mem_base != xmlMemBlocks()) {
44100 printf("Leak of %d blocks found in xmlXPathDifference",
44101 xmlMemBlocks() - mem_base);
44102 test_ret++;
44103 printf(" %d", n_nodes1);
44104 printf(" %d", n_nodes2);
44105 printf("\n");
44106 }
44107 }
44108 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044109 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044110#endif
44111
Daniel Veillarda82b1822004-11-08 16:24:57 +000044112 return(test_ret);
44113}
44114
44115
44116static int
44117test_xmlXPathDistinct(void) {
44118 int test_ret = 0;
44119
William M. Brack21e4ef22005-01-02 09:53:13 +000044120#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044121 int mem_base;
44122 xmlNodeSetPtr ret_val;
44123 xmlNodeSetPtr nodes; /* a node-set */
44124 int n_nodes;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044125
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044126 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
44127 mem_base = xmlMemBlocks();
44128 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
44129
44130 ret_val = xmlXPathDistinct(nodes);
44131 desret_xmlNodeSetPtr(ret_val);
44132 call_tests++;
44133 des_xmlNodeSetPtr(n_nodes, nodes, 0);
44134 xmlResetLastError();
44135 if (mem_base != xmlMemBlocks()) {
44136 printf("Leak of %d blocks found in xmlXPathDistinct",
44137 xmlMemBlocks() - mem_base);
44138 test_ret++;
44139 printf(" %d", n_nodes);
44140 printf("\n");
44141 }
44142 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044143 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044144#endif
44145
Daniel Veillarda82b1822004-11-08 16:24:57 +000044146 return(test_ret);
44147}
44148
44149
44150static int
44151test_xmlXPathDistinctSorted(void) {
44152 int test_ret = 0;
44153
William M. Brack21e4ef22005-01-02 09:53:13 +000044154#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044155 int mem_base;
44156 xmlNodeSetPtr ret_val;
44157 xmlNodeSetPtr nodes; /* a node-set, sorted by document order */
44158 int n_nodes;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044159
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044160 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
44161 mem_base = xmlMemBlocks();
44162 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
44163
44164 ret_val = xmlXPathDistinctSorted(nodes);
44165 desret_xmlNodeSetPtr(ret_val);
44166 call_tests++;
44167 des_xmlNodeSetPtr(n_nodes, nodes, 0);
44168 xmlResetLastError();
44169 if (mem_base != xmlMemBlocks()) {
44170 printf("Leak of %d blocks found in xmlXPathDistinctSorted",
44171 xmlMemBlocks() - mem_base);
44172 test_ret++;
44173 printf(" %d", n_nodes);
44174 printf("\n");
44175 }
44176 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044177 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044178#endif
44179
Daniel Veillarda82b1822004-11-08 16:24:57 +000044180 return(test_ret);
44181}
44182
44183
44184static int
44185test_xmlXPathDivValues(void) {
44186 int test_ret = 0;
44187
William M. Brack21e4ef22005-01-02 09:53:13 +000044188#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044189 int mem_base;
44190 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44191 int n_ctxt;
44192
44193 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44194 mem_base = xmlMemBlocks();
44195 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44196
44197 xmlXPathDivValues(ctxt);
44198 call_tests++;
44199 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44200 xmlResetLastError();
44201 if (mem_base != xmlMemBlocks()) {
44202 printf("Leak of %d blocks found in xmlXPathDivValues",
44203 xmlMemBlocks() - mem_base);
44204 test_ret++;
44205 printf(" %d", n_ctxt);
44206 printf("\n");
44207 }
44208 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044209 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044210#endif
44211
Daniel Veillarda82b1822004-11-08 16:24:57 +000044212 return(test_ret);
44213}
44214
44215
44216static int
44217test_xmlXPathEqualValues(void) {
44218 int test_ret = 0;
44219
William M. Brack21e4ef22005-01-02 09:53:13 +000044220#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044221 int mem_base;
44222 int ret_val;
44223 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44224 int n_ctxt;
44225
44226 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44227 mem_base = xmlMemBlocks();
44228 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44229
44230 ret_val = xmlXPathEqualValues(ctxt);
44231 desret_int(ret_val);
44232 call_tests++;
44233 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44234 xmlResetLastError();
44235 if (mem_base != xmlMemBlocks()) {
44236 printf("Leak of %d blocks found in xmlXPathEqualValues",
44237 xmlMemBlocks() - mem_base);
44238 test_ret++;
44239 printf(" %d", n_ctxt);
44240 printf("\n");
44241 }
44242 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044243 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044244#endif
44245
Daniel Veillarda82b1822004-11-08 16:24:57 +000044246 return(test_ret);
44247}
44248
44249
44250static int
44251test_xmlXPathErr(void) {
44252 int test_ret = 0;
44253
William M. Brack21e4ef22005-01-02 09:53:13 +000044254#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044255 int mem_base;
44256 xmlXPathParserContextPtr ctxt; /* a XPath parser context */
44257 int n_ctxt;
44258 int error; /* the error code */
44259 int n_error;
44260
44261 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44262 for (n_error = 0;n_error < gen_nb_int;n_error++) {
44263 mem_base = xmlMemBlocks();
44264 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44265 error = gen_int(n_error, 1);
44266
44267 xmlXPathErr(ctxt, error);
44268 call_tests++;
44269 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44270 des_int(n_error, error, 1);
44271 xmlResetLastError();
44272 if (mem_base != xmlMemBlocks()) {
44273 printf("Leak of %d blocks found in xmlXPathErr",
44274 xmlMemBlocks() - mem_base);
44275 test_ret++;
44276 printf(" %d", n_ctxt);
44277 printf(" %d", n_error);
44278 printf("\n");
44279 }
44280 }
44281 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044282 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044283#endif
44284
Daniel Veillarda82b1822004-11-08 16:24:57 +000044285 return(test_ret);
44286}
44287
44288
44289static int
44290test_xmlXPathEvalExpr(void) {
44291 int test_ret = 0;
44292
William M. Brack21e4ef22005-01-02 09:53:13 +000044293#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044294 int mem_base;
44295 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44296 int n_ctxt;
44297
44298 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44299 mem_base = xmlMemBlocks();
44300 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44301
44302 xmlXPathEvalExpr(ctxt);
44303 call_tests++;
44304 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44305 xmlResetLastError();
44306 if (mem_base != xmlMemBlocks()) {
44307 printf("Leak of %d blocks found in xmlXPathEvalExpr",
44308 xmlMemBlocks() - mem_base);
44309 test_ret++;
44310 printf(" %d", n_ctxt);
44311 printf("\n");
44312 }
44313 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044314 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044315#endif
44316
Daniel Veillarda82b1822004-11-08 16:24:57 +000044317 return(test_ret);
44318}
44319
44320
44321static int
44322test_xmlXPathEvaluatePredicateResult(void) {
44323 int test_ret = 0;
44324
William M. Brack21e4ef22005-01-02 09:53:13 +000044325#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044326 int mem_base;
44327 int ret_val;
44328 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44329 int n_ctxt;
44330 xmlXPathObjectPtr res; /* the Predicate Expression evaluation result */
44331 int n_res;
44332
44333 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44334 for (n_res = 0;n_res < gen_nb_xmlXPathObjectPtr;n_res++) {
44335 mem_base = xmlMemBlocks();
44336 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44337 res = gen_xmlXPathObjectPtr(n_res, 1);
44338
44339 ret_val = xmlXPathEvaluatePredicateResult(ctxt, res);
44340 desret_int(ret_val);
44341 call_tests++;
44342 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44343 des_xmlXPathObjectPtr(n_res, res, 1);
44344 xmlResetLastError();
44345 if (mem_base != xmlMemBlocks()) {
44346 printf("Leak of %d blocks found in xmlXPathEvaluatePredicateResult",
44347 xmlMemBlocks() - mem_base);
44348 test_ret++;
44349 printf(" %d", n_ctxt);
44350 printf(" %d", n_res);
44351 printf("\n");
44352 }
44353 }
44354 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044355 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044356#endif
44357
Daniel Veillarda82b1822004-11-08 16:24:57 +000044358 return(test_ret);
44359}
44360
44361
44362static int
44363test_xmlXPathFalseFunction(void) {
44364 int test_ret = 0;
44365
William M. Brack21e4ef22005-01-02 09:53:13 +000044366#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044367 int mem_base;
44368 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44369 int n_ctxt;
44370 int nargs; /* the number of arguments */
44371 int n_nargs;
44372
44373 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44374 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44375 mem_base = xmlMemBlocks();
44376 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44377 nargs = gen_int(n_nargs, 1);
44378
44379 xmlXPathFalseFunction(ctxt, nargs);
44380 call_tests++;
44381 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44382 des_int(n_nargs, nargs, 1);
44383 xmlResetLastError();
44384 if (mem_base != xmlMemBlocks()) {
44385 printf("Leak of %d blocks found in xmlXPathFalseFunction",
44386 xmlMemBlocks() - mem_base);
44387 test_ret++;
44388 printf(" %d", n_ctxt);
44389 printf(" %d", n_nargs);
44390 printf("\n");
44391 }
44392 }
44393 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044394 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044395#endif
44396
Daniel Veillarda82b1822004-11-08 16:24:57 +000044397 return(test_ret);
44398}
44399
44400
44401static int
44402test_xmlXPathFloorFunction(void) {
44403 int test_ret = 0;
44404
William M. Brack21e4ef22005-01-02 09:53:13 +000044405#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044406 int mem_base;
44407 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44408 int n_ctxt;
44409 int nargs; /* the number of arguments */
44410 int n_nargs;
44411
44412 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44413 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44414 mem_base = xmlMemBlocks();
44415 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44416 nargs = gen_int(n_nargs, 1);
44417
44418 xmlXPathFloorFunction(ctxt, nargs);
44419 call_tests++;
44420 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44421 des_int(n_nargs, nargs, 1);
44422 xmlResetLastError();
44423 if (mem_base != xmlMemBlocks()) {
44424 printf("Leak of %d blocks found in xmlXPathFloorFunction",
44425 xmlMemBlocks() - mem_base);
44426 test_ret++;
44427 printf(" %d", n_ctxt);
44428 printf(" %d", n_nargs);
44429 printf("\n");
44430 }
44431 }
44432 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044433 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044434#endif
44435
Daniel Veillarda82b1822004-11-08 16:24:57 +000044436 return(test_ret);
44437}
44438
44439
44440static int
44441test_xmlXPathFunctionLookup(void) {
44442 int test_ret = 0;
44443
44444
44445 /* missing type support */
44446 return(test_ret);
44447}
44448
44449
44450static int
44451test_xmlXPathFunctionLookupNS(void) {
44452 int test_ret = 0;
44453
44454
44455 /* missing type support */
44456 return(test_ret);
44457}
44458
44459
44460static int
44461test_xmlXPathHasSameNodes(void) {
44462 int test_ret = 0;
44463
William M. Brack21e4ef22005-01-02 09:53:13 +000044464#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044465 int mem_base;
44466 int ret_val;
44467 xmlNodeSetPtr nodes1; /* a node-set */
44468 int n_nodes1;
44469 xmlNodeSetPtr nodes2; /* a node-set */
44470 int n_nodes2;
44471
44472 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
44473 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
44474 mem_base = xmlMemBlocks();
44475 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
44476 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
44477
44478 ret_val = xmlXPathHasSameNodes(nodes1, nodes2);
44479 desret_int(ret_val);
44480 call_tests++;
44481 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
44482 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
44483 xmlResetLastError();
44484 if (mem_base != xmlMemBlocks()) {
44485 printf("Leak of %d blocks found in xmlXPathHasSameNodes",
44486 xmlMemBlocks() - mem_base);
44487 test_ret++;
44488 printf(" %d", n_nodes1);
44489 printf(" %d", n_nodes2);
44490 printf("\n");
44491 }
44492 }
44493 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044494 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044495#endif
44496
Daniel Veillarda82b1822004-11-08 16:24:57 +000044497 return(test_ret);
44498}
44499
44500
44501static int
44502test_xmlXPathIdFunction(void) {
44503 int test_ret = 0;
44504
William M. Brack21e4ef22005-01-02 09:53:13 +000044505#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044506 int mem_base;
44507 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44508 int n_ctxt;
44509 int nargs; /* the number of arguments */
44510 int n_nargs;
44511
44512 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44513 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44514 mem_base = xmlMemBlocks();
44515 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44516 nargs = gen_int(n_nargs, 1);
44517
44518 xmlXPathIdFunction(ctxt, nargs);
44519 call_tests++;
44520 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44521 des_int(n_nargs, nargs, 1);
44522 xmlResetLastError();
44523 if (mem_base != xmlMemBlocks()) {
44524 printf("Leak of %d blocks found in xmlXPathIdFunction",
44525 xmlMemBlocks() - mem_base);
44526 test_ret++;
44527 printf(" %d", n_ctxt);
44528 printf(" %d", n_nargs);
44529 printf("\n");
44530 }
44531 }
44532 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044533 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044534#endif
44535
Daniel Veillarda82b1822004-11-08 16:24:57 +000044536 return(test_ret);
44537}
44538
44539
44540static int
44541test_xmlXPathIntersection(void) {
44542 int test_ret = 0;
44543
William M. Brack21e4ef22005-01-02 09:53:13 +000044544#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044545 int mem_base;
44546 xmlNodeSetPtr ret_val;
44547 xmlNodeSetPtr nodes1; /* a node-set */
44548 int n_nodes1;
44549 xmlNodeSetPtr nodes2; /* a node-set */
44550 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044551
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044552 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
44553 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
44554 mem_base = xmlMemBlocks();
44555 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
44556 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
44557
44558 ret_val = xmlXPathIntersection(nodes1, nodes2);
44559 desret_xmlNodeSetPtr(ret_val);
44560 call_tests++;
44561 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
44562 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
44563 xmlResetLastError();
44564 if (mem_base != xmlMemBlocks()) {
44565 printf("Leak of %d blocks found in xmlXPathIntersection",
44566 xmlMemBlocks() - mem_base);
44567 test_ret++;
44568 printf(" %d", n_nodes1);
44569 printf(" %d", n_nodes2);
44570 printf("\n");
44571 }
44572 }
44573 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044574 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044575#endif
44576
Daniel Veillarda82b1822004-11-08 16:24:57 +000044577 return(test_ret);
44578}
44579
44580
44581static int
44582test_xmlXPathIsNodeType(void) {
44583 int test_ret = 0;
44584
William M. Brack21e4ef22005-01-02 09:53:13 +000044585#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044586 int mem_base;
44587 int ret_val;
44588 xmlChar * name; /* a name string */
44589 int n_name;
44590
44591 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
44592 mem_base = xmlMemBlocks();
44593 name = gen_const_xmlChar_ptr(n_name, 0);
44594
William M. Brackf13f77f2004-11-12 16:03:48 +000044595 ret_val = xmlXPathIsNodeType((const xmlChar *)name);
Daniel Veillarda82b1822004-11-08 16:24:57 +000044596 desret_int(ret_val);
44597 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000044598 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillarda82b1822004-11-08 16:24:57 +000044599 xmlResetLastError();
44600 if (mem_base != xmlMemBlocks()) {
44601 printf("Leak of %d blocks found in xmlXPathIsNodeType",
44602 xmlMemBlocks() - mem_base);
44603 test_ret++;
44604 printf(" %d", n_name);
44605 printf("\n");
44606 }
44607 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044608 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044609#endif
44610
Daniel Veillarda82b1822004-11-08 16:24:57 +000044611 return(test_ret);
44612}
44613
44614
44615static int
44616test_xmlXPathLangFunction(void) {
44617 int test_ret = 0;
44618
William M. Brack21e4ef22005-01-02 09:53:13 +000044619#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044620 int mem_base;
44621 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44622 int n_ctxt;
44623 int nargs; /* the number of arguments */
44624 int n_nargs;
44625
44626 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44627 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44628 mem_base = xmlMemBlocks();
44629 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44630 nargs = gen_int(n_nargs, 1);
44631
44632 xmlXPathLangFunction(ctxt, nargs);
44633 call_tests++;
44634 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44635 des_int(n_nargs, nargs, 1);
44636 xmlResetLastError();
44637 if (mem_base != xmlMemBlocks()) {
44638 printf("Leak of %d blocks found in xmlXPathLangFunction",
44639 xmlMemBlocks() - mem_base);
44640 test_ret++;
44641 printf(" %d", n_ctxt);
44642 printf(" %d", n_nargs);
44643 printf("\n");
44644 }
44645 }
44646 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044647 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044648#endif
44649
Daniel Veillarda82b1822004-11-08 16:24:57 +000044650 return(test_ret);
44651}
44652
44653
44654static int
44655test_xmlXPathLastFunction(void) {
44656 int test_ret = 0;
44657
William M. Brack21e4ef22005-01-02 09:53:13 +000044658#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044659 int mem_base;
44660 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44661 int n_ctxt;
44662 int nargs; /* the number of arguments */
44663 int n_nargs;
44664
44665 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44666 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44667 mem_base = xmlMemBlocks();
44668 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44669 nargs = gen_int(n_nargs, 1);
44670
44671 xmlXPathLastFunction(ctxt, nargs);
44672 call_tests++;
44673 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44674 des_int(n_nargs, nargs, 1);
44675 xmlResetLastError();
44676 if (mem_base != xmlMemBlocks()) {
44677 printf("Leak of %d blocks found in xmlXPathLastFunction",
44678 xmlMemBlocks() - mem_base);
44679 test_ret++;
44680 printf(" %d", n_ctxt);
44681 printf(" %d", n_nargs);
44682 printf("\n");
44683 }
44684 }
44685 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044686 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044687#endif
44688
Daniel Veillarda82b1822004-11-08 16:24:57 +000044689 return(test_ret);
44690}
44691
44692
44693static int
44694test_xmlXPathLeading(void) {
44695 int test_ret = 0;
44696
William M. Brack21e4ef22005-01-02 09:53:13 +000044697#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044698 int mem_base;
44699 xmlNodeSetPtr ret_val;
44700 xmlNodeSetPtr nodes1; /* a node-set */
44701 int n_nodes1;
44702 xmlNodeSetPtr nodes2; /* a node-set */
44703 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044704
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044705 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
44706 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
44707 mem_base = xmlMemBlocks();
44708 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
44709 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
44710
44711 ret_val = xmlXPathLeading(nodes1, nodes2);
44712 desret_xmlNodeSetPtr(ret_val);
44713 call_tests++;
44714 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
44715 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
44716 xmlResetLastError();
44717 if (mem_base != xmlMemBlocks()) {
44718 printf("Leak of %d blocks found in xmlXPathLeading",
44719 xmlMemBlocks() - mem_base);
44720 test_ret++;
44721 printf(" %d", n_nodes1);
44722 printf(" %d", n_nodes2);
44723 printf("\n");
44724 }
44725 }
44726 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044727 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044728#endif
44729
Daniel Veillarda82b1822004-11-08 16:24:57 +000044730 return(test_ret);
44731}
44732
44733
44734static int
44735test_xmlXPathLeadingSorted(void) {
44736 int test_ret = 0;
44737
William M. Brack21e4ef22005-01-02 09:53:13 +000044738#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044739 int mem_base;
44740 xmlNodeSetPtr ret_val;
44741 xmlNodeSetPtr nodes1; /* a node-set, sorted by document order */
44742 int n_nodes1;
44743 xmlNodeSetPtr nodes2; /* a node-set, sorted by document order */
44744 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044745
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044746 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
44747 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
44748 mem_base = xmlMemBlocks();
44749 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
44750 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
44751
44752 ret_val = xmlXPathLeadingSorted(nodes1, nodes2);
44753 desret_xmlNodeSetPtr(ret_val);
44754 call_tests++;
44755 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
44756 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
44757 xmlResetLastError();
44758 if (mem_base != xmlMemBlocks()) {
44759 printf("Leak of %d blocks found in xmlXPathLeadingSorted",
44760 xmlMemBlocks() - mem_base);
44761 test_ret++;
44762 printf(" %d", n_nodes1);
44763 printf(" %d", n_nodes2);
44764 printf("\n");
44765 }
44766 }
44767 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044768 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044769#endif
44770
Daniel Veillarda82b1822004-11-08 16:24:57 +000044771 return(test_ret);
44772}
44773
44774
44775static int
44776test_xmlXPathLocalNameFunction(void) {
44777 int test_ret = 0;
44778
William M. Brack21e4ef22005-01-02 09:53:13 +000044779#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044780 int mem_base;
44781 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44782 int n_ctxt;
44783 int nargs; /* the number of arguments */
44784 int n_nargs;
44785
44786 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44787 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44788 mem_base = xmlMemBlocks();
44789 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44790 nargs = gen_int(n_nargs, 1);
44791
44792 xmlXPathLocalNameFunction(ctxt, nargs);
44793 call_tests++;
44794 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44795 des_int(n_nargs, nargs, 1);
44796 xmlResetLastError();
44797 if (mem_base != xmlMemBlocks()) {
44798 printf("Leak of %d blocks found in xmlXPathLocalNameFunction",
44799 xmlMemBlocks() - mem_base);
44800 test_ret++;
44801 printf(" %d", n_ctxt);
44802 printf(" %d", n_nargs);
44803 printf("\n");
44804 }
44805 }
44806 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044807 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044808#endif
44809
Daniel Veillarda82b1822004-11-08 16:24:57 +000044810 return(test_ret);
44811}
44812
44813
44814static int
44815test_xmlXPathModValues(void) {
44816 int test_ret = 0;
44817
William M. Brack21e4ef22005-01-02 09:53:13 +000044818#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044819 int mem_base;
44820 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44821 int n_ctxt;
44822
44823 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44824 mem_base = xmlMemBlocks();
44825 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44826
44827 xmlXPathModValues(ctxt);
44828 call_tests++;
44829 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44830 xmlResetLastError();
44831 if (mem_base != xmlMemBlocks()) {
44832 printf("Leak of %d blocks found in xmlXPathModValues",
44833 xmlMemBlocks() - mem_base);
44834 test_ret++;
44835 printf(" %d", n_ctxt);
44836 printf("\n");
44837 }
44838 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044839 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044840#endif
44841
Daniel Veillarda82b1822004-11-08 16:24:57 +000044842 return(test_ret);
44843}
44844
44845
44846static int
44847test_xmlXPathMultValues(void) {
44848 int test_ret = 0;
44849
William M. Brack21e4ef22005-01-02 09:53:13 +000044850#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044851 int mem_base;
44852 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44853 int n_ctxt;
44854
44855 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44856 mem_base = xmlMemBlocks();
44857 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44858
44859 xmlXPathMultValues(ctxt);
44860 call_tests++;
44861 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44862 xmlResetLastError();
44863 if (mem_base != xmlMemBlocks()) {
44864 printf("Leak of %d blocks found in xmlXPathMultValues",
44865 xmlMemBlocks() - mem_base);
44866 test_ret++;
44867 printf(" %d", n_ctxt);
44868 printf("\n");
44869 }
44870 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044871 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044872#endif
44873
Daniel Veillarda82b1822004-11-08 16:24:57 +000044874 return(test_ret);
44875}
44876
44877
44878static int
44879test_xmlXPathNamespaceURIFunction(void) {
44880 int test_ret = 0;
44881
William M. Brack21e4ef22005-01-02 09:53:13 +000044882#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044883 int mem_base;
44884 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44885 int n_ctxt;
44886 int nargs; /* the number of arguments */
44887 int n_nargs;
44888
44889 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44890 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44891 mem_base = xmlMemBlocks();
44892 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44893 nargs = gen_int(n_nargs, 1);
44894
44895 xmlXPathNamespaceURIFunction(ctxt, nargs);
44896 call_tests++;
44897 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44898 des_int(n_nargs, nargs, 1);
44899 xmlResetLastError();
44900 if (mem_base != xmlMemBlocks()) {
44901 printf("Leak of %d blocks found in xmlXPathNamespaceURIFunction",
44902 xmlMemBlocks() - mem_base);
44903 test_ret++;
44904 printf(" %d", n_ctxt);
44905 printf(" %d", n_nargs);
44906 printf("\n");
44907 }
44908 }
44909 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044910 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044911#endif
44912
Daniel Veillarda82b1822004-11-08 16:24:57 +000044913 return(test_ret);
44914}
44915
44916
44917static int
44918test_xmlXPathNewBoolean(void) {
44919 int test_ret = 0;
44920
William M. Brack21e4ef22005-01-02 09:53:13 +000044921#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044922 int mem_base;
44923 xmlXPathObjectPtr ret_val;
44924 int val; /* the boolean value */
44925 int n_val;
44926
44927 for (n_val = 0;n_val < gen_nb_int;n_val++) {
44928 mem_base = xmlMemBlocks();
44929 val = gen_int(n_val, 0);
44930
44931 ret_val = xmlXPathNewBoolean(val);
44932 desret_xmlXPathObjectPtr(ret_val);
44933 call_tests++;
44934 des_int(n_val, val, 0);
44935 xmlResetLastError();
44936 if (mem_base != xmlMemBlocks()) {
44937 printf("Leak of %d blocks found in xmlXPathNewBoolean",
44938 xmlMemBlocks() - mem_base);
44939 test_ret++;
44940 printf(" %d", n_val);
44941 printf("\n");
44942 }
44943 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044944 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044945#endif
44946
Daniel Veillarda82b1822004-11-08 16:24:57 +000044947 return(test_ret);
44948}
44949
44950
44951static int
44952test_xmlXPathNewCString(void) {
44953 int test_ret = 0;
44954
William M. Brack21e4ef22005-01-02 09:53:13 +000044955#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044956 int mem_base;
44957 xmlXPathObjectPtr ret_val;
44958 char * val; /* the char * value */
44959 int n_val;
44960
44961 for (n_val = 0;n_val < gen_nb_const_char_ptr;n_val++) {
44962 mem_base = xmlMemBlocks();
44963 val = gen_const_char_ptr(n_val, 0);
44964
William M. Brackf13f77f2004-11-12 16:03:48 +000044965 ret_val = xmlXPathNewCString((const char *)val);
Daniel Veillarda82b1822004-11-08 16:24:57 +000044966 desret_xmlXPathObjectPtr(ret_val);
44967 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000044968 des_const_char_ptr(n_val, (const char *)val, 0);
Daniel Veillarda82b1822004-11-08 16:24:57 +000044969 xmlResetLastError();
44970 if (mem_base != xmlMemBlocks()) {
44971 printf("Leak of %d blocks found in xmlXPathNewCString",
44972 xmlMemBlocks() - mem_base);
44973 test_ret++;
44974 printf(" %d", n_val);
44975 printf("\n");
44976 }
44977 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044978 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044979#endif
44980
Daniel Veillarda82b1822004-11-08 16:24:57 +000044981 return(test_ret);
44982}
44983
44984
44985static int
44986test_xmlXPathNewFloat(void) {
44987 int test_ret = 0;
44988
William M. Brack21e4ef22005-01-02 09:53:13 +000044989#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044990 int mem_base;
44991 xmlXPathObjectPtr ret_val;
44992 double val; /* the double value */
44993 int n_val;
44994
44995 for (n_val = 0;n_val < gen_nb_double;n_val++) {
44996 mem_base = xmlMemBlocks();
44997 val = gen_double(n_val, 0);
44998
44999 ret_val = xmlXPathNewFloat(val);
45000 desret_xmlXPathObjectPtr(ret_val);
45001 call_tests++;
45002 des_double(n_val, val, 0);
45003 xmlResetLastError();
45004 if (mem_base != xmlMemBlocks()) {
45005 printf("Leak of %d blocks found in xmlXPathNewFloat",
45006 xmlMemBlocks() - mem_base);
45007 test_ret++;
45008 printf(" %d", n_val);
45009 printf("\n");
45010 }
45011 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045012 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045013#endif
45014
Daniel Veillarda82b1822004-11-08 16:24:57 +000045015 return(test_ret);
45016}
45017
45018
45019static int
45020test_xmlXPathNewNodeSet(void) {
45021 int test_ret = 0;
45022
William M. Brack21e4ef22005-01-02 09:53:13 +000045023#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045024 int mem_base;
45025 xmlXPathObjectPtr ret_val;
45026 xmlNodePtr val; /* the NodePtr value */
45027 int n_val;
45028
45029 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
45030 mem_base = xmlMemBlocks();
45031 val = gen_xmlNodePtr(n_val, 0);
45032
45033 ret_val = xmlXPathNewNodeSet(val);
45034 desret_xmlXPathObjectPtr(ret_val);
45035 call_tests++;
45036 des_xmlNodePtr(n_val, val, 0);
45037 xmlResetLastError();
45038 if (mem_base != xmlMemBlocks()) {
45039 printf("Leak of %d blocks found in xmlXPathNewNodeSet",
45040 xmlMemBlocks() - mem_base);
45041 test_ret++;
45042 printf(" %d", n_val);
45043 printf("\n");
45044 }
45045 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045046 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045047#endif
45048
Daniel Veillarda82b1822004-11-08 16:24:57 +000045049 return(test_ret);
45050}
45051
45052
45053static int
45054test_xmlXPathNewNodeSetList(void) {
45055 int test_ret = 0;
45056
William M. Brack21e4ef22005-01-02 09:53:13 +000045057#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045058 int mem_base;
45059 xmlXPathObjectPtr ret_val;
45060 xmlNodeSetPtr val; /* an existing NodeSet */
45061 int n_val;
45062
45063 for (n_val = 0;n_val < gen_nb_xmlNodeSetPtr;n_val++) {
45064 mem_base = xmlMemBlocks();
45065 val = gen_xmlNodeSetPtr(n_val, 0);
45066
45067 ret_val = xmlXPathNewNodeSetList(val);
45068 desret_xmlXPathObjectPtr(ret_val);
45069 call_tests++;
45070 des_xmlNodeSetPtr(n_val, val, 0);
45071 xmlResetLastError();
45072 if (mem_base != xmlMemBlocks()) {
45073 printf("Leak of %d blocks found in xmlXPathNewNodeSetList",
45074 xmlMemBlocks() - mem_base);
45075 test_ret++;
45076 printf(" %d", n_val);
45077 printf("\n");
45078 }
45079 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045080 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045081#endif
45082
Daniel Veillarda82b1822004-11-08 16:24:57 +000045083 return(test_ret);
45084}
45085
45086
45087static int
45088test_xmlXPathNewParserContext(void) {
45089 int test_ret = 0;
45090
45091
45092 /* missing type support */
45093 return(test_ret);
45094}
45095
45096
45097static int
45098test_xmlXPathNewString(void) {
45099 int test_ret = 0;
45100
William M. Brack21e4ef22005-01-02 09:53:13 +000045101#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045102 int mem_base;
45103 xmlXPathObjectPtr ret_val;
45104 xmlChar * val; /* the xmlChar * value */
45105 int n_val;
45106
45107 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
45108 mem_base = xmlMemBlocks();
45109 val = gen_const_xmlChar_ptr(n_val, 0);
45110
William M. Brackf13f77f2004-11-12 16:03:48 +000045111 ret_val = xmlXPathNewString((const xmlChar *)val);
Daniel Veillarda82b1822004-11-08 16:24:57 +000045112 desret_xmlXPathObjectPtr(ret_val);
45113 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000045114 des_const_xmlChar_ptr(n_val, (const xmlChar *)val, 0);
Daniel Veillarda82b1822004-11-08 16:24:57 +000045115 xmlResetLastError();
45116 if (mem_base != xmlMemBlocks()) {
45117 printf("Leak of %d blocks found in xmlXPathNewString",
45118 xmlMemBlocks() - mem_base);
45119 test_ret++;
45120 printf(" %d", n_val);
45121 printf("\n");
45122 }
45123 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045124 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045125#endif
45126
Daniel Veillarda82b1822004-11-08 16:24:57 +000045127 return(test_ret);
45128}
45129
45130
45131static int
45132test_xmlXPathNextAncestor(void) {
45133 int test_ret = 0;
45134
William M. Brack21e4ef22005-01-02 09:53:13 +000045135#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045136 int mem_base;
45137 xmlNodePtr ret_val;
45138 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45139 int n_ctxt;
45140 xmlNodePtr cur; /* the current node in the traversal */
45141 int n_cur;
45142
45143 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45144 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45145 mem_base = xmlMemBlocks();
45146 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45147 cur = gen_xmlNodePtr(n_cur, 1);
45148
45149 ret_val = xmlXPathNextAncestor(ctxt, cur);
45150 desret_xmlNodePtr(ret_val);
45151 call_tests++;
45152 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45153 des_xmlNodePtr(n_cur, cur, 1);
45154 xmlResetLastError();
45155 if (mem_base != xmlMemBlocks()) {
45156 printf("Leak of %d blocks found in xmlXPathNextAncestor",
45157 xmlMemBlocks() - mem_base);
45158 test_ret++;
45159 printf(" %d", n_ctxt);
45160 printf(" %d", n_cur);
45161 printf("\n");
45162 }
45163 }
45164 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045165 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045166#endif
45167
Daniel Veillarda82b1822004-11-08 16:24:57 +000045168 return(test_ret);
45169}
45170
45171
45172static int
45173test_xmlXPathNextAncestorOrSelf(void) {
45174 int test_ret = 0;
45175
William M. Brack21e4ef22005-01-02 09:53:13 +000045176#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045177 int mem_base;
45178 xmlNodePtr ret_val;
45179 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45180 int n_ctxt;
45181 xmlNodePtr cur; /* the current node in the traversal */
45182 int n_cur;
45183
45184 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45185 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45186 mem_base = xmlMemBlocks();
45187 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45188 cur = gen_xmlNodePtr(n_cur, 1);
45189
45190 ret_val = xmlXPathNextAncestorOrSelf(ctxt, cur);
45191 desret_xmlNodePtr(ret_val);
45192 call_tests++;
45193 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45194 des_xmlNodePtr(n_cur, cur, 1);
45195 xmlResetLastError();
45196 if (mem_base != xmlMemBlocks()) {
45197 printf("Leak of %d blocks found in xmlXPathNextAncestorOrSelf",
45198 xmlMemBlocks() - mem_base);
45199 test_ret++;
45200 printf(" %d", n_ctxt);
45201 printf(" %d", n_cur);
45202 printf("\n");
45203 }
45204 }
45205 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045206 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045207#endif
45208
Daniel Veillarda82b1822004-11-08 16:24:57 +000045209 return(test_ret);
45210}
45211
45212
45213static int
45214test_xmlXPathNextAttribute(void) {
45215 int test_ret = 0;
45216
William M. Brack21e4ef22005-01-02 09:53:13 +000045217#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045218 int mem_base;
45219 xmlNodePtr ret_val;
45220 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45221 int n_ctxt;
45222 xmlNodePtr cur; /* the current attribute in the traversal */
45223 int n_cur;
45224
45225 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45226 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45227 mem_base = xmlMemBlocks();
45228 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45229 cur = gen_xmlNodePtr(n_cur, 1);
45230
45231 ret_val = xmlXPathNextAttribute(ctxt, cur);
45232 desret_xmlNodePtr(ret_val);
45233 call_tests++;
45234 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45235 des_xmlNodePtr(n_cur, cur, 1);
45236 xmlResetLastError();
45237 if (mem_base != xmlMemBlocks()) {
45238 printf("Leak of %d blocks found in xmlXPathNextAttribute",
45239 xmlMemBlocks() - mem_base);
45240 test_ret++;
45241 printf(" %d", n_ctxt);
45242 printf(" %d", n_cur);
45243 printf("\n");
45244 }
45245 }
45246 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045247 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045248#endif
45249
Daniel Veillarda82b1822004-11-08 16:24:57 +000045250 return(test_ret);
45251}
45252
45253
45254static int
45255test_xmlXPathNextChild(void) {
45256 int test_ret = 0;
45257
William M. Brack21e4ef22005-01-02 09:53:13 +000045258#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045259 int mem_base;
45260 xmlNodePtr ret_val;
45261 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45262 int n_ctxt;
45263 xmlNodePtr cur; /* the current node in the traversal */
45264 int n_cur;
45265
45266 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45267 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45268 mem_base = xmlMemBlocks();
45269 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45270 cur = gen_xmlNodePtr(n_cur, 1);
45271
45272 ret_val = xmlXPathNextChild(ctxt, cur);
45273 desret_xmlNodePtr(ret_val);
45274 call_tests++;
45275 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45276 des_xmlNodePtr(n_cur, cur, 1);
45277 xmlResetLastError();
45278 if (mem_base != xmlMemBlocks()) {
45279 printf("Leak of %d blocks found in xmlXPathNextChild",
45280 xmlMemBlocks() - mem_base);
45281 test_ret++;
45282 printf(" %d", n_ctxt);
45283 printf(" %d", n_cur);
45284 printf("\n");
45285 }
45286 }
45287 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045288 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045289#endif
45290
Daniel Veillarda82b1822004-11-08 16:24:57 +000045291 return(test_ret);
45292}
45293
45294
45295static int
45296test_xmlXPathNextDescendant(void) {
45297 int test_ret = 0;
45298
William M. Brack21e4ef22005-01-02 09:53:13 +000045299#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045300 int mem_base;
45301 xmlNodePtr ret_val;
45302 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45303 int n_ctxt;
45304 xmlNodePtr cur; /* the current node in the traversal */
45305 int n_cur;
45306
45307 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45308 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45309 mem_base = xmlMemBlocks();
45310 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45311 cur = gen_xmlNodePtr(n_cur, 1);
45312
45313 ret_val = xmlXPathNextDescendant(ctxt, cur);
45314 desret_xmlNodePtr(ret_val);
45315 call_tests++;
45316 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45317 des_xmlNodePtr(n_cur, cur, 1);
45318 xmlResetLastError();
45319 if (mem_base != xmlMemBlocks()) {
45320 printf("Leak of %d blocks found in xmlXPathNextDescendant",
45321 xmlMemBlocks() - mem_base);
45322 test_ret++;
45323 printf(" %d", n_ctxt);
45324 printf(" %d", n_cur);
45325 printf("\n");
45326 }
45327 }
45328 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045329 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045330#endif
45331
Daniel Veillarda82b1822004-11-08 16:24:57 +000045332 return(test_ret);
45333}
45334
45335
45336static int
45337test_xmlXPathNextDescendantOrSelf(void) {
45338 int test_ret = 0;
45339
William M. Brack21e4ef22005-01-02 09:53:13 +000045340#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045341 int mem_base;
45342 xmlNodePtr ret_val;
45343 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45344 int n_ctxt;
45345 xmlNodePtr cur; /* the current node in the traversal */
45346 int n_cur;
45347
45348 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45349 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45350 mem_base = xmlMemBlocks();
45351 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45352 cur = gen_xmlNodePtr(n_cur, 1);
45353
45354 ret_val = xmlXPathNextDescendantOrSelf(ctxt, cur);
45355 desret_xmlNodePtr(ret_val);
45356 call_tests++;
45357 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45358 des_xmlNodePtr(n_cur, cur, 1);
45359 xmlResetLastError();
45360 if (mem_base != xmlMemBlocks()) {
45361 printf("Leak of %d blocks found in xmlXPathNextDescendantOrSelf",
45362 xmlMemBlocks() - mem_base);
45363 test_ret++;
45364 printf(" %d", n_ctxt);
45365 printf(" %d", n_cur);
45366 printf("\n");
45367 }
45368 }
45369 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045370 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045371#endif
45372
Daniel Veillarda82b1822004-11-08 16:24:57 +000045373 return(test_ret);
45374}
45375
45376
45377static int
45378test_xmlXPathNextFollowing(void) {
45379 int test_ret = 0;
45380
William M. Brack21e4ef22005-01-02 09:53:13 +000045381#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045382 int mem_base;
45383 xmlNodePtr ret_val;
45384 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45385 int n_ctxt;
45386 xmlNodePtr cur; /* the current node in the traversal */
45387 int n_cur;
45388
45389 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45390 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45391 mem_base = xmlMemBlocks();
45392 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45393 cur = gen_xmlNodePtr(n_cur, 1);
45394
45395 ret_val = xmlXPathNextFollowing(ctxt, cur);
45396 desret_xmlNodePtr(ret_val);
45397 call_tests++;
45398 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45399 des_xmlNodePtr(n_cur, cur, 1);
45400 xmlResetLastError();
45401 if (mem_base != xmlMemBlocks()) {
45402 printf("Leak of %d blocks found in xmlXPathNextFollowing",
45403 xmlMemBlocks() - mem_base);
45404 test_ret++;
45405 printf(" %d", n_ctxt);
45406 printf(" %d", n_cur);
45407 printf("\n");
45408 }
45409 }
45410 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045411 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045412#endif
45413
Daniel Veillarda82b1822004-11-08 16:24:57 +000045414 return(test_ret);
45415}
45416
45417
45418static int
45419test_xmlXPathNextFollowingSibling(void) {
45420 int test_ret = 0;
45421
William M. Brack21e4ef22005-01-02 09:53:13 +000045422#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045423 int mem_base;
45424 xmlNodePtr ret_val;
45425 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45426 int n_ctxt;
45427 xmlNodePtr cur; /* the current node in the traversal */
45428 int n_cur;
45429
45430 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45431 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45432 mem_base = xmlMemBlocks();
45433 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45434 cur = gen_xmlNodePtr(n_cur, 1);
45435
45436 ret_val = xmlXPathNextFollowingSibling(ctxt, cur);
45437 desret_xmlNodePtr(ret_val);
45438 call_tests++;
45439 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45440 des_xmlNodePtr(n_cur, cur, 1);
45441 xmlResetLastError();
45442 if (mem_base != xmlMemBlocks()) {
45443 printf("Leak of %d blocks found in xmlXPathNextFollowingSibling",
45444 xmlMemBlocks() - mem_base);
45445 test_ret++;
45446 printf(" %d", n_ctxt);
45447 printf(" %d", n_cur);
45448 printf("\n");
45449 }
45450 }
45451 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045452 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045453#endif
45454
Daniel Veillarda82b1822004-11-08 16:24:57 +000045455 return(test_ret);
45456}
45457
45458
45459static int
45460test_xmlXPathNextNamespace(void) {
45461 int test_ret = 0;
45462
William M. Brack21e4ef22005-01-02 09:53:13 +000045463#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045464 int mem_base;
45465 xmlNodePtr ret_val;
45466 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45467 int n_ctxt;
45468 xmlNodePtr cur; /* the current attribute in the traversal */
45469 int n_cur;
45470
45471 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45472 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45473 mem_base = xmlMemBlocks();
45474 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45475 cur = gen_xmlNodePtr(n_cur, 1);
45476
45477 ret_val = xmlXPathNextNamespace(ctxt, cur);
45478 desret_xmlNodePtr(ret_val);
45479 call_tests++;
45480 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45481 des_xmlNodePtr(n_cur, cur, 1);
45482 xmlResetLastError();
45483 if (mem_base != xmlMemBlocks()) {
45484 printf("Leak of %d blocks found in xmlXPathNextNamespace",
45485 xmlMemBlocks() - mem_base);
45486 test_ret++;
45487 printf(" %d", n_ctxt);
45488 printf(" %d", n_cur);
45489 printf("\n");
45490 }
45491 }
45492 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045493 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045494#endif
45495
Daniel Veillarda82b1822004-11-08 16:24:57 +000045496 return(test_ret);
45497}
45498
45499
45500static int
45501test_xmlXPathNextParent(void) {
45502 int test_ret = 0;
45503
William M. Brack21e4ef22005-01-02 09:53:13 +000045504#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045505 int mem_base;
45506 xmlNodePtr ret_val;
45507 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45508 int n_ctxt;
45509 xmlNodePtr cur; /* the current node in the traversal */
45510 int n_cur;
45511
45512 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45513 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45514 mem_base = xmlMemBlocks();
45515 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45516 cur = gen_xmlNodePtr(n_cur, 1);
45517
45518 ret_val = xmlXPathNextParent(ctxt, cur);
45519 desret_xmlNodePtr(ret_val);
45520 call_tests++;
45521 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45522 des_xmlNodePtr(n_cur, cur, 1);
45523 xmlResetLastError();
45524 if (mem_base != xmlMemBlocks()) {
45525 printf("Leak of %d blocks found in xmlXPathNextParent",
45526 xmlMemBlocks() - mem_base);
45527 test_ret++;
45528 printf(" %d", n_ctxt);
45529 printf(" %d", n_cur);
45530 printf("\n");
45531 }
45532 }
45533 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045534 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045535#endif
45536
Daniel Veillarda82b1822004-11-08 16:24:57 +000045537 return(test_ret);
45538}
45539
45540
45541static int
45542test_xmlXPathNextPreceding(void) {
45543 int test_ret = 0;
45544
William M. Brack21e4ef22005-01-02 09:53:13 +000045545#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045546 int mem_base;
45547 xmlNodePtr ret_val;
45548 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45549 int n_ctxt;
45550 xmlNodePtr cur; /* the current node in the traversal */
45551 int n_cur;
45552
45553 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45554 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45555 mem_base = xmlMemBlocks();
45556 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45557 cur = gen_xmlNodePtr(n_cur, 1);
45558
45559 ret_val = xmlXPathNextPreceding(ctxt, cur);
45560 desret_xmlNodePtr(ret_val);
45561 call_tests++;
45562 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45563 des_xmlNodePtr(n_cur, cur, 1);
45564 xmlResetLastError();
45565 if (mem_base != xmlMemBlocks()) {
45566 printf("Leak of %d blocks found in xmlXPathNextPreceding",
45567 xmlMemBlocks() - mem_base);
45568 test_ret++;
45569 printf(" %d", n_ctxt);
45570 printf(" %d", n_cur);
45571 printf("\n");
45572 }
45573 }
45574 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045575 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045576#endif
45577
Daniel Veillarda82b1822004-11-08 16:24:57 +000045578 return(test_ret);
45579}
45580
45581
45582static int
45583test_xmlXPathNextPrecedingSibling(void) {
45584 int test_ret = 0;
45585
William M. Brack21e4ef22005-01-02 09:53:13 +000045586#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045587 int mem_base;
45588 xmlNodePtr ret_val;
45589 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45590 int n_ctxt;
45591 xmlNodePtr cur; /* the current node in the traversal */
45592 int n_cur;
45593
45594 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45595 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45596 mem_base = xmlMemBlocks();
45597 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45598 cur = gen_xmlNodePtr(n_cur, 1);
45599
45600 ret_val = xmlXPathNextPrecedingSibling(ctxt, cur);
45601 desret_xmlNodePtr(ret_val);
45602 call_tests++;
45603 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45604 des_xmlNodePtr(n_cur, cur, 1);
45605 xmlResetLastError();
45606 if (mem_base != xmlMemBlocks()) {
45607 printf("Leak of %d blocks found in xmlXPathNextPrecedingSibling",
45608 xmlMemBlocks() - mem_base);
45609 test_ret++;
45610 printf(" %d", n_ctxt);
45611 printf(" %d", n_cur);
45612 printf("\n");
45613 }
45614 }
45615 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045616 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045617#endif
45618
Daniel Veillarda82b1822004-11-08 16:24:57 +000045619 return(test_ret);
45620}
45621
45622
45623static int
45624test_xmlXPathNextSelf(void) {
45625 int test_ret = 0;
45626
William M. Brack21e4ef22005-01-02 09:53:13 +000045627#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045628 int mem_base;
45629 xmlNodePtr ret_val;
45630 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45631 int n_ctxt;
45632 xmlNodePtr cur; /* the current node in the traversal */
45633 int n_cur;
45634
45635 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45636 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45637 mem_base = xmlMemBlocks();
45638 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45639 cur = gen_xmlNodePtr(n_cur, 1);
45640
45641 ret_val = xmlXPathNextSelf(ctxt, cur);
45642 desret_xmlNodePtr(ret_val);
45643 call_tests++;
45644 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45645 des_xmlNodePtr(n_cur, cur, 1);
45646 xmlResetLastError();
45647 if (mem_base != xmlMemBlocks()) {
45648 printf("Leak of %d blocks found in xmlXPathNextSelf",
45649 xmlMemBlocks() - mem_base);
45650 test_ret++;
45651 printf(" %d", n_ctxt);
45652 printf(" %d", n_cur);
45653 printf("\n");
45654 }
45655 }
45656 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045657 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045658#endif
45659
Daniel Veillarda82b1822004-11-08 16:24:57 +000045660 return(test_ret);
45661}
45662
45663
45664static int
45665test_xmlXPathNodeLeading(void) {
45666 int test_ret = 0;
45667
William M. Brack21e4ef22005-01-02 09:53:13 +000045668#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045669 int mem_base;
45670 xmlNodeSetPtr ret_val;
45671 xmlNodeSetPtr nodes; /* a node-set */
45672 int n_nodes;
45673 xmlNodePtr node; /* a node */
45674 int n_node;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045675
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045676 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
45677 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
45678 mem_base = xmlMemBlocks();
45679 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
45680 node = gen_xmlNodePtr(n_node, 1);
45681
45682 ret_val = xmlXPathNodeLeading(nodes, node);
45683 desret_xmlNodeSetPtr(ret_val);
45684 call_tests++;
45685 des_xmlNodeSetPtr(n_nodes, nodes, 0);
45686 des_xmlNodePtr(n_node, node, 1);
45687 xmlResetLastError();
45688 if (mem_base != xmlMemBlocks()) {
45689 printf("Leak of %d blocks found in xmlXPathNodeLeading",
45690 xmlMemBlocks() - mem_base);
45691 test_ret++;
45692 printf(" %d", n_nodes);
45693 printf(" %d", n_node);
45694 printf("\n");
45695 }
45696 }
45697 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045698 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045699#endif
45700
Daniel Veillarda82b1822004-11-08 16:24:57 +000045701 return(test_ret);
45702}
45703
45704
45705static int
45706test_xmlXPathNodeLeadingSorted(void) {
45707 int test_ret = 0;
45708
William M. Brack21e4ef22005-01-02 09:53:13 +000045709#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045710 int mem_base;
45711 xmlNodeSetPtr ret_val;
45712 xmlNodeSetPtr nodes; /* a node-set, sorted by document order */
45713 int n_nodes;
45714 xmlNodePtr node; /* a node */
45715 int n_node;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045716
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045717 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
45718 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
45719 mem_base = xmlMemBlocks();
45720 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
45721 node = gen_xmlNodePtr(n_node, 1);
45722
45723 ret_val = xmlXPathNodeLeadingSorted(nodes, node);
45724 desret_xmlNodeSetPtr(ret_val);
45725 call_tests++;
45726 des_xmlNodeSetPtr(n_nodes, nodes, 0);
45727 des_xmlNodePtr(n_node, node, 1);
45728 xmlResetLastError();
45729 if (mem_base != xmlMemBlocks()) {
45730 printf("Leak of %d blocks found in xmlXPathNodeLeadingSorted",
45731 xmlMemBlocks() - mem_base);
45732 test_ret++;
45733 printf(" %d", n_nodes);
45734 printf(" %d", n_node);
45735 printf("\n");
45736 }
45737 }
45738 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045739 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045740#endif
45741
Daniel Veillarda82b1822004-11-08 16:24:57 +000045742 return(test_ret);
45743}
45744
45745
45746static int
45747test_xmlXPathNodeSetAdd(void) {
45748 int test_ret = 0;
45749
William M. Brack21e4ef22005-01-02 09:53:13 +000045750#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045751 int mem_base;
45752 xmlNodeSetPtr cur; /* the initial node set */
45753 int n_cur;
45754 xmlNodePtr val; /* a new xmlNodePtr */
45755 int n_val;
45756
45757 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
45758 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
45759 mem_base = xmlMemBlocks();
45760 cur = gen_xmlNodeSetPtr(n_cur, 0);
45761 val = gen_xmlNodePtr(n_val, 1);
45762
45763 xmlXPathNodeSetAdd(cur, val);
45764 call_tests++;
45765 des_xmlNodeSetPtr(n_cur, cur, 0);
45766 des_xmlNodePtr(n_val, val, 1);
45767 xmlResetLastError();
45768 if (mem_base != xmlMemBlocks()) {
45769 printf("Leak of %d blocks found in xmlXPathNodeSetAdd",
45770 xmlMemBlocks() - mem_base);
45771 test_ret++;
45772 printf(" %d", n_cur);
45773 printf(" %d", n_val);
45774 printf("\n");
45775 }
45776 }
45777 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045778 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045779#endif
45780
Daniel Veillarda82b1822004-11-08 16:24:57 +000045781 return(test_ret);
45782}
45783
45784
45785static int
45786test_xmlXPathNodeSetAddNs(void) {
45787 int test_ret = 0;
45788
William M. Brack21e4ef22005-01-02 09:53:13 +000045789#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045790 int mem_base;
45791 xmlNodeSetPtr cur; /* the initial node set */
45792 int n_cur;
45793 xmlNodePtr node; /* the hosting node */
45794 int n_node;
45795 xmlNsPtr ns; /* a the namespace node */
45796 int n_ns;
45797
45798 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
45799 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
45800 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
45801 mem_base = xmlMemBlocks();
45802 cur = gen_xmlNodeSetPtr(n_cur, 0);
45803 node = gen_xmlNodePtr(n_node, 1);
45804 ns = gen_xmlNsPtr(n_ns, 2);
45805
45806 xmlXPathNodeSetAddNs(cur, node, ns);
45807 call_tests++;
45808 des_xmlNodeSetPtr(n_cur, cur, 0);
45809 des_xmlNodePtr(n_node, node, 1);
45810 des_xmlNsPtr(n_ns, ns, 2);
45811 xmlResetLastError();
45812 if (mem_base != xmlMemBlocks()) {
45813 printf("Leak of %d blocks found in xmlXPathNodeSetAddNs",
45814 xmlMemBlocks() - mem_base);
45815 test_ret++;
45816 printf(" %d", n_cur);
45817 printf(" %d", n_node);
45818 printf(" %d", n_ns);
45819 printf("\n");
45820 }
45821 }
45822 }
45823 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045824 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045825#endif
45826
Daniel Veillarda82b1822004-11-08 16:24:57 +000045827 return(test_ret);
45828}
45829
45830
45831static int
45832test_xmlXPathNodeSetAddUnique(void) {
45833 int test_ret = 0;
45834
William M. Brack21e4ef22005-01-02 09:53:13 +000045835#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045836 int mem_base;
45837 xmlNodeSetPtr cur; /* the initial node set */
45838 int n_cur;
45839 xmlNodePtr val; /* a new xmlNodePtr */
45840 int n_val;
45841
45842 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
45843 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
45844 mem_base = xmlMemBlocks();
45845 cur = gen_xmlNodeSetPtr(n_cur, 0);
45846 val = gen_xmlNodePtr(n_val, 1);
45847
45848 xmlXPathNodeSetAddUnique(cur, val);
45849 call_tests++;
45850 des_xmlNodeSetPtr(n_cur, cur, 0);
45851 des_xmlNodePtr(n_val, val, 1);
45852 xmlResetLastError();
45853 if (mem_base != xmlMemBlocks()) {
45854 printf("Leak of %d blocks found in xmlXPathNodeSetAddUnique",
45855 xmlMemBlocks() - mem_base);
45856 test_ret++;
45857 printf(" %d", n_cur);
45858 printf(" %d", n_val);
45859 printf("\n");
45860 }
45861 }
45862 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045863 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045864#endif
45865
Daniel Veillarda82b1822004-11-08 16:24:57 +000045866 return(test_ret);
45867}
45868
45869
45870static int
45871test_xmlXPathNodeSetContains(void) {
45872 int test_ret = 0;
45873
William M. Brack21e4ef22005-01-02 09:53:13 +000045874#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045875 int mem_base;
45876 int ret_val;
45877 xmlNodeSetPtr cur; /* the node-set */
45878 int n_cur;
45879 xmlNodePtr val; /* the node */
45880 int n_val;
45881
45882 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
45883 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
45884 mem_base = xmlMemBlocks();
45885 cur = gen_xmlNodeSetPtr(n_cur, 0);
45886 val = gen_xmlNodePtr(n_val, 1);
45887
45888 ret_val = xmlXPathNodeSetContains(cur, val);
45889 desret_int(ret_val);
45890 call_tests++;
45891 des_xmlNodeSetPtr(n_cur, cur, 0);
45892 des_xmlNodePtr(n_val, val, 1);
45893 xmlResetLastError();
45894 if (mem_base != xmlMemBlocks()) {
45895 printf("Leak of %d blocks found in xmlXPathNodeSetContains",
45896 xmlMemBlocks() - mem_base);
45897 test_ret++;
45898 printf(" %d", n_cur);
45899 printf(" %d", n_val);
45900 printf("\n");
45901 }
45902 }
45903 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045904 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045905#endif
45906
Daniel Veillarda82b1822004-11-08 16:24:57 +000045907 return(test_ret);
45908}
45909
45910
45911static int
45912test_xmlXPathNodeSetDel(void) {
45913 int test_ret = 0;
45914
William M. Brack21e4ef22005-01-02 09:53:13 +000045915#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045916 int mem_base;
45917 xmlNodeSetPtr cur; /* the initial node set */
45918 int n_cur;
45919 xmlNodePtr val; /* an xmlNodePtr */
45920 int n_val;
45921
45922 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
45923 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
45924 mem_base = xmlMemBlocks();
45925 cur = gen_xmlNodeSetPtr(n_cur, 0);
45926 val = gen_xmlNodePtr(n_val, 1);
45927
45928 xmlXPathNodeSetDel(cur, val);
45929 call_tests++;
45930 des_xmlNodeSetPtr(n_cur, cur, 0);
45931 des_xmlNodePtr(n_val, val, 1);
45932 xmlResetLastError();
45933 if (mem_base != xmlMemBlocks()) {
45934 printf("Leak of %d blocks found in xmlXPathNodeSetDel",
45935 xmlMemBlocks() - mem_base);
45936 test_ret++;
45937 printf(" %d", n_cur);
45938 printf(" %d", n_val);
45939 printf("\n");
45940 }
45941 }
45942 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045943 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045944#endif
45945
Daniel Veillarda82b1822004-11-08 16:24:57 +000045946 return(test_ret);
45947}
45948
45949
45950static int
45951test_xmlXPathNodeSetMerge(void) {
45952 int test_ret = 0;
45953
William M. Brack21e4ef22005-01-02 09:53:13 +000045954#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045955 int mem_base;
45956 xmlNodeSetPtr ret_val;
45957 xmlNodeSetPtr val1; /* the first NodeSet or NULL */
45958 int n_val1;
45959 xmlNodeSetPtr val2; /* the second NodeSet */
45960 int n_val2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045961
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045962 for (n_val1 = 0;n_val1 < gen_nb_xmlNodeSetPtr;n_val1++) {
45963 for (n_val2 = 0;n_val2 < gen_nb_xmlNodeSetPtr;n_val2++) {
45964 mem_base = xmlMemBlocks();
45965 val1 = gen_xmlNodeSetPtr(n_val1, 0);
45966 val2 = gen_xmlNodeSetPtr(n_val2, 1);
45967
45968 ret_val = xmlXPathNodeSetMerge(val1, val2);
45969 desret_xmlNodeSetPtr(ret_val);
45970 call_tests++;
45971 des_xmlNodeSetPtr(n_val1, val1, 0);
45972 des_xmlNodeSetPtr(n_val2, val2, 1);
45973 xmlResetLastError();
45974 if (mem_base != xmlMemBlocks()) {
45975 printf("Leak of %d blocks found in xmlXPathNodeSetMerge",
45976 xmlMemBlocks() - mem_base);
45977 test_ret++;
45978 printf(" %d", n_val1);
45979 printf(" %d", n_val2);
45980 printf("\n");
45981 }
45982 }
45983 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045984 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045985#endif
45986
Daniel Veillarda82b1822004-11-08 16:24:57 +000045987 return(test_ret);
45988}
45989
45990
45991static int
45992test_xmlXPathNodeSetRemove(void) {
45993 int test_ret = 0;
45994
William M. Brack21e4ef22005-01-02 09:53:13 +000045995#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045996 int mem_base;
45997 xmlNodeSetPtr cur; /* the initial node set */
45998 int n_cur;
45999 int val; /* the index to remove */
46000 int n_val;
46001
46002 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
46003 for (n_val = 0;n_val < gen_nb_int;n_val++) {
46004 mem_base = xmlMemBlocks();
46005 cur = gen_xmlNodeSetPtr(n_cur, 0);
46006 val = gen_int(n_val, 1);
46007
46008 xmlXPathNodeSetRemove(cur, val);
46009 call_tests++;
46010 des_xmlNodeSetPtr(n_cur, cur, 0);
46011 des_int(n_val, val, 1);
46012 xmlResetLastError();
46013 if (mem_base != xmlMemBlocks()) {
46014 printf("Leak of %d blocks found in xmlXPathNodeSetRemove",
46015 xmlMemBlocks() - mem_base);
46016 test_ret++;
46017 printf(" %d", n_cur);
46018 printf(" %d", n_val);
46019 printf("\n");
46020 }
46021 }
46022 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046023 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046024#endif
46025
Daniel Veillarda82b1822004-11-08 16:24:57 +000046026 return(test_ret);
46027}
46028
46029
46030static int
46031test_xmlXPathNodeSetSort(void) {
46032 int test_ret = 0;
46033
William M. Brack21e4ef22005-01-02 09:53:13 +000046034#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046035 int mem_base;
46036 xmlNodeSetPtr set; /* the node set */
46037 int n_set;
46038
46039 for (n_set = 0;n_set < gen_nb_xmlNodeSetPtr;n_set++) {
46040 mem_base = xmlMemBlocks();
46041 set = gen_xmlNodeSetPtr(n_set, 0);
46042
46043 xmlXPathNodeSetSort(set);
46044 call_tests++;
46045 des_xmlNodeSetPtr(n_set, set, 0);
46046 xmlResetLastError();
46047 if (mem_base != xmlMemBlocks()) {
46048 printf("Leak of %d blocks found in xmlXPathNodeSetSort",
46049 xmlMemBlocks() - mem_base);
46050 test_ret++;
46051 printf(" %d", n_set);
46052 printf("\n");
46053 }
46054 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046055 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046056#endif
46057
Daniel Veillarda82b1822004-11-08 16:24:57 +000046058 return(test_ret);
46059}
46060
46061
46062static int
46063test_xmlXPathNodeTrailing(void) {
46064 int test_ret = 0;
46065
William M. Brack21e4ef22005-01-02 09:53:13 +000046066#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046067 int mem_base;
46068 xmlNodeSetPtr ret_val;
46069 xmlNodeSetPtr nodes; /* a node-set */
46070 int n_nodes;
46071 xmlNodePtr node; /* a node */
46072 int n_node;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046073
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046074 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
46075 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
46076 mem_base = xmlMemBlocks();
46077 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
46078 node = gen_xmlNodePtr(n_node, 1);
46079
46080 ret_val = xmlXPathNodeTrailing(nodes, node);
46081 desret_xmlNodeSetPtr(ret_val);
46082 call_tests++;
46083 des_xmlNodeSetPtr(n_nodes, nodes, 0);
46084 des_xmlNodePtr(n_node, node, 1);
46085 xmlResetLastError();
46086 if (mem_base != xmlMemBlocks()) {
46087 printf("Leak of %d blocks found in xmlXPathNodeTrailing",
46088 xmlMemBlocks() - mem_base);
46089 test_ret++;
46090 printf(" %d", n_nodes);
46091 printf(" %d", n_node);
46092 printf("\n");
46093 }
46094 }
46095 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046096 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046097#endif
46098
Daniel Veillarda82b1822004-11-08 16:24:57 +000046099 return(test_ret);
46100}
46101
46102
46103static int
46104test_xmlXPathNodeTrailingSorted(void) {
46105 int test_ret = 0;
46106
William M. Brack21e4ef22005-01-02 09:53:13 +000046107#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046108 int mem_base;
46109 xmlNodeSetPtr ret_val;
46110 xmlNodeSetPtr nodes; /* a node-set, sorted by document order */
46111 int n_nodes;
46112 xmlNodePtr node; /* a node */
46113 int n_node;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046114
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046115 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
46116 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
46117 mem_base = xmlMemBlocks();
46118 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
46119 node = gen_xmlNodePtr(n_node, 1);
46120
46121 ret_val = xmlXPathNodeTrailingSorted(nodes, node);
46122 desret_xmlNodeSetPtr(ret_val);
46123 call_tests++;
46124 des_xmlNodeSetPtr(n_nodes, nodes, 0);
46125 des_xmlNodePtr(n_node, node, 1);
46126 xmlResetLastError();
46127 if (mem_base != xmlMemBlocks()) {
46128 printf("Leak of %d blocks found in xmlXPathNodeTrailingSorted",
46129 xmlMemBlocks() - mem_base);
46130 test_ret++;
46131 printf(" %d", n_nodes);
46132 printf(" %d", n_node);
46133 printf("\n");
46134 }
46135 }
46136 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046137 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046138#endif
46139
Daniel Veillarda82b1822004-11-08 16:24:57 +000046140 return(test_ret);
46141}
46142
46143
46144static int
46145test_xmlXPathNormalizeFunction(void) {
46146 int test_ret = 0;
46147
William M. Brack21e4ef22005-01-02 09:53:13 +000046148#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046149 int mem_base;
46150 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46151 int n_ctxt;
46152 int nargs; /* the number of arguments */
46153 int n_nargs;
46154
46155 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46156 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46157 mem_base = xmlMemBlocks();
46158 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46159 nargs = gen_int(n_nargs, 1);
46160
46161 xmlXPathNormalizeFunction(ctxt, nargs);
46162 call_tests++;
46163 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46164 des_int(n_nargs, nargs, 1);
46165 xmlResetLastError();
46166 if (mem_base != xmlMemBlocks()) {
46167 printf("Leak of %d blocks found in xmlXPathNormalizeFunction",
46168 xmlMemBlocks() - mem_base);
46169 test_ret++;
46170 printf(" %d", n_ctxt);
46171 printf(" %d", n_nargs);
46172 printf("\n");
46173 }
46174 }
46175 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046176 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046177#endif
46178
Daniel Veillarda82b1822004-11-08 16:24:57 +000046179 return(test_ret);
46180}
46181
46182
46183static int
46184test_xmlXPathNotEqualValues(void) {
46185 int test_ret = 0;
46186
William M. Brack21e4ef22005-01-02 09:53:13 +000046187#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046188 int mem_base;
46189 int ret_val;
46190 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46191 int n_ctxt;
46192
46193 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46194 mem_base = xmlMemBlocks();
46195 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46196
46197 ret_val = xmlXPathNotEqualValues(ctxt);
46198 desret_int(ret_val);
46199 call_tests++;
46200 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46201 xmlResetLastError();
46202 if (mem_base != xmlMemBlocks()) {
46203 printf("Leak of %d blocks found in xmlXPathNotEqualValues",
46204 xmlMemBlocks() - mem_base);
46205 test_ret++;
46206 printf(" %d", n_ctxt);
46207 printf("\n");
46208 }
46209 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046210 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046211#endif
46212
Daniel Veillarda82b1822004-11-08 16:24:57 +000046213 return(test_ret);
46214}
46215
46216
46217static int
46218test_xmlXPathNotFunction(void) {
46219 int test_ret = 0;
46220
William M. Brack21e4ef22005-01-02 09:53:13 +000046221#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046222 int mem_base;
46223 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46224 int n_ctxt;
46225 int nargs; /* the number of arguments */
46226 int n_nargs;
46227
46228 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46229 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46230 mem_base = xmlMemBlocks();
46231 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46232 nargs = gen_int(n_nargs, 1);
46233
46234 xmlXPathNotFunction(ctxt, nargs);
46235 call_tests++;
46236 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46237 des_int(n_nargs, nargs, 1);
46238 xmlResetLastError();
46239 if (mem_base != xmlMemBlocks()) {
46240 printf("Leak of %d blocks found in xmlXPathNotFunction",
46241 xmlMemBlocks() - mem_base);
46242 test_ret++;
46243 printf(" %d", n_ctxt);
46244 printf(" %d", n_nargs);
46245 printf("\n");
46246 }
46247 }
46248 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046249 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046250#endif
46251
Daniel Veillarda82b1822004-11-08 16:24:57 +000046252 return(test_ret);
46253}
46254
46255
46256static int
46257test_xmlXPathNsLookup(void) {
46258 int test_ret = 0;
46259
William M. Brack21e4ef22005-01-02 09:53:13 +000046260#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046261 int mem_base;
46262 const xmlChar * ret_val;
46263 xmlXPathContextPtr ctxt; /* the XPath context */
46264 int n_ctxt;
46265 xmlChar * prefix; /* the namespace prefix value */
46266 int n_prefix;
46267
46268 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46269 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
46270 mem_base = xmlMemBlocks();
46271 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46272 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
46273
William M. Brackf13f77f2004-11-12 16:03:48 +000046274 ret_val = xmlXPathNsLookup(ctxt, (const xmlChar *)prefix);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046275 desret_const_xmlChar_ptr(ret_val);
46276 call_tests++;
46277 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000046278 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046279 xmlResetLastError();
46280 if (mem_base != xmlMemBlocks()) {
46281 printf("Leak of %d blocks found in xmlXPathNsLookup",
46282 xmlMemBlocks() - mem_base);
46283 test_ret++;
46284 printf(" %d", n_ctxt);
46285 printf(" %d", n_prefix);
46286 printf("\n");
46287 }
46288 }
46289 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046290 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046291#endif
46292
Daniel Veillarda82b1822004-11-08 16:24:57 +000046293 return(test_ret);
46294}
46295
46296
46297static int
46298test_xmlXPathNumberFunction(void) {
46299 int test_ret = 0;
46300
William M. Brack21e4ef22005-01-02 09:53:13 +000046301#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046302 int mem_base;
46303 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46304 int n_ctxt;
46305 int nargs; /* the number of arguments */
46306 int n_nargs;
46307
46308 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46309 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46310 mem_base = xmlMemBlocks();
46311 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46312 nargs = gen_int(n_nargs, 1);
46313
46314 xmlXPathNumberFunction(ctxt, nargs);
46315 call_tests++;
46316 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46317 des_int(n_nargs, nargs, 1);
46318 xmlResetLastError();
46319 if (mem_base != xmlMemBlocks()) {
46320 printf("Leak of %d blocks found in xmlXPathNumberFunction",
46321 xmlMemBlocks() - mem_base);
46322 test_ret++;
46323 printf(" %d", n_ctxt);
46324 printf(" %d", n_nargs);
46325 printf("\n");
46326 }
46327 }
46328 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046329 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046330#endif
46331
Daniel Veillarda82b1822004-11-08 16:24:57 +000046332 return(test_ret);
46333}
46334
46335
46336static int
46337test_xmlXPathParseNCName(void) {
46338 int test_ret = 0;
46339
William M. Brack21e4ef22005-01-02 09:53:13 +000046340#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046341 int mem_base;
46342 xmlChar * ret_val;
46343 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46344 int n_ctxt;
46345
46346 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46347 mem_base = xmlMemBlocks();
46348 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46349
46350 ret_val = xmlXPathParseNCName(ctxt);
46351 desret_xmlChar_ptr(ret_val);
46352 call_tests++;
46353 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46354 xmlResetLastError();
46355 if (mem_base != xmlMemBlocks()) {
46356 printf("Leak of %d blocks found in xmlXPathParseNCName",
46357 xmlMemBlocks() - mem_base);
46358 test_ret++;
46359 printf(" %d", n_ctxt);
46360 printf("\n");
46361 }
46362 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046363 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046364#endif
46365
Daniel Veillarda82b1822004-11-08 16:24:57 +000046366 return(test_ret);
46367}
46368
46369
46370static int
46371test_xmlXPathParseName(void) {
46372 int test_ret = 0;
46373
William M. Brack21e4ef22005-01-02 09:53:13 +000046374#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046375 int mem_base;
46376 xmlChar * ret_val;
46377 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46378 int n_ctxt;
46379
46380 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46381 mem_base = xmlMemBlocks();
46382 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46383
46384 ret_val = xmlXPathParseName(ctxt);
46385 desret_xmlChar_ptr(ret_val);
46386 call_tests++;
46387 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46388 xmlResetLastError();
46389 if (mem_base != xmlMemBlocks()) {
46390 printf("Leak of %d blocks found in xmlXPathParseName",
46391 xmlMemBlocks() - mem_base);
46392 test_ret++;
46393 printf(" %d", n_ctxt);
46394 printf("\n");
46395 }
46396 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046397 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046398#endif
46399
Daniel Veillarda82b1822004-11-08 16:24:57 +000046400 return(test_ret);
46401}
46402
46403
46404static int
46405test_xmlXPathPopBoolean(void) {
46406 int test_ret = 0;
46407
William M. Brack21e4ef22005-01-02 09:53:13 +000046408#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046409 int mem_base;
46410 int ret_val;
46411 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
46412 int n_ctxt;
46413
46414 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46415 mem_base = xmlMemBlocks();
46416 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46417
46418 ret_val = xmlXPathPopBoolean(ctxt);
46419 desret_int(ret_val);
46420 call_tests++;
46421 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46422 xmlResetLastError();
46423 if (mem_base != xmlMemBlocks()) {
46424 printf("Leak of %d blocks found in xmlXPathPopBoolean",
46425 xmlMemBlocks() - mem_base);
46426 test_ret++;
46427 printf(" %d", n_ctxt);
46428 printf("\n");
46429 }
46430 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046431 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046432#endif
46433
Daniel Veillarda82b1822004-11-08 16:24:57 +000046434 return(test_ret);
46435}
46436
46437
46438static int
46439test_xmlXPathPopExternal(void) {
46440 int test_ret = 0;
46441
William M. Brack21e4ef22005-01-02 09:53:13 +000046442#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046443 int mem_base;
46444 void * ret_val;
46445 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
46446 int n_ctxt;
46447
46448 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46449 mem_base = xmlMemBlocks();
46450 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46451
46452 ret_val = xmlXPathPopExternal(ctxt);
46453 desret_void_ptr(ret_val);
46454 call_tests++;
46455 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46456 xmlResetLastError();
46457 if (mem_base != xmlMemBlocks()) {
46458 printf("Leak of %d blocks found in xmlXPathPopExternal",
46459 xmlMemBlocks() - mem_base);
46460 test_ret++;
46461 printf(" %d", n_ctxt);
46462 printf("\n");
46463 }
46464 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046465 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046466#endif
46467
Daniel Veillarda82b1822004-11-08 16:24:57 +000046468 return(test_ret);
46469}
46470
46471
46472static int
46473test_xmlXPathPopNodeSet(void) {
46474 int test_ret = 0;
46475
William M. Brack21e4ef22005-01-02 09:53:13 +000046476#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046477 int mem_base;
46478 xmlNodeSetPtr ret_val;
46479 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
46480 int n_ctxt;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046481
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046482 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46483 mem_base = xmlMemBlocks();
46484 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46485
46486 ret_val = xmlXPathPopNodeSet(ctxt);
46487 desret_xmlNodeSetPtr(ret_val);
46488 call_tests++;
46489 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46490 xmlResetLastError();
46491 if (mem_base != xmlMemBlocks()) {
46492 printf("Leak of %d blocks found in xmlXPathPopNodeSet",
46493 xmlMemBlocks() - mem_base);
46494 test_ret++;
46495 printf(" %d", n_ctxt);
46496 printf("\n");
46497 }
46498 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046499 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046500#endif
46501
Daniel Veillarda82b1822004-11-08 16:24:57 +000046502 return(test_ret);
46503}
46504
46505
46506static int
46507test_xmlXPathPopNumber(void) {
46508 int test_ret = 0;
46509
William M. Brack21e4ef22005-01-02 09:53:13 +000046510#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046511 int mem_base;
46512 double ret_val;
46513 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
46514 int n_ctxt;
46515
46516 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46517 mem_base = xmlMemBlocks();
46518 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46519
46520 ret_val = xmlXPathPopNumber(ctxt);
46521 desret_double(ret_val);
46522 call_tests++;
46523 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46524 xmlResetLastError();
46525 if (mem_base != xmlMemBlocks()) {
46526 printf("Leak of %d blocks found in xmlXPathPopNumber",
46527 xmlMemBlocks() - mem_base);
46528 test_ret++;
46529 printf(" %d", n_ctxt);
46530 printf("\n");
46531 }
46532 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046533 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046534#endif
46535
Daniel Veillarda82b1822004-11-08 16:24:57 +000046536 return(test_ret);
46537}
46538
46539
46540static int
46541test_xmlXPathPopString(void) {
46542 int test_ret = 0;
46543
William M. Brack21e4ef22005-01-02 09:53:13 +000046544#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046545 int mem_base;
46546 xmlChar * ret_val;
46547 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
46548 int n_ctxt;
46549
46550 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46551 mem_base = xmlMemBlocks();
46552 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46553
46554 ret_val = xmlXPathPopString(ctxt);
46555 desret_xmlChar_ptr(ret_val);
46556 call_tests++;
46557 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46558 xmlResetLastError();
46559 if (mem_base != xmlMemBlocks()) {
46560 printf("Leak of %d blocks found in xmlXPathPopString",
46561 xmlMemBlocks() - mem_base);
46562 test_ret++;
46563 printf(" %d", n_ctxt);
46564 printf("\n");
46565 }
46566 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046567 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046568#endif
46569
Daniel Veillarda82b1822004-11-08 16:24:57 +000046570 return(test_ret);
46571}
46572
46573
46574static int
46575test_xmlXPathPositionFunction(void) {
46576 int test_ret = 0;
46577
William M. Brack21e4ef22005-01-02 09:53:13 +000046578#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046579 int mem_base;
46580 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46581 int n_ctxt;
46582 int nargs; /* the number of arguments */
46583 int n_nargs;
46584
46585 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46586 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46587 mem_base = xmlMemBlocks();
46588 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46589 nargs = gen_int(n_nargs, 1);
46590
46591 xmlXPathPositionFunction(ctxt, nargs);
46592 call_tests++;
46593 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46594 des_int(n_nargs, nargs, 1);
46595 xmlResetLastError();
46596 if (mem_base != xmlMemBlocks()) {
46597 printf("Leak of %d blocks found in xmlXPathPositionFunction",
46598 xmlMemBlocks() - mem_base);
46599 test_ret++;
46600 printf(" %d", n_ctxt);
46601 printf(" %d", n_nargs);
46602 printf("\n");
46603 }
46604 }
46605 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046606 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046607#endif
46608
Daniel Veillarda82b1822004-11-08 16:24:57 +000046609 return(test_ret);
46610}
46611
46612
46613static int
46614test_xmlXPathRegisterAllFunctions(void) {
46615 int test_ret = 0;
46616
William M. Brack21e4ef22005-01-02 09:53:13 +000046617#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046618 int mem_base;
46619 xmlXPathContextPtr ctxt; /* the XPath context */
46620 int n_ctxt;
46621
46622 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46623 mem_base = xmlMemBlocks();
46624 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46625
46626 xmlXPathRegisterAllFunctions(ctxt);
46627 call_tests++;
46628 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
46629 xmlResetLastError();
46630 if (mem_base != xmlMemBlocks()) {
46631 printf("Leak of %d blocks found in xmlXPathRegisterAllFunctions",
46632 xmlMemBlocks() - mem_base);
46633 test_ret++;
46634 printf(" %d", n_ctxt);
46635 printf("\n");
46636 }
46637 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046638 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046639#endif
46640
Daniel Veillarda82b1822004-11-08 16:24:57 +000046641 return(test_ret);
46642}
46643
46644
46645static int
46646test_xmlXPathRegisterFunc(void) {
46647 int test_ret = 0;
46648
46649
46650 /* missing type support */
46651 return(test_ret);
46652}
46653
46654
46655static int
46656test_xmlXPathRegisterFuncLookup(void) {
46657 int test_ret = 0;
46658
46659
46660 /* missing type support */
46661 return(test_ret);
46662}
46663
46664
46665static int
46666test_xmlXPathRegisterFuncNS(void) {
46667 int test_ret = 0;
46668
46669
46670 /* missing type support */
46671 return(test_ret);
46672}
46673
46674
46675static int
46676test_xmlXPathRegisterNs(void) {
46677 int test_ret = 0;
46678
William M. Brack21e4ef22005-01-02 09:53:13 +000046679#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046680 int mem_base;
46681 int ret_val;
46682 xmlXPathContextPtr ctxt; /* the XPath context */
46683 int n_ctxt;
46684 xmlChar * prefix; /* the namespace prefix */
46685 int n_prefix;
46686 xmlChar * ns_uri; /* the namespace name */
46687 int n_ns_uri;
46688
46689 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46690 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
46691 for (n_ns_uri = 0;n_ns_uri < gen_nb_const_xmlChar_ptr;n_ns_uri++) {
46692 mem_base = xmlMemBlocks();
46693 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46694 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
46695 ns_uri = gen_const_xmlChar_ptr(n_ns_uri, 2);
46696
William M. Brackf13f77f2004-11-12 16:03:48 +000046697 ret_val = xmlXPathRegisterNs(ctxt, (const xmlChar *)prefix, (const xmlChar *)ns_uri);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046698 desret_int(ret_val);
46699 call_tests++;
46700 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000046701 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
46702 des_const_xmlChar_ptr(n_ns_uri, (const xmlChar *)ns_uri, 2);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046703 xmlResetLastError();
46704 if (mem_base != xmlMemBlocks()) {
46705 printf("Leak of %d blocks found in xmlXPathRegisterNs",
46706 xmlMemBlocks() - mem_base);
46707 test_ret++;
46708 printf(" %d", n_ctxt);
46709 printf(" %d", n_prefix);
46710 printf(" %d", n_ns_uri);
46711 printf("\n");
46712 }
46713 }
46714 }
46715 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046716 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046717#endif
46718
Daniel Veillarda82b1822004-11-08 16:24:57 +000046719 return(test_ret);
46720}
46721
46722
46723static int
46724test_xmlXPathRegisterVariable(void) {
46725 int test_ret = 0;
46726
William M. Brack21e4ef22005-01-02 09:53:13 +000046727#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046728 int mem_base;
46729 int ret_val;
46730 xmlXPathContextPtr ctxt; /* the XPath context */
46731 int n_ctxt;
46732 xmlChar * name; /* the variable name */
46733 int n_name;
46734 xmlXPathObjectPtr value; /* the variable value or NULL */
46735 int n_value;
46736
46737 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46738 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
46739 for (n_value = 0;n_value < gen_nb_xmlXPathObjectPtr;n_value++) {
46740 mem_base = xmlMemBlocks();
46741 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46742 name = gen_const_xmlChar_ptr(n_name, 1);
46743 value = gen_xmlXPathObjectPtr(n_value, 2);
46744
William M. Brackf13f77f2004-11-12 16:03:48 +000046745 ret_val = xmlXPathRegisterVariable(ctxt, (const xmlChar *)name, value);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046746 desret_int(ret_val);
46747 call_tests++;
46748 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000046749 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046750 des_xmlXPathObjectPtr(n_value, value, 2);
46751 xmlResetLastError();
46752 if (mem_base != xmlMemBlocks()) {
46753 printf("Leak of %d blocks found in xmlXPathRegisterVariable",
46754 xmlMemBlocks() - mem_base);
46755 test_ret++;
46756 printf(" %d", n_ctxt);
46757 printf(" %d", n_name);
46758 printf(" %d", n_value);
46759 printf("\n");
46760 }
46761 }
46762 }
46763 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046764 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046765#endif
46766
Daniel Veillarda82b1822004-11-08 16:24:57 +000046767 return(test_ret);
46768}
46769
46770
46771static int
46772test_xmlXPathRegisterVariableLookup(void) {
46773 int test_ret = 0;
46774
46775
46776 /* missing type support */
46777 return(test_ret);
46778}
46779
46780
46781static int
46782test_xmlXPathRegisterVariableNS(void) {
46783 int test_ret = 0;
46784
William M. Brack21e4ef22005-01-02 09:53:13 +000046785#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046786 int mem_base;
46787 int ret_val;
46788 xmlXPathContextPtr ctxt; /* the XPath context */
46789 int n_ctxt;
46790 xmlChar * name; /* the variable name */
46791 int n_name;
46792 xmlChar * ns_uri; /* the variable namespace URI */
46793 int n_ns_uri;
46794 xmlXPathObjectPtr value; /* the variable value or NULL */
46795 int n_value;
46796
46797 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46798 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
46799 for (n_ns_uri = 0;n_ns_uri < gen_nb_const_xmlChar_ptr;n_ns_uri++) {
46800 for (n_value = 0;n_value < gen_nb_xmlXPathObjectPtr;n_value++) {
46801 mem_base = xmlMemBlocks();
46802 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46803 name = gen_const_xmlChar_ptr(n_name, 1);
46804 ns_uri = gen_const_xmlChar_ptr(n_ns_uri, 2);
46805 value = gen_xmlXPathObjectPtr(n_value, 3);
46806
William M. Brackf13f77f2004-11-12 16:03:48 +000046807 ret_val = xmlXPathRegisterVariableNS(ctxt, (const xmlChar *)name, (const xmlChar *)ns_uri, value);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046808 desret_int(ret_val);
46809 call_tests++;
46810 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000046811 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
46812 des_const_xmlChar_ptr(n_ns_uri, (const xmlChar *)ns_uri, 2);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046813 des_xmlXPathObjectPtr(n_value, value, 3);
46814 xmlResetLastError();
46815 if (mem_base != xmlMemBlocks()) {
46816 printf("Leak of %d blocks found in xmlXPathRegisterVariableNS",
46817 xmlMemBlocks() - mem_base);
46818 test_ret++;
46819 printf(" %d", n_ctxt);
46820 printf(" %d", n_name);
46821 printf(" %d", n_ns_uri);
46822 printf(" %d", n_value);
46823 printf("\n");
46824 }
46825 }
46826 }
46827 }
46828 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046829 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046830#endif
46831
Daniel Veillarda82b1822004-11-08 16:24:57 +000046832 return(test_ret);
46833}
46834
46835
46836static int
46837test_xmlXPathRegisteredFuncsCleanup(void) {
46838 int test_ret = 0;
46839
William M. Brack21e4ef22005-01-02 09:53:13 +000046840#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046841 int mem_base;
46842 xmlXPathContextPtr ctxt; /* the XPath context */
46843 int n_ctxt;
46844
46845 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46846 mem_base = xmlMemBlocks();
46847 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46848
46849 xmlXPathRegisteredFuncsCleanup(ctxt);
46850 call_tests++;
46851 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
46852 xmlResetLastError();
46853 if (mem_base != xmlMemBlocks()) {
46854 printf("Leak of %d blocks found in xmlXPathRegisteredFuncsCleanup",
46855 xmlMemBlocks() - mem_base);
46856 test_ret++;
46857 printf(" %d", n_ctxt);
46858 printf("\n");
46859 }
46860 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046861 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046862#endif
46863
Daniel Veillarda82b1822004-11-08 16:24:57 +000046864 return(test_ret);
46865}
46866
46867
46868static int
46869test_xmlXPathRegisteredNsCleanup(void) {
46870 int test_ret = 0;
46871
William M. Brack21e4ef22005-01-02 09:53:13 +000046872#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046873 int mem_base;
46874 xmlXPathContextPtr ctxt; /* the XPath context */
46875 int n_ctxt;
46876
46877 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46878 mem_base = xmlMemBlocks();
46879 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46880
46881 xmlXPathRegisteredNsCleanup(ctxt);
46882 call_tests++;
46883 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
46884 xmlResetLastError();
46885 if (mem_base != xmlMemBlocks()) {
46886 printf("Leak of %d blocks found in xmlXPathRegisteredNsCleanup",
46887 xmlMemBlocks() - mem_base);
46888 test_ret++;
46889 printf(" %d", n_ctxt);
46890 printf("\n");
46891 }
46892 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046893 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046894#endif
46895
Daniel Veillarda82b1822004-11-08 16:24:57 +000046896 return(test_ret);
46897}
46898
46899
46900static int
46901test_xmlXPathRegisteredVariablesCleanup(void) {
46902 int test_ret = 0;
46903
William M. Brack21e4ef22005-01-02 09:53:13 +000046904#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046905 int mem_base;
46906 xmlXPathContextPtr ctxt; /* the XPath context */
46907 int n_ctxt;
46908
46909 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46910 mem_base = xmlMemBlocks();
46911 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46912
46913 xmlXPathRegisteredVariablesCleanup(ctxt);
46914 call_tests++;
46915 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
46916 xmlResetLastError();
46917 if (mem_base != xmlMemBlocks()) {
46918 printf("Leak of %d blocks found in xmlXPathRegisteredVariablesCleanup",
46919 xmlMemBlocks() - mem_base);
46920 test_ret++;
46921 printf(" %d", n_ctxt);
46922 printf("\n");
46923 }
46924 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046925 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046926#endif
46927
Daniel Veillarda82b1822004-11-08 16:24:57 +000046928 return(test_ret);
46929}
46930
46931
46932static int
46933test_xmlXPathRoot(void) {
46934 int test_ret = 0;
46935
William M. Brack21e4ef22005-01-02 09:53:13 +000046936#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046937 int mem_base;
46938 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46939 int n_ctxt;
46940
46941 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46942 mem_base = xmlMemBlocks();
46943 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46944
46945 xmlXPathRoot(ctxt);
46946 call_tests++;
46947 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46948 xmlResetLastError();
46949 if (mem_base != xmlMemBlocks()) {
46950 printf("Leak of %d blocks found in xmlXPathRoot",
46951 xmlMemBlocks() - mem_base);
46952 test_ret++;
46953 printf(" %d", n_ctxt);
46954 printf("\n");
46955 }
46956 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046957 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046958#endif
46959
Daniel Veillarda82b1822004-11-08 16:24:57 +000046960 return(test_ret);
46961}
46962
46963
46964static int
46965test_xmlXPathRoundFunction(void) {
46966 int test_ret = 0;
46967
William M. Brack21e4ef22005-01-02 09:53:13 +000046968#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046969 int mem_base;
46970 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46971 int n_ctxt;
46972 int nargs; /* the number of arguments */
46973 int n_nargs;
46974
46975 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46976 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46977 mem_base = xmlMemBlocks();
46978 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46979 nargs = gen_int(n_nargs, 1);
46980
46981 xmlXPathRoundFunction(ctxt, nargs);
46982 call_tests++;
46983 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46984 des_int(n_nargs, nargs, 1);
46985 xmlResetLastError();
46986 if (mem_base != xmlMemBlocks()) {
46987 printf("Leak of %d blocks found in xmlXPathRoundFunction",
46988 xmlMemBlocks() - mem_base);
46989 test_ret++;
46990 printf(" %d", n_ctxt);
46991 printf(" %d", n_nargs);
46992 printf("\n");
46993 }
46994 }
46995 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046996 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046997#endif
46998
Daniel Veillarda82b1822004-11-08 16:24:57 +000046999 return(test_ret);
47000}
47001
47002
47003static int
47004test_xmlXPathStartsWithFunction(void) {
47005 int test_ret = 0;
47006
William M. Brack21e4ef22005-01-02 09:53:13 +000047007#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047008 int mem_base;
47009 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47010 int n_ctxt;
47011 int nargs; /* the number of arguments */
47012 int n_nargs;
47013
47014 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47015 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47016 mem_base = xmlMemBlocks();
47017 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47018 nargs = gen_int(n_nargs, 1);
47019
47020 xmlXPathStartsWithFunction(ctxt, nargs);
47021 call_tests++;
47022 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47023 des_int(n_nargs, nargs, 1);
47024 xmlResetLastError();
47025 if (mem_base != xmlMemBlocks()) {
47026 printf("Leak of %d blocks found in xmlXPathStartsWithFunction",
47027 xmlMemBlocks() - mem_base);
47028 test_ret++;
47029 printf(" %d", n_ctxt);
47030 printf(" %d", n_nargs);
47031 printf("\n");
47032 }
47033 }
47034 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047035 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047036#endif
47037
Daniel Veillarda82b1822004-11-08 16:24:57 +000047038 return(test_ret);
47039}
47040
47041
47042static int
47043test_xmlXPathStringEvalNumber(void) {
47044 int test_ret = 0;
47045
William M. Brack21e4ef22005-01-02 09:53:13 +000047046#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047047 int mem_base;
47048 double ret_val;
47049 xmlChar * str; /* A string to scan */
47050 int n_str;
47051
47052 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
47053 mem_base = xmlMemBlocks();
47054 str = gen_const_xmlChar_ptr(n_str, 0);
47055
William M. Brackf13f77f2004-11-12 16:03:48 +000047056 ret_val = xmlXPathStringEvalNumber((const xmlChar *)str);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047057 desret_double(ret_val);
47058 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000047059 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047060 xmlResetLastError();
47061 if (mem_base != xmlMemBlocks()) {
47062 printf("Leak of %d blocks found in xmlXPathStringEvalNumber",
47063 xmlMemBlocks() - mem_base);
47064 test_ret++;
47065 printf(" %d", n_str);
47066 printf("\n");
47067 }
47068 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047069 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047070#endif
47071
Daniel Veillarda82b1822004-11-08 16:24:57 +000047072 return(test_ret);
47073}
47074
47075
47076static int
47077test_xmlXPathStringFunction(void) {
47078 int test_ret = 0;
47079
William M. Brack21e4ef22005-01-02 09:53:13 +000047080#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047081 int mem_base;
47082 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47083 int n_ctxt;
47084 int nargs; /* the number of arguments */
47085 int n_nargs;
47086
47087 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47088 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47089 mem_base = xmlMemBlocks();
47090 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47091 nargs = gen_int(n_nargs, 1);
47092
47093 xmlXPathStringFunction(ctxt, nargs);
47094 call_tests++;
47095 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47096 des_int(n_nargs, nargs, 1);
47097 xmlResetLastError();
47098 if (mem_base != xmlMemBlocks()) {
47099 printf("Leak of %d blocks found in xmlXPathStringFunction",
47100 xmlMemBlocks() - mem_base);
47101 test_ret++;
47102 printf(" %d", n_ctxt);
47103 printf(" %d", n_nargs);
47104 printf("\n");
47105 }
47106 }
47107 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047108 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047109#endif
47110
Daniel Veillarda82b1822004-11-08 16:24:57 +000047111 return(test_ret);
47112}
47113
47114
47115static int
47116test_xmlXPathStringLengthFunction(void) {
47117 int test_ret = 0;
47118
William M. Brack21e4ef22005-01-02 09:53:13 +000047119#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047120 int mem_base;
47121 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47122 int n_ctxt;
47123 int nargs; /* the number of arguments */
47124 int n_nargs;
47125
47126 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47127 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47128 mem_base = xmlMemBlocks();
47129 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47130 nargs = gen_int(n_nargs, 1);
47131
47132 xmlXPathStringLengthFunction(ctxt, nargs);
47133 call_tests++;
47134 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47135 des_int(n_nargs, nargs, 1);
47136 xmlResetLastError();
47137 if (mem_base != xmlMemBlocks()) {
47138 printf("Leak of %d blocks found in xmlXPathStringLengthFunction",
47139 xmlMemBlocks() - mem_base);
47140 test_ret++;
47141 printf(" %d", n_ctxt);
47142 printf(" %d", n_nargs);
47143 printf("\n");
47144 }
47145 }
47146 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047147 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047148#endif
47149
Daniel Veillarda82b1822004-11-08 16:24:57 +000047150 return(test_ret);
47151}
47152
47153
47154static int
47155test_xmlXPathSubValues(void) {
47156 int test_ret = 0;
47157
William M. Brack21e4ef22005-01-02 09:53:13 +000047158#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047159 int mem_base;
47160 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47161 int n_ctxt;
47162
47163 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47164 mem_base = xmlMemBlocks();
47165 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47166
47167 xmlXPathSubValues(ctxt);
47168 call_tests++;
47169 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47170 xmlResetLastError();
47171 if (mem_base != xmlMemBlocks()) {
47172 printf("Leak of %d blocks found in xmlXPathSubValues",
47173 xmlMemBlocks() - mem_base);
47174 test_ret++;
47175 printf(" %d", n_ctxt);
47176 printf("\n");
47177 }
47178 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047179 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047180#endif
47181
Daniel Veillarda82b1822004-11-08 16:24:57 +000047182 return(test_ret);
47183}
47184
47185
47186static int
47187test_xmlXPathSubstringAfterFunction(void) {
47188 int test_ret = 0;
47189
William M. Brack21e4ef22005-01-02 09:53:13 +000047190#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047191 int mem_base;
47192 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47193 int n_ctxt;
47194 int nargs; /* the number of arguments */
47195 int n_nargs;
47196
47197 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47198 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47199 mem_base = xmlMemBlocks();
47200 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47201 nargs = gen_int(n_nargs, 1);
47202
47203 xmlXPathSubstringAfterFunction(ctxt, nargs);
47204 call_tests++;
47205 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47206 des_int(n_nargs, nargs, 1);
47207 xmlResetLastError();
47208 if (mem_base != xmlMemBlocks()) {
47209 printf("Leak of %d blocks found in xmlXPathSubstringAfterFunction",
47210 xmlMemBlocks() - mem_base);
47211 test_ret++;
47212 printf(" %d", n_ctxt);
47213 printf(" %d", n_nargs);
47214 printf("\n");
47215 }
47216 }
47217 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047218 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047219#endif
47220
Daniel Veillarda82b1822004-11-08 16:24:57 +000047221 return(test_ret);
47222}
47223
47224
47225static int
47226test_xmlXPathSubstringBeforeFunction(void) {
47227 int test_ret = 0;
47228
William M. Brack21e4ef22005-01-02 09:53:13 +000047229#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047230 int mem_base;
47231 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47232 int n_ctxt;
47233 int nargs; /* the number of arguments */
47234 int n_nargs;
47235
47236 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47237 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47238 mem_base = xmlMemBlocks();
47239 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47240 nargs = gen_int(n_nargs, 1);
47241
47242 xmlXPathSubstringBeforeFunction(ctxt, nargs);
47243 call_tests++;
47244 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47245 des_int(n_nargs, nargs, 1);
47246 xmlResetLastError();
47247 if (mem_base != xmlMemBlocks()) {
47248 printf("Leak of %d blocks found in xmlXPathSubstringBeforeFunction",
47249 xmlMemBlocks() - mem_base);
47250 test_ret++;
47251 printf(" %d", n_ctxt);
47252 printf(" %d", n_nargs);
47253 printf("\n");
47254 }
47255 }
47256 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047257 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047258#endif
47259
Daniel Veillarda82b1822004-11-08 16:24:57 +000047260 return(test_ret);
47261}
47262
47263
47264static int
47265test_xmlXPathSubstringFunction(void) {
47266 int test_ret = 0;
47267
William M. Brack21e4ef22005-01-02 09:53:13 +000047268#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047269 int mem_base;
47270 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47271 int n_ctxt;
47272 int nargs; /* the number of arguments */
47273 int n_nargs;
47274
47275 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47276 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47277 mem_base = xmlMemBlocks();
47278 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47279 nargs = gen_int(n_nargs, 1);
47280
47281 xmlXPathSubstringFunction(ctxt, nargs);
47282 call_tests++;
47283 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47284 des_int(n_nargs, nargs, 1);
47285 xmlResetLastError();
47286 if (mem_base != xmlMemBlocks()) {
47287 printf("Leak of %d blocks found in xmlXPathSubstringFunction",
47288 xmlMemBlocks() - mem_base);
47289 test_ret++;
47290 printf(" %d", n_ctxt);
47291 printf(" %d", n_nargs);
47292 printf("\n");
47293 }
47294 }
47295 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047296 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047297#endif
47298
Daniel Veillarda82b1822004-11-08 16:24:57 +000047299 return(test_ret);
47300}
47301
47302
47303static int
47304test_xmlXPathSumFunction(void) {
47305 int test_ret = 0;
47306
William M. Brack21e4ef22005-01-02 09:53:13 +000047307#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047308 int mem_base;
47309 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47310 int n_ctxt;
47311 int nargs; /* the number of arguments */
47312 int n_nargs;
47313
47314 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47315 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47316 mem_base = xmlMemBlocks();
47317 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47318 nargs = gen_int(n_nargs, 1);
47319
47320 xmlXPathSumFunction(ctxt, nargs);
47321 call_tests++;
47322 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47323 des_int(n_nargs, nargs, 1);
47324 xmlResetLastError();
47325 if (mem_base != xmlMemBlocks()) {
47326 printf("Leak of %d blocks found in xmlXPathSumFunction",
47327 xmlMemBlocks() - mem_base);
47328 test_ret++;
47329 printf(" %d", n_ctxt);
47330 printf(" %d", n_nargs);
47331 printf("\n");
47332 }
47333 }
47334 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047335 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047336#endif
47337
Daniel Veillarda82b1822004-11-08 16:24:57 +000047338 return(test_ret);
47339}
47340
47341
47342static int
47343test_xmlXPathTrailing(void) {
47344 int test_ret = 0;
47345
William M. Brack21e4ef22005-01-02 09:53:13 +000047346#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047347 int mem_base;
47348 xmlNodeSetPtr ret_val;
47349 xmlNodeSetPtr nodes1; /* a node-set */
47350 int n_nodes1;
47351 xmlNodeSetPtr nodes2; /* a node-set */
47352 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047353
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047354 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
47355 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
47356 mem_base = xmlMemBlocks();
47357 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
47358 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
47359
47360 ret_val = xmlXPathTrailing(nodes1, nodes2);
47361 desret_xmlNodeSetPtr(ret_val);
47362 call_tests++;
47363 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
47364 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
47365 xmlResetLastError();
47366 if (mem_base != xmlMemBlocks()) {
47367 printf("Leak of %d blocks found in xmlXPathTrailing",
47368 xmlMemBlocks() - mem_base);
47369 test_ret++;
47370 printf(" %d", n_nodes1);
47371 printf(" %d", n_nodes2);
47372 printf("\n");
47373 }
47374 }
47375 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047376 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047377#endif
47378
Daniel Veillarda82b1822004-11-08 16:24:57 +000047379 return(test_ret);
47380}
47381
47382
47383static int
47384test_xmlXPathTrailingSorted(void) {
47385 int test_ret = 0;
47386
William M. Brack21e4ef22005-01-02 09:53:13 +000047387#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047388 int mem_base;
47389 xmlNodeSetPtr ret_val;
47390 xmlNodeSetPtr nodes1; /* a node-set, sorted by document order */
47391 int n_nodes1;
47392 xmlNodeSetPtr nodes2; /* a node-set, sorted by document order */
47393 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047394
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047395 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
47396 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
47397 mem_base = xmlMemBlocks();
47398 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
47399 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
47400
47401 ret_val = xmlXPathTrailingSorted(nodes1, nodes2);
47402 desret_xmlNodeSetPtr(ret_val);
47403 call_tests++;
47404 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
47405 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
47406 xmlResetLastError();
47407 if (mem_base != xmlMemBlocks()) {
47408 printf("Leak of %d blocks found in xmlXPathTrailingSorted",
47409 xmlMemBlocks() - mem_base);
47410 test_ret++;
47411 printf(" %d", n_nodes1);
47412 printf(" %d", n_nodes2);
47413 printf("\n");
47414 }
47415 }
47416 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047417 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047418#endif
47419
Daniel Veillarda82b1822004-11-08 16:24:57 +000047420 return(test_ret);
47421}
47422
47423
47424static int
47425test_xmlXPathTranslateFunction(void) {
47426 int test_ret = 0;
47427
William M. Brack21e4ef22005-01-02 09:53:13 +000047428#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047429 int mem_base;
47430 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47431 int n_ctxt;
47432 int nargs; /* the number of arguments */
47433 int n_nargs;
47434
47435 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47436 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47437 mem_base = xmlMemBlocks();
47438 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47439 nargs = gen_int(n_nargs, 1);
47440
47441 xmlXPathTranslateFunction(ctxt, nargs);
47442 call_tests++;
47443 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47444 des_int(n_nargs, nargs, 1);
47445 xmlResetLastError();
47446 if (mem_base != xmlMemBlocks()) {
47447 printf("Leak of %d blocks found in xmlXPathTranslateFunction",
47448 xmlMemBlocks() - mem_base);
47449 test_ret++;
47450 printf(" %d", n_ctxt);
47451 printf(" %d", n_nargs);
47452 printf("\n");
47453 }
47454 }
47455 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047456 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047457#endif
47458
Daniel Veillarda82b1822004-11-08 16:24:57 +000047459 return(test_ret);
47460}
47461
47462
47463static int
47464test_xmlXPathTrueFunction(void) {
47465 int test_ret = 0;
47466
William M. Brack21e4ef22005-01-02 09:53:13 +000047467#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047468 int mem_base;
47469 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47470 int n_ctxt;
47471 int nargs; /* the number of arguments */
47472 int n_nargs;
47473
47474 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47475 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47476 mem_base = xmlMemBlocks();
47477 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47478 nargs = gen_int(n_nargs, 1);
47479
47480 xmlXPathTrueFunction(ctxt, nargs);
47481 call_tests++;
47482 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47483 des_int(n_nargs, nargs, 1);
47484 xmlResetLastError();
47485 if (mem_base != xmlMemBlocks()) {
47486 printf("Leak of %d blocks found in xmlXPathTrueFunction",
47487 xmlMemBlocks() - mem_base);
47488 test_ret++;
47489 printf(" %d", n_ctxt);
47490 printf(" %d", n_nargs);
47491 printf("\n");
47492 }
47493 }
47494 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047495 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047496#endif
47497
Daniel Veillarda82b1822004-11-08 16:24:57 +000047498 return(test_ret);
47499}
47500
47501
47502static int
47503test_xmlXPathValueFlipSign(void) {
47504 int test_ret = 0;
47505
William M. Brack21e4ef22005-01-02 09:53:13 +000047506#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047507 int mem_base;
47508 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47509 int n_ctxt;
47510
47511 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47512 mem_base = xmlMemBlocks();
47513 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47514
47515 xmlXPathValueFlipSign(ctxt);
47516 call_tests++;
47517 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47518 xmlResetLastError();
47519 if (mem_base != xmlMemBlocks()) {
47520 printf("Leak of %d blocks found in xmlXPathValueFlipSign",
47521 xmlMemBlocks() - mem_base);
47522 test_ret++;
47523 printf(" %d", n_ctxt);
47524 printf("\n");
47525 }
47526 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047527 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047528#endif
47529
Daniel Veillarda82b1822004-11-08 16:24:57 +000047530 return(test_ret);
47531}
47532
47533
47534static int
47535test_xmlXPathVariableLookup(void) {
47536 int test_ret = 0;
47537
William M. Brack21e4ef22005-01-02 09:53:13 +000047538#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047539 int mem_base;
47540 xmlXPathObjectPtr ret_val;
47541 xmlXPathContextPtr ctxt; /* the XPath context */
47542 int n_ctxt;
47543 xmlChar * name; /* the variable name */
47544 int n_name;
47545
47546 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47547 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
47548 mem_base = xmlMemBlocks();
47549 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47550 name = gen_const_xmlChar_ptr(n_name, 1);
47551
William M. Brackf13f77f2004-11-12 16:03:48 +000047552 ret_val = xmlXPathVariableLookup(ctxt, (const xmlChar *)name);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047553 desret_xmlXPathObjectPtr(ret_val);
47554 call_tests++;
47555 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000047556 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047557 xmlResetLastError();
47558 if (mem_base != xmlMemBlocks()) {
47559 printf("Leak of %d blocks found in xmlXPathVariableLookup",
47560 xmlMemBlocks() - mem_base);
47561 test_ret++;
47562 printf(" %d", n_ctxt);
47563 printf(" %d", n_name);
47564 printf("\n");
47565 }
47566 }
47567 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047568 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047569#endif
47570
Daniel Veillarda82b1822004-11-08 16:24:57 +000047571 return(test_ret);
47572}
47573
47574
47575static int
47576test_xmlXPathVariableLookupNS(void) {
47577 int test_ret = 0;
47578
William M. Brack21e4ef22005-01-02 09:53:13 +000047579#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047580 int mem_base;
47581 xmlXPathObjectPtr ret_val;
47582 xmlXPathContextPtr ctxt; /* the XPath context */
47583 int n_ctxt;
47584 xmlChar * name; /* the variable name */
47585 int n_name;
47586 xmlChar * ns_uri; /* the variable namespace URI */
47587 int n_ns_uri;
47588
47589 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47590 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
47591 for (n_ns_uri = 0;n_ns_uri < gen_nb_const_xmlChar_ptr;n_ns_uri++) {
47592 mem_base = xmlMemBlocks();
47593 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47594 name = gen_const_xmlChar_ptr(n_name, 1);
47595 ns_uri = gen_const_xmlChar_ptr(n_ns_uri, 2);
47596
William M. Brackf13f77f2004-11-12 16:03:48 +000047597 ret_val = xmlXPathVariableLookupNS(ctxt, (const xmlChar *)name, (const xmlChar *)ns_uri);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047598 desret_xmlXPathObjectPtr(ret_val);
47599 call_tests++;
47600 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000047601 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
47602 des_const_xmlChar_ptr(n_ns_uri, (const xmlChar *)ns_uri, 2);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047603 xmlResetLastError();
47604 if (mem_base != xmlMemBlocks()) {
47605 printf("Leak of %d blocks found in xmlXPathVariableLookupNS",
47606 xmlMemBlocks() - mem_base);
47607 test_ret++;
47608 printf(" %d", n_ctxt);
47609 printf(" %d", n_name);
47610 printf(" %d", n_ns_uri);
47611 printf("\n");
47612 }
47613 }
47614 }
47615 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047616 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047617#endif
47618
Daniel Veillarda82b1822004-11-08 16:24:57 +000047619 return(test_ret);
47620}
47621
47622
47623static int
47624test_xmlXPathWrapCString(void) {
47625 int test_ret = 0;
47626
William M. Brack21e4ef22005-01-02 09:53:13 +000047627#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047628 int mem_base;
47629 xmlXPathObjectPtr ret_val;
47630 char * val; /* the char * value */
47631 int n_val;
47632
47633 for (n_val = 0;n_val < gen_nb_char_ptr;n_val++) {
47634 mem_base = xmlMemBlocks();
47635 val = gen_char_ptr(n_val, 0);
47636
47637 ret_val = xmlXPathWrapCString(val);
47638 desret_xmlXPathObjectPtr(ret_val);
47639 call_tests++;
47640 des_char_ptr(n_val, val, 0);
47641 xmlResetLastError();
47642 if (mem_base != xmlMemBlocks()) {
47643 printf("Leak of %d blocks found in xmlXPathWrapCString",
47644 xmlMemBlocks() - mem_base);
47645 test_ret++;
47646 printf(" %d", n_val);
47647 printf("\n");
47648 }
47649 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047650 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047651#endif
47652
Daniel Veillarda82b1822004-11-08 16:24:57 +000047653 return(test_ret);
47654}
47655
47656
47657static int
47658test_xmlXPathWrapExternal(void) {
47659 int test_ret = 0;
47660
William M. Brack21e4ef22005-01-02 09:53:13 +000047661#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047662 int mem_base;
47663 xmlXPathObjectPtr ret_val;
47664 void * val; /* the user data */
47665 int n_val;
47666
47667 for (n_val = 0;n_val < gen_nb_void_ptr;n_val++) {
47668 mem_base = xmlMemBlocks();
47669 val = gen_void_ptr(n_val, 0);
47670
47671 ret_val = xmlXPathWrapExternal(val);
47672 desret_xmlXPathObjectPtr(ret_val);
47673 call_tests++;
47674 des_void_ptr(n_val, val, 0);
47675 xmlResetLastError();
47676 if (mem_base != xmlMemBlocks()) {
47677 printf("Leak of %d blocks found in xmlXPathWrapExternal",
47678 xmlMemBlocks() - mem_base);
47679 test_ret++;
47680 printf(" %d", n_val);
47681 printf("\n");
47682 }
47683 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047684 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047685#endif
47686
Daniel Veillarda82b1822004-11-08 16:24:57 +000047687 return(test_ret);
47688}
47689
47690
47691static int
47692test_xmlXPathWrapNodeSet(void) {
47693 int test_ret = 0;
47694
William M. Brack21e4ef22005-01-02 09:53:13 +000047695#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047696 int mem_base;
47697 xmlXPathObjectPtr ret_val;
47698 xmlNodeSetPtr val; /* the NodePtr value */
47699 int n_val;
47700
47701 for (n_val = 0;n_val < gen_nb_xmlNodeSetPtr;n_val++) {
47702 mem_base = xmlMemBlocks();
47703 val = gen_xmlNodeSetPtr(n_val, 0);
47704
47705 ret_val = xmlXPathWrapNodeSet(val);
47706 desret_xmlXPathObjectPtr(ret_val);
47707 call_tests++;
47708 des_xmlNodeSetPtr(n_val, val, 0);
47709 xmlResetLastError();
47710 if (mem_base != xmlMemBlocks()) {
47711 printf("Leak of %d blocks found in xmlXPathWrapNodeSet",
47712 xmlMemBlocks() - mem_base);
47713 test_ret++;
47714 printf(" %d", n_val);
47715 printf("\n");
47716 }
47717 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047718 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047719#endif
47720
Daniel Veillarda82b1822004-11-08 16:24:57 +000047721 return(test_ret);
47722}
47723
47724
47725static int
47726test_xmlXPatherror(void) {
47727 int test_ret = 0;
47728
William M. Brack21e4ef22005-01-02 09:53:13 +000047729#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047730 int mem_base;
47731 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47732 int n_ctxt;
47733 const char * file; /* the file name */
47734 int n_file;
47735 int line; /* the line number */
47736 int n_line;
47737 int no; /* the error number */
47738 int n_no;
47739
47740 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47741 for (n_file = 0;n_file < gen_nb_filepath;n_file++) {
47742 for (n_line = 0;n_line < gen_nb_int;n_line++) {
47743 for (n_no = 0;n_no < gen_nb_int;n_no++) {
47744 mem_base = xmlMemBlocks();
47745 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47746 file = gen_filepath(n_file, 1);
47747 line = gen_int(n_line, 2);
47748 no = gen_int(n_no, 3);
47749
47750 xmlXPatherror(ctxt, file, line, no);
47751 call_tests++;
47752 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47753 des_filepath(n_file, file, 1);
47754 des_int(n_line, line, 2);
47755 des_int(n_no, no, 3);
47756 xmlResetLastError();
47757 if (mem_base != xmlMemBlocks()) {
47758 printf("Leak of %d blocks found in xmlXPatherror",
47759 xmlMemBlocks() - mem_base);
47760 test_ret++;
47761 printf(" %d", n_ctxt);
47762 printf(" %d", n_file);
47763 printf(" %d", n_line);
47764 printf(" %d", n_no);
47765 printf("\n");
47766 }
47767 }
47768 }
47769 }
47770 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047771 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047772#endif
47773
Daniel Veillarda82b1822004-11-08 16:24:57 +000047774 return(test_ret);
47775}
47776
47777static int
47778test_xpathInternals(void) {
47779 int test_ret = 0;
47780
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047781 if (quiet == 0) printf("Testing xpathInternals : 106 of 117 functions ...\n");
Daniel Veillarda82b1822004-11-08 16:24:57 +000047782 test_ret += test_valuePop();
47783 test_ret += test_valuePush();
47784 test_ret += test_xmlXPathAddValues();
47785 test_ret += test_xmlXPathBooleanFunction();
47786 test_ret += test_xmlXPathCeilingFunction();
47787 test_ret += test_xmlXPathCompareValues();
47788 test_ret += test_xmlXPathConcatFunction();
47789 test_ret += test_xmlXPathContainsFunction();
47790 test_ret += test_xmlXPathCountFunction();
47791 test_ret += test_xmlXPathDebugDumpCompExpr();
47792 test_ret += test_xmlXPathDebugDumpObject();
47793 test_ret += test_xmlXPathDifference();
47794 test_ret += test_xmlXPathDistinct();
47795 test_ret += test_xmlXPathDistinctSorted();
47796 test_ret += test_xmlXPathDivValues();
47797 test_ret += test_xmlXPathEqualValues();
47798 test_ret += test_xmlXPathErr();
47799 test_ret += test_xmlXPathEvalExpr();
47800 test_ret += test_xmlXPathEvaluatePredicateResult();
47801 test_ret += test_xmlXPathFalseFunction();
47802 test_ret += test_xmlXPathFloorFunction();
47803 test_ret += test_xmlXPathFunctionLookup();
47804 test_ret += test_xmlXPathFunctionLookupNS();
47805 test_ret += test_xmlXPathHasSameNodes();
47806 test_ret += test_xmlXPathIdFunction();
47807 test_ret += test_xmlXPathIntersection();
47808 test_ret += test_xmlXPathIsNodeType();
47809 test_ret += test_xmlXPathLangFunction();
47810 test_ret += test_xmlXPathLastFunction();
47811 test_ret += test_xmlXPathLeading();
47812 test_ret += test_xmlXPathLeadingSorted();
47813 test_ret += test_xmlXPathLocalNameFunction();
47814 test_ret += test_xmlXPathModValues();
47815 test_ret += test_xmlXPathMultValues();
47816 test_ret += test_xmlXPathNamespaceURIFunction();
47817 test_ret += test_xmlXPathNewBoolean();
47818 test_ret += test_xmlXPathNewCString();
47819 test_ret += test_xmlXPathNewFloat();
47820 test_ret += test_xmlXPathNewNodeSet();
47821 test_ret += test_xmlXPathNewNodeSetList();
47822 test_ret += test_xmlXPathNewParserContext();
47823 test_ret += test_xmlXPathNewString();
47824 test_ret += test_xmlXPathNextAncestor();
47825 test_ret += test_xmlXPathNextAncestorOrSelf();
47826 test_ret += test_xmlXPathNextAttribute();
47827 test_ret += test_xmlXPathNextChild();
47828 test_ret += test_xmlXPathNextDescendant();
47829 test_ret += test_xmlXPathNextDescendantOrSelf();
47830 test_ret += test_xmlXPathNextFollowing();
47831 test_ret += test_xmlXPathNextFollowingSibling();
47832 test_ret += test_xmlXPathNextNamespace();
47833 test_ret += test_xmlXPathNextParent();
47834 test_ret += test_xmlXPathNextPreceding();
47835 test_ret += test_xmlXPathNextPrecedingSibling();
47836 test_ret += test_xmlXPathNextSelf();
47837 test_ret += test_xmlXPathNodeLeading();
47838 test_ret += test_xmlXPathNodeLeadingSorted();
47839 test_ret += test_xmlXPathNodeSetAdd();
47840 test_ret += test_xmlXPathNodeSetAddNs();
47841 test_ret += test_xmlXPathNodeSetAddUnique();
47842 test_ret += test_xmlXPathNodeSetContains();
47843 test_ret += test_xmlXPathNodeSetDel();
47844 test_ret += test_xmlXPathNodeSetMerge();
47845 test_ret += test_xmlXPathNodeSetRemove();
47846 test_ret += test_xmlXPathNodeSetSort();
47847 test_ret += test_xmlXPathNodeTrailing();
47848 test_ret += test_xmlXPathNodeTrailingSorted();
47849 test_ret += test_xmlXPathNormalizeFunction();
47850 test_ret += test_xmlXPathNotEqualValues();
47851 test_ret += test_xmlXPathNotFunction();
47852 test_ret += test_xmlXPathNsLookup();
47853 test_ret += test_xmlXPathNumberFunction();
47854 test_ret += test_xmlXPathParseNCName();
47855 test_ret += test_xmlXPathParseName();
47856 test_ret += test_xmlXPathPopBoolean();
47857 test_ret += test_xmlXPathPopExternal();
47858 test_ret += test_xmlXPathPopNodeSet();
47859 test_ret += test_xmlXPathPopNumber();
47860 test_ret += test_xmlXPathPopString();
47861 test_ret += test_xmlXPathPositionFunction();
47862 test_ret += test_xmlXPathRegisterAllFunctions();
47863 test_ret += test_xmlXPathRegisterFunc();
47864 test_ret += test_xmlXPathRegisterFuncLookup();
47865 test_ret += test_xmlXPathRegisterFuncNS();
47866 test_ret += test_xmlXPathRegisterNs();
47867 test_ret += test_xmlXPathRegisterVariable();
47868 test_ret += test_xmlXPathRegisterVariableLookup();
47869 test_ret += test_xmlXPathRegisterVariableNS();
47870 test_ret += test_xmlXPathRegisteredFuncsCleanup();
47871 test_ret += test_xmlXPathRegisteredNsCleanup();
47872 test_ret += test_xmlXPathRegisteredVariablesCleanup();
47873 test_ret += test_xmlXPathRoot();
47874 test_ret += test_xmlXPathRoundFunction();
47875 test_ret += test_xmlXPathStartsWithFunction();
47876 test_ret += test_xmlXPathStringEvalNumber();
47877 test_ret += test_xmlXPathStringFunction();
47878 test_ret += test_xmlXPathStringLengthFunction();
47879 test_ret += test_xmlXPathSubValues();
47880 test_ret += test_xmlXPathSubstringAfterFunction();
47881 test_ret += test_xmlXPathSubstringBeforeFunction();
47882 test_ret += test_xmlXPathSubstringFunction();
47883 test_ret += test_xmlXPathSumFunction();
47884 test_ret += test_xmlXPathTrailing();
47885 test_ret += test_xmlXPathTrailingSorted();
47886 test_ret += test_xmlXPathTranslateFunction();
47887 test_ret += test_xmlXPathTrueFunction();
47888 test_ret += test_xmlXPathValueFlipSign();
47889 test_ret += test_xmlXPathVariableLookup();
47890 test_ret += test_xmlXPathVariableLookupNS();
47891 test_ret += test_xmlXPathWrapCString();
47892 test_ret += test_xmlXPathWrapExternal();
47893 test_ret += test_xmlXPathWrapNodeSet();
47894 test_ret += test_xmlXPatherror();
47895
47896 if (test_ret != 0)
47897 printf("Module xpathInternals: %d errors\n", test_ret);
47898 return(test_ret);
47899}
47900
Daniel Veillardd93f6252004-11-02 15:53:51 +000047901static int
47902test_xmlXPtrBuildNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047903 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047904
William M. Brack21e4ef22005-01-02 09:53:13 +000047905#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000047906 int mem_base;
47907 xmlNodePtr ret_val;
47908 xmlXPathObjectPtr obj; /* the XPointer result from the evaluation. */
47909 int n_obj;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047910
Daniel Veillardd005b9e2004-11-03 17:07:05 +000047911 for (n_obj = 0;n_obj < gen_nb_xmlXPathObjectPtr;n_obj++) {
47912 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000047913 obj = gen_xmlXPathObjectPtr(n_obj, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000047914
47915 ret_val = xmlXPtrBuildNodeList(obj);
47916 desret_xmlNodePtr(ret_val);
47917 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000047918 des_xmlXPathObjectPtr(n_obj, obj, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000047919 xmlResetLastError();
47920 if (mem_base != xmlMemBlocks()) {
47921 printf("Leak of %d blocks found in xmlXPtrBuildNodeList",
47922 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000047923 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000047924 printf(" %d", n_obj);
47925 printf("\n");
47926 }
47927 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047928 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000047929#endif
47930
Daniel Veillard42595322004-11-08 10:52:06 +000047931 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047932}
47933
47934
47935static int
47936test_xmlXPtrEval(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047937 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047938
William M. Brack21e4ef22005-01-02 09:53:13 +000047939#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000047940 int mem_base;
47941 xmlXPathObjectPtr ret_val;
47942 xmlChar * str; /* the XPointer expression */
47943 int n_str;
47944 xmlXPathContextPtr ctx; /* the XPointer context */
47945 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047946
Daniel Veillardce682bc2004-11-05 17:22:25 +000047947 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
47948 for (n_ctx = 0;n_ctx < gen_nb_xmlXPathContextPtr;n_ctx++) {
47949 mem_base = xmlMemBlocks();
47950 str = gen_const_xmlChar_ptr(n_str, 0);
47951 ctx = gen_xmlXPathContextPtr(n_ctx, 1);
47952
William M. Brackf13f77f2004-11-12 16:03:48 +000047953 ret_val = xmlXPtrEval((const xmlChar *)str, ctx);
Daniel Veillardce682bc2004-11-05 17:22:25 +000047954 desret_xmlXPathObjectPtr(ret_val);
47955 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000047956 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000047957 des_xmlXPathContextPtr(n_ctx, ctx, 1);
47958 xmlResetLastError();
47959 if (mem_base != xmlMemBlocks()) {
47960 printf("Leak of %d blocks found in xmlXPtrEval",
47961 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000047962 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000047963 printf(" %d", n_str);
47964 printf(" %d", n_ctx);
47965 printf("\n");
47966 }
47967 }
47968 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047969 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000047970#endif
47971
Daniel Veillard42595322004-11-08 10:52:06 +000047972 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047973}
47974
47975
47976static int
47977test_xmlXPtrEvalRangePredicate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047978 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047979
William M. Brack21e4ef22005-01-02 09:53:13 +000047980#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000047981 int mem_base;
47982 xmlXPathParserContextPtr ctxt; /* the XPointer Parser context */
47983 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047984
Daniel Veillardce682bc2004-11-05 17:22:25 +000047985 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47986 mem_base = xmlMemBlocks();
47987 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47988
47989 xmlXPtrEvalRangePredicate(ctxt);
47990 call_tests++;
47991 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47992 xmlResetLastError();
47993 if (mem_base != xmlMemBlocks()) {
47994 printf("Leak of %d blocks found in xmlXPtrEvalRangePredicate",
47995 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000047996 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000047997 printf(" %d", n_ctxt);
47998 printf("\n");
47999 }
48000 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048001 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048002#endif
48003
Daniel Veillard42595322004-11-08 10:52:06 +000048004 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048005}
48006
Daniel Veillarda521d282004-11-09 14:59:59 +000048007#ifdef LIBXML_XPTR_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000048008
Daniel Veillardce682bc2004-11-05 17:22:25 +000048009#define gen_nb_xmlLocationSetPtr 1
48010static xmlLocationSetPtr gen_xmlLocationSetPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
48011 return(NULL);
48012}
48013static void des_xmlLocationSetPtr(int no ATTRIBUTE_UNUSED, xmlLocationSetPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
48014}
Daniel Veillarda521d282004-11-09 14:59:59 +000048015#endif
48016
Daniel Veillardce682bc2004-11-05 17:22:25 +000048017
Daniel Veillardd93f6252004-11-02 15:53:51 +000048018static int
48019test_xmlXPtrLocationSetAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048020 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048021
William M. Brack21e4ef22005-01-02 09:53:13 +000048022#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000048023 int mem_base;
48024 xmlLocationSetPtr cur; /* the initial range set */
48025 int n_cur;
48026 xmlXPathObjectPtr val; /* a new xmlXPathObjectPtr */
48027 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048028
Daniel Veillardce682bc2004-11-05 17:22:25 +000048029 for (n_cur = 0;n_cur < gen_nb_xmlLocationSetPtr;n_cur++) {
48030 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
48031 mem_base = xmlMemBlocks();
48032 cur = gen_xmlLocationSetPtr(n_cur, 0);
48033 val = gen_xmlXPathObjectPtr(n_val, 1);
48034
48035 xmlXPtrLocationSetAdd(cur, val);
48036 call_tests++;
48037 des_xmlLocationSetPtr(n_cur, cur, 0);
48038 des_xmlXPathObjectPtr(n_val, val, 1);
48039 xmlResetLastError();
48040 if (mem_base != xmlMemBlocks()) {
48041 printf("Leak of %d blocks found in xmlXPtrLocationSetAdd",
48042 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048043 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048044 printf(" %d", n_cur);
48045 printf(" %d", n_val);
48046 printf("\n");
48047 }
48048 }
48049 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048050 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048051#endif
48052
Daniel Veillard42595322004-11-08 10:52:06 +000048053 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048054}
48055
48056
48057static int
48058test_xmlXPtrLocationSetCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048059 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048060
48061
48062 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000048063 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048064}
48065
48066
48067static int
48068test_xmlXPtrLocationSetDel(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048069 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048070
William M. Brack21e4ef22005-01-02 09:53:13 +000048071#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000048072 int mem_base;
48073 xmlLocationSetPtr cur; /* the initial range set */
48074 int n_cur;
48075 xmlXPathObjectPtr val; /* an xmlXPathObjectPtr */
48076 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048077
Daniel Veillardce682bc2004-11-05 17:22:25 +000048078 for (n_cur = 0;n_cur < gen_nb_xmlLocationSetPtr;n_cur++) {
48079 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
48080 mem_base = xmlMemBlocks();
48081 cur = gen_xmlLocationSetPtr(n_cur, 0);
48082 val = gen_xmlXPathObjectPtr(n_val, 1);
48083
48084 xmlXPtrLocationSetDel(cur, val);
48085 call_tests++;
48086 des_xmlLocationSetPtr(n_cur, cur, 0);
48087 des_xmlXPathObjectPtr(n_val, val, 1);
48088 xmlResetLastError();
48089 if (mem_base != xmlMemBlocks()) {
48090 printf("Leak of %d blocks found in xmlXPtrLocationSetDel",
48091 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048092 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048093 printf(" %d", n_cur);
48094 printf(" %d", n_val);
48095 printf("\n");
48096 }
48097 }
48098 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048099 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048100#endif
48101
Daniel Veillard42595322004-11-08 10:52:06 +000048102 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048103}
48104
48105
48106static int
48107test_xmlXPtrLocationSetMerge(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048108 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048109
48110
48111 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000048112 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048113}
48114
48115
48116static int
48117test_xmlXPtrLocationSetRemove(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048118 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048119
William M. Brack21e4ef22005-01-02 09:53:13 +000048120#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000048121 int mem_base;
48122 xmlLocationSetPtr cur; /* the initial range set */
48123 int n_cur;
48124 int val; /* the index to remove */
48125 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048126
Daniel Veillardce682bc2004-11-05 17:22:25 +000048127 for (n_cur = 0;n_cur < gen_nb_xmlLocationSetPtr;n_cur++) {
48128 for (n_val = 0;n_val < gen_nb_int;n_val++) {
48129 mem_base = xmlMemBlocks();
48130 cur = gen_xmlLocationSetPtr(n_cur, 0);
48131 val = gen_int(n_val, 1);
48132
48133 xmlXPtrLocationSetRemove(cur, val);
48134 call_tests++;
48135 des_xmlLocationSetPtr(n_cur, cur, 0);
48136 des_int(n_val, val, 1);
48137 xmlResetLastError();
48138 if (mem_base != xmlMemBlocks()) {
48139 printf("Leak of %d blocks found in xmlXPtrLocationSetRemove",
48140 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048141 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048142 printf(" %d", n_cur);
48143 printf(" %d", n_val);
48144 printf("\n");
48145 }
48146 }
48147 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048148 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048149#endif
48150
Daniel Veillard42595322004-11-08 10:52:06 +000048151 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048152}
48153
48154
48155static int
48156test_xmlXPtrNewCollapsedRange(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048157 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048158
William M. Brack21e4ef22005-01-02 09:53:13 +000048159#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000048160 int mem_base;
48161 xmlXPathObjectPtr ret_val;
48162 xmlNodePtr start; /* the starting and ending node */
48163 int n_start;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048164
Daniel Veillard3d97e662004-11-04 10:49:00 +000048165 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48166 mem_base = xmlMemBlocks();
48167 start = gen_xmlNodePtr(n_start, 0);
48168
48169 ret_val = xmlXPtrNewCollapsedRange(start);
48170 desret_xmlXPathObjectPtr(ret_val);
48171 call_tests++;
48172 des_xmlNodePtr(n_start, start, 0);
48173 xmlResetLastError();
48174 if (mem_base != xmlMemBlocks()) {
48175 printf("Leak of %d blocks found in xmlXPtrNewCollapsedRange",
48176 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048177 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048178 printf(" %d", n_start);
48179 printf("\n");
48180 }
48181 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048182 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048183#endif
48184
Daniel Veillard42595322004-11-08 10:52:06 +000048185 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048186}
48187
48188
48189static int
48190test_xmlXPtrNewContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048191 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048192
48193
48194 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000048195 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048196}
48197
48198
48199static int
48200test_xmlXPtrNewLocationSetNodeSet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048201 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048202
William M. Brack21e4ef22005-01-02 09:53:13 +000048203#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000048204 int mem_base;
48205 xmlXPathObjectPtr ret_val;
48206 xmlNodeSetPtr set; /* a node set */
48207 int n_set;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048208
Daniel Veillardce682bc2004-11-05 17:22:25 +000048209 for (n_set = 0;n_set < gen_nb_xmlNodeSetPtr;n_set++) {
48210 mem_base = xmlMemBlocks();
48211 set = gen_xmlNodeSetPtr(n_set, 0);
48212
48213 ret_val = xmlXPtrNewLocationSetNodeSet(set);
48214 desret_xmlXPathObjectPtr(ret_val);
48215 call_tests++;
48216 des_xmlNodeSetPtr(n_set, set, 0);
48217 xmlResetLastError();
48218 if (mem_base != xmlMemBlocks()) {
48219 printf("Leak of %d blocks found in xmlXPtrNewLocationSetNodeSet",
48220 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048221 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048222 printf(" %d", n_set);
48223 printf("\n");
48224 }
48225 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048226 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048227#endif
48228
Daniel Veillard42595322004-11-08 10:52:06 +000048229 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048230}
48231
48232
48233static int
48234test_xmlXPtrNewLocationSetNodes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048235 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048236
William M. Brack21e4ef22005-01-02 09:53:13 +000048237#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000048238 int mem_base;
48239 xmlXPathObjectPtr ret_val;
48240 xmlNodePtr start; /* the start NodePtr value */
48241 int n_start;
48242 xmlNodePtr end; /* the end NodePtr value or NULL */
48243 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048244
Daniel Veillard3d97e662004-11-04 10:49:00 +000048245 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48246 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
48247 mem_base = xmlMemBlocks();
48248 start = gen_xmlNodePtr(n_start, 0);
48249 end = gen_xmlNodePtr(n_end, 1);
48250
48251 ret_val = xmlXPtrNewLocationSetNodes(start, end);
48252 desret_xmlXPathObjectPtr(ret_val);
48253 call_tests++;
48254 des_xmlNodePtr(n_start, start, 0);
48255 des_xmlNodePtr(n_end, end, 1);
48256 xmlResetLastError();
48257 if (mem_base != xmlMemBlocks()) {
48258 printf("Leak of %d blocks found in xmlXPtrNewLocationSetNodes",
48259 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048260 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048261 printf(" %d", n_start);
48262 printf(" %d", n_end);
48263 printf("\n");
48264 }
48265 }
48266 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048267 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048268#endif
48269
Daniel Veillard42595322004-11-08 10:52:06 +000048270 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048271}
48272
48273
48274static int
48275test_xmlXPtrNewRange(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048276 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048277
William M. Brack21e4ef22005-01-02 09:53:13 +000048278#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000048279 int mem_base;
48280 xmlXPathObjectPtr ret_val;
48281 xmlNodePtr start; /* the starting node */
48282 int n_start;
48283 int startindex; /* the start index */
48284 int n_startindex;
48285 xmlNodePtr end; /* the ending point */
48286 int n_end;
48287 int endindex; /* the ending index */
48288 int n_endindex;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048289
Daniel Veillard3d97e662004-11-04 10:49:00 +000048290 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48291 for (n_startindex = 0;n_startindex < gen_nb_int;n_startindex++) {
48292 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
48293 for (n_endindex = 0;n_endindex < gen_nb_int;n_endindex++) {
48294 mem_base = xmlMemBlocks();
48295 start = gen_xmlNodePtr(n_start, 0);
48296 startindex = gen_int(n_startindex, 1);
48297 end = gen_xmlNodePtr(n_end, 2);
48298 endindex = gen_int(n_endindex, 3);
48299
48300 ret_val = xmlXPtrNewRange(start, startindex, end, endindex);
48301 desret_xmlXPathObjectPtr(ret_val);
48302 call_tests++;
48303 des_xmlNodePtr(n_start, start, 0);
48304 des_int(n_startindex, startindex, 1);
48305 des_xmlNodePtr(n_end, end, 2);
48306 des_int(n_endindex, endindex, 3);
48307 xmlResetLastError();
48308 if (mem_base != xmlMemBlocks()) {
48309 printf("Leak of %d blocks found in xmlXPtrNewRange",
48310 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048311 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048312 printf(" %d", n_start);
48313 printf(" %d", n_startindex);
48314 printf(" %d", n_end);
48315 printf(" %d", n_endindex);
48316 printf("\n");
48317 }
48318 }
48319 }
48320 }
48321 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048322 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048323#endif
48324
Daniel Veillard42595322004-11-08 10:52:06 +000048325 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048326}
48327
48328
48329static int
48330test_xmlXPtrNewRangeNodeObject(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048331 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048332
William M. Brack21e4ef22005-01-02 09:53:13 +000048333#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000048334 int mem_base;
48335 xmlXPathObjectPtr ret_val;
48336 xmlNodePtr start; /* the starting node */
48337 int n_start;
48338 xmlXPathObjectPtr end; /* the ending object */
48339 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048340
Daniel Veillard3d97e662004-11-04 10:49:00 +000048341 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48342 for (n_end = 0;n_end < gen_nb_xmlXPathObjectPtr;n_end++) {
48343 mem_base = xmlMemBlocks();
48344 start = gen_xmlNodePtr(n_start, 0);
48345 end = gen_xmlXPathObjectPtr(n_end, 1);
48346
48347 ret_val = xmlXPtrNewRangeNodeObject(start, end);
48348 desret_xmlXPathObjectPtr(ret_val);
48349 call_tests++;
48350 des_xmlNodePtr(n_start, start, 0);
48351 des_xmlXPathObjectPtr(n_end, end, 1);
48352 xmlResetLastError();
48353 if (mem_base != xmlMemBlocks()) {
48354 printf("Leak of %d blocks found in xmlXPtrNewRangeNodeObject",
48355 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048356 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048357 printf(" %d", n_start);
48358 printf(" %d", n_end);
48359 printf("\n");
48360 }
48361 }
48362 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048363 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048364#endif
48365
Daniel Veillard42595322004-11-08 10:52:06 +000048366 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048367}
48368
48369
48370static int
48371test_xmlXPtrNewRangeNodePoint(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048372 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048373
William M. Brack21e4ef22005-01-02 09:53:13 +000048374#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000048375 int mem_base;
48376 xmlXPathObjectPtr ret_val;
48377 xmlNodePtr start; /* the starting node */
48378 int n_start;
48379 xmlXPathObjectPtr end; /* the ending point */
48380 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048381
Daniel Veillard3d97e662004-11-04 10:49:00 +000048382 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48383 for (n_end = 0;n_end < gen_nb_xmlXPathObjectPtr;n_end++) {
48384 mem_base = xmlMemBlocks();
48385 start = gen_xmlNodePtr(n_start, 0);
48386 end = gen_xmlXPathObjectPtr(n_end, 1);
48387
48388 ret_val = xmlXPtrNewRangeNodePoint(start, end);
48389 desret_xmlXPathObjectPtr(ret_val);
48390 call_tests++;
48391 des_xmlNodePtr(n_start, start, 0);
48392 des_xmlXPathObjectPtr(n_end, end, 1);
48393 xmlResetLastError();
48394 if (mem_base != xmlMemBlocks()) {
48395 printf("Leak of %d blocks found in xmlXPtrNewRangeNodePoint",
48396 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048397 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048398 printf(" %d", n_start);
48399 printf(" %d", n_end);
48400 printf("\n");
48401 }
48402 }
48403 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048404 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048405#endif
48406
Daniel Veillard42595322004-11-08 10:52:06 +000048407 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048408}
48409
48410
48411static int
48412test_xmlXPtrNewRangeNodes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048413 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048414
William M. Brack21e4ef22005-01-02 09:53:13 +000048415#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000048416 int mem_base;
48417 xmlXPathObjectPtr ret_val;
48418 xmlNodePtr start; /* the starting node */
48419 int n_start;
48420 xmlNodePtr end; /* the ending node */
48421 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048422
Daniel Veillard3d97e662004-11-04 10:49:00 +000048423 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48424 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
48425 mem_base = xmlMemBlocks();
48426 start = gen_xmlNodePtr(n_start, 0);
48427 end = gen_xmlNodePtr(n_end, 1);
48428
48429 ret_val = xmlXPtrNewRangeNodes(start, end);
48430 desret_xmlXPathObjectPtr(ret_val);
48431 call_tests++;
48432 des_xmlNodePtr(n_start, start, 0);
48433 des_xmlNodePtr(n_end, end, 1);
48434 xmlResetLastError();
48435 if (mem_base != xmlMemBlocks()) {
48436 printf("Leak of %d blocks found in xmlXPtrNewRangeNodes",
48437 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048438 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048439 printf(" %d", n_start);
48440 printf(" %d", n_end);
48441 printf("\n");
48442 }
48443 }
48444 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048445 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048446#endif
48447
Daniel Veillard42595322004-11-08 10:52:06 +000048448 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048449}
48450
48451
48452static int
48453test_xmlXPtrNewRangePointNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048454 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048455
William M. Brack21e4ef22005-01-02 09:53:13 +000048456#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000048457 int mem_base;
48458 xmlXPathObjectPtr ret_val;
48459 xmlXPathObjectPtr start; /* the starting point */
48460 int n_start;
48461 xmlNodePtr end; /* the ending node */
48462 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048463
Daniel Veillard3d97e662004-11-04 10:49:00 +000048464 for (n_start = 0;n_start < gen_nb_xmlXPathObjectPtr;n_start++) {
48465 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
48466 mem_base = xmlMemBlocks();
48467 start = gen_xmlXPathObjectPtr(n_start, 0);
48468 end = gen_xmlNodePtr(n_end, 1);
48469
48470 ret_val = xmlXPtrNewRangePointNode(start, end);
48471 desret_xmlXPathObjectPtr(ret_val);
48472 call_tests++;
48473 des_xmlXPathObjectPtr(n_start, start, 0);
48474 des_xmlNodePtr(n_end, end, 1);
48475 xmlResetLastError();
48476 if (mem_base != xmlMemBlocks()) {
48477 printf("Leak of %d blocks found in xmlXPtrNewRangePointNode",
48478 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048479 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048480 printf(" %d", n_start);
48481 printf(" %d", n_end);
48482 printf("\n");
48483 }
48484 }
48485 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048486 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048487#endif
48488
Daniel Veillard42595322004-11-08 10:52:06 +000048489 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048490}
48491
48492
48493static int
48494test_xmlXPtrNewRangePoints(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048495 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048496
William M. Brack21e4ef22005-01-02 09:53:13 +000048497#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000048498 int mem_base;
48499 xmlXPathObjectPtr ret_val;
48500 xmlXPathObjectPtr start; /* the starting point */
48501 int n_start;
48502 xmlXPathObjectPtr end; /* the ending point */
48503 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048504
Daniel Veillard3d97e662004-11-04 10:49:00 +000048505 for (n_start = 0;n_start < gen_nb_xmlXPathObjectPtr;n_start++) {
48506 for (n_end = 0;n_end < gen_nb_xmlXPathObjectPtr;n_end++) {
48507 mem_base = xmlMemBlocks();
48508 start = gen_xmlXPathObjectPtr(n_start, 0);
48509 end = gen_xmlXPathObjectPtr(n_end, 1);
48510
48511 ret_val = xmlXPtrNewRangePoints(start, end);
48512 desret_xmlXPathObjectPtr(ret_val);
48513 call_tests++;
48514 des_xmlXPathObjectPtr(n_start, start, 0);
48515 des_xmlXPathObjectPtr(n_end, end, 1);
48516 xmlResetLastError();
48517 if (mem_base != xmlMemBlocks()) {
48518 printf("Leak of %d blocks found in xmlXPtrNewRangePoints",
48519 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048520 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048521 printf(" %d", n_start);
48522 printf(" %d", n_end);
48523 printf("\n");
48524 }
48525 }
48526 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048527 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048528#endif
48529
Daniel Veillard42595322004-11-08 10:52:06 +000048530 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048531}
48532
48533
48534static int
48535test_xmlXPtrRangeToFunction(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048536 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048537
William M. Brack21e4ef22005-01-02 09:53:13 +000048538#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000048539 int mem_base;
48540 xmlXPathParserContextPtr ctxt; /* the XPointer Parser context */
48541 int n_ctxt;
48542 int nargs; /* the number of args */
48543 int n_nargs;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048544
Daniel Veillardce682bc2004-11-05 17:22:25 +000048545 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
48546 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
48547 mem_base = xmlMemBlocks();
48548 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
48549 nargs = gen_int(n_nargs, 1);
48550
48551 xmlXPtrRangeToFunction(ctxt, nargs);
48552 call_tests++;
48553 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
48554 des_int(n_nargs, nargs, 1);
48555 xmlResetLastError();
48556 if (mem_base != xmlMemBlocks()) {
48557 printf("Leak of %d blocks found in xmlXPtrRangeToFunction",
48558 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048559 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048560 printf(" %d", n_ctxt);
48561 printf(" %d", n_nargs);
48562 printf("\n");
48563 }
48564 }
48565 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048566 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048567#endif
48568
Daniel Veillard42595322004-11-08 10:52:06 +000048569 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048570}
48571
48572
48573static int
48574test_xmlXPtrWrapLocationSet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048575 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048576
William M. Brack21e4ef22005-01-02 09:53:13 +000048577#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000048578 int mem_base;
48579 xmlXPathObjectPtr ret_val;
48580 xmlLocationSetPtr val; /* the LocationSet value */
48581 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048582
Daniel Veillardce682bc2004-11-05 17:22:25 +000048583 for (n_val = 0;n_val < gen_nb_xmlLocationSetPtr;n_val++) {
48584 mem_base = xmlMemBlocks();
48585 val = gen_xmlLocationSetPtr(n_val, 0);
48586
48587 ret_val = xmlXPtrWrapLocationSet(val);
48588 desret_xmlXPathObjectPtr(ret_val);
48589 call_tests++;
48590 des_xmlLocationSetPtr(n_val, val, 0);
48591 xmlResetLastError();
48592 if (mem_base != xmlMemBlocks()) {
48593 printf("Leak of %d blocks found in xmlXPtrWrapLocationSet",
48594 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048595 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048596 printf(" %d", n_val);
48597 printf("\n");
48598 }
48599 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048600 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048601#endif
48602
Daniel Veillard42595322004-11-08 10:52:06 +000048603 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048604}
48605
48606static int
48607test_xpointer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048608 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048609
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048610 if (quiet == 0) printf("Testing xpointer : 17 of 21 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000048611 test_ret += test_xmlXPtrBuildNodeList();
48612 test_ret += test_xmlXPtrEval();
48613 test_ret += test_xmlXPtrEvalRangePredicate();
48614 test_ret += test_xmlXPtrLocationSetAdd();
48615 test_ret += test_xmlXPtrLocationSetCreate();
48616 test_ret += test_xmlXPtrLocationSetDel();
48617 test_ret += test_xmlXPtrLocationSetMerge();
48618 test_ret += test_xmlXPtrLocationSetRemove();
48619 test_ret += test_xmlXPtrNewCollapsedRange();
48620 test_ret += test_xmlXPtrNewContext();
48621 test_ret += test_xmlXPtrNewLocationSetNodeSet();
48622 test_ret += test_xmlXPtrNewLocationSetNodes();
48623 test_ret += test_xmlXPtrNewRange();
48624 test_ret += test_xmlXPtrNewRangeNodeObject();
48625 test_ret += test_xmlXPtrNewRangeNodePoint();
48626 test_ret += test_xmlXPtrNewRangeNodes();
48627 test_ret += test_xmlXPtrNewRangePointNode();
48628 test_ret += test_xmlXPtrNewRangePoints();
48629 test_ret += test_xmlXPtrRangeToFunction();
48630 test_ret += test_xmlXPtrWrapLocationSet();
Daniel Veillardd93f6252004-11-02 15:53:51 +000048631
Daniel Veillard42595322004-11-08 10:52:06 +000048632 if (test_ret != 0)
48633 printf("Module xpointer: %d errors\n", test_ret);
48634 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048635}
Daniel Veillardce244ad2004-11-05 10:03:46 +000048636static int
48637test_module(const char *module) {
48638 if (!strcmp(module, "HTMLparser")) return(test_HTMLparser());
48639 if (!strcmp(module, "HTMLtree")) return(test_HTMLtree());
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000048640 if (!strcmp(module, "SAX2")) return(test_SAX2());
Daniel Veillarda82b1822004-11-08 16:24:57 +000048641 if (!strcmp(module, "c14n")) return(test_c14n());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048642 if (!strcmp(module, "catalog")) return(test_catalog());
48643 if (!strcmp(module, "chvalid")) return(test_chvalid());
Daniel Veillarda82b1822004-11-08 16:24:57 +000048644 if (!strcmp(module, "debugXML")) return(test_debugXML());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048645 if (!strcmp(module, "dict")) return(test_dict());
48646 if (!strcmp(module, "encoding")) return(test_encoding());
48647 if (!strcmp(module, "entities")) return(test_entities());
48648 if (!strcmp(module, "hash")) return(test_hash());
48649 if (!strcmp(module, "list")) return(test_list());
48650 if (!strcmp(module, "nanoftp")) return(test_nanoftp());
48651 if (!strcmp(module, "nanohttp")) return(test_nanohttp());
48652 if (!strcmp(module, "parser")) return(test_parser());
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000048653 if (!strcmp(module, "parserInternals")) return(test_parserInternals());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048654 if (!strcmp(module, "pattern")) return(test_pattern());
48655 if (!strcmp(module, "relaxng")) return(test_relaxng());
48656 if (!strcmp(module, "schemasInternals")) return(test_schemasInternals());
48657 if (!strcmp(module, "tree")) return(test_tree());
48658 if (!strcmp(module, "uri")) return(test_uri());
48659 if (!strcmp(module, "valid")) return(test_valid());
48660 if (!strcmp(module, "xinclude")) return(test_xinclude());
48661 if (!strcmp(module, "xmlIO")) return(test_xmlIO());
Daniel Veillarda82b1822004-11-08 16:24:57 +000048662 if (!strcmp(module, "xmlautomata")) return(test_xmlautomata());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048663 if (!strcmp(module, "xmlerror")) return(test_xmlerror());
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000048664 if (!strcmp(module, "xmlmodule")) return(test_xmlmodule());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048665 if (!strcmp(module, "xmlreader")) return(test_xmlreader());
Daniel Veillarda82b1822004-11-08 16:24:57 +000048666 if (!strcmp(module, "xmlregexp")) return(test_xmlregexp());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048667 if (!strcmp(module, "xmlsave")) return(test_xmlsave());
48668 if (!strcmp(module, "xmlschemas")) return(test_xmlschemas());
48669 if (!strcmp(module, "xmlschemastypes")) return(test_xmlschemastypes());
48670 if (!strcmp(module, "xmlstring")) return(test_xmlstring());
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000048671 if (!strcmp(module, "xmlunicode")) return(test_xmlunicode());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048672 if (!strcmp(module, "xmlwriter")) return(test_xmlwriter());
48673 if (!strcmp(module, "xpath")) return(test_xpath());
Daniel Veillarda82b1822004-11-08 16:24:57 +000048674 if (!strcmp(module, "xpathInternals")) return(test_xpathInternals());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048675 if (!strcmp(module, "xpointer")) return(test_xpointer());
48676 return(0);
48677}