blob: 11b7071cbf56b598d6f4be4b50891a6ab51248b8 [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 Veillardfc0b6f62005-01-09 17:48:02 +000028220#ifdef LIBXML_MODULES_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000028221
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028222#define gen_nb_xmlModulePtr 1
28223static xmlModulePtr gen_xmlModulePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
28224 return(NULL);
28225}
28226static void des_xmlModulePtr(int no ATTRIBUTE_UNUSED, xmlModulePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
28227}
Daniel Veillardfc0b6f62005-01-09 17:48:02 +000028228#endif
28229
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028230
28231static int
28232test_xmlModuleClose(void) {
28233 int test_ret = 0;
28234
28235#if defined(LIBXML_MODULES_ENABLED)
28236 int mem_base;
28237 int ret_val;
28238 xmlModulePtr module; /* the module handle */
28239 int n_module;
28240
28241 for (n_module = 0;n_module < gen_nb_xmlModulePtr;n_module++) {
28242 mem_base = xmlMemBlocks();
28243 module = gen_xmlModulePtr(n_module, 0);
28244
28245 ret_val = xmlModuleClose(module);
28246 desret_int(ret_val);
28247 call_tests++;
28248 des_xmlModulePtr(n_module, module, 0);
28249 xmlResetLastError();
28250 if (mem_base != xmlMemBlocks()) {
28251 printf("Leak of %d blocks found in xmlModuleClose",
28252 xmlMemBlocks() - mem_base);
28253 test_ret++;
28254 printf(" %d", n_module);
28255 printf("\n");
28256 }
28257 }
28258 function_tests++;
28259#endif
28260
28261 return(test_ret);
28262}
28263
28264
28265static int
28266test_xmlModuleOpen(void) {
28267 int test_ret = 0;
28268
28269
28270 /* missing type support */
28271 return(test_ret);
28272}
28273
28274
28275static int
28276test_xmlModuleSymbol(void) {
28277 int test_ret = 0;
28278
28279#if defined(LIBXML_MODULES_ENABLED)
28280 int mem_base;
Daniel Veillardbe076e92005-01-04 20:18:14 +000028281 int ret_val;
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028282 xmlModulePtr module; /* the module */
28283 int n_module;
28284 char * name; /* the name of the symbol */
28285 int n_name;
Daniel Veillardbe076e92005-01-04 20:18:14 +000028286 void ** symbol; /* the resulting symbol address */
28287 int n_symbol;
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028288
28289 for (n_module = 0;n_module < gen_nb_xmlModulePtr;n_module++) {
28290 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
Daniel Veillardbe076e92005-01-04 20:18:14 +000028291 for (n_symbol = 0;n_symbol < gen_nb_void_ptr_ptr;n_symbol++) {
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028292 mem_base = xmlMemBlocks();
28293 module = gen_xmlModulePtr(n_module, 0);
28294 name = gen_const_char_ptr(n_name, 1);
Daniel Veillardbe076e92005-01-04 20:18:14 +000028295 symbol = gen_void_ptr_ptr(n_symbol, 2);
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028296
Daniel Veillardbe076e92005-01-04 20:18:14 +000028297 ret_val = xmlModuleSymbol(module, (const char *)name, symbol);
28298 desret_int(ret_val);
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028299 call_tests++;
28300 des_xmlModulePtr(n_module, module, 0);
28301 des_const_char_ptr(n_name, (const char *)name, 1);
Daniel Veillardbe076e92005-01-04 20:18:14 +000028302 des_void_ptr_ptr(n_symbol, symbol, 2);
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028303 xmlResetLastError();
28304 if (mem_base != xmlMemBlocks()) {
28305 printf("Leak of %d blocks found in xmlModuleSymbol",
28306 xmlMemBlocks() - mem_base);
28307 test_ret++;
28308 printf(" %d", n_module);
28309 printf(" %d", n_name);
Daniel Veillardbe076e92005-01-04 20:18:14 +000028310 printf(" %d", n_symbol);
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028311 printf("\n");
28312 }
28313 }
28314 }
Daniel Veillardbe076e92005-01-04 20:18:14 +000028315 }
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000028316 function_tests++;
28317#endif
28318
28319 return(test_ret);
28320}
28321
28322static int
28323test_xmlmodule(void) {
28324 int test_ret = 0;
28325
28326 if (quiet == 0) printf("Testing xmlmodule : 2 of 4 functions ...\n");
28327 test_ret += test_xmlModuleClose();
28328 test_ret += test_xmlModuleOpen();
28329 test_ret += test_xmlModuleSymbol();
28330
28331 if (test_ret != 0)
28332 printf("Module xmlmodule: %d errors\n", test_ret);
28333 return(test_ret);
28334}
28335
Daniel Veillardd93f6252004-11-02 15:53:51 +000028336static int
28337test_xmlNewTextReader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028338 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028339
William M. Brack21e4ef22005-01-02 09:53:13 +000028340#if defined(LIBXML_READER_ENABLED)
Daniel Veillard34099b42004-11-04 17:34:35 +000028341 int mem_base;
28342 xmlTextReaderPtr ret_val;
28343 xmlParserInputBufferPtr input; /* the xmlParserInputBufferPtr used to read data */
28344 int n_input;
28345 const char * URI; /* the URI information for the source if available */
28346 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028347
Daniel Veillard34099b42004-11-04 17:34:35 +000028348 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
28349 for (n_URI = 0;n_URI < gen_nb_filepath;n_URI++) {
28350 mem_base = xmlMemBlocks();
28351 input = gen_xmlParserInputBufferPtr(n_input, 0);
28352 URI = gen_filepath(n_URI, 1);
28353
28354 ret_val = xmlNewTextReader(input, URI);
28355 desret_xmlTextReaderPtr(ret_val);
28356 call_tests++;
28357 des_xmlParserInputBufferPtr(n_input, input, 0);
28358 des_filepath(n_URI, URI, 1);
28359 xmlResetLastError();
28360 if (mem_base != xmlMemBlocks()) {
28361 printf("Leak of %d blocks found in xmlNewTextReader",
28362 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028363 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000028364 printf(" %d", n_input);
28365 printf(" %d", n_URI);
28366 printf("\n");
28367 }
28368 }
28369 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028370 function_tests++;
Daniel Veillard34099b42004-11-04 17:34:35 +000028371#endif
28372
Daniel Veillard42595322004-11-08 10:52:06 +000028373 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028374}
28375
28376
28377static int
28378test_xmlNewTextReaderFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028379 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028380
William M. Brack21e4ef22005-01-02 09:53:13 +000028381#if defined(LIBXML_READER_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028382 int mem_base;
28383 xmlTextReaderPtr ret_val;
28384 const char * URI; /* the URI of the resource to process */
28385 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028386
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028387 for (n_URI = 0;n_URI < gen_nb_filepath;n_URI++) {
28388 mem_base = xmlMemBlocks();
28389 URI = gen_filepath(n_URI, 0);
28390
28391 ret_val = xmlNewTextReaderFilename(URI);
28392 desret_xmlTextReaderPtr(ret_val);
28393 call_tests++;
28394 des_filepath(n_URI, URI, 0);
28395 xmlResetLastError();
28396 if (mem_base != xmlMemBlocks()) {
28397 printf("Leak of %d blocks found in xmlNewTextReaderFilename",
28398 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028399 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028400 printf(" %d", n_URI);
28401 printf("\n");
28402 }
28403 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028404 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028405#endif
28406
Daniel Veillard42595322004-11-08 10:52:06 +000028407 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028408}
28409
28410
28411static int
28412test_xmlReaderForDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028413 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028414
William M. Brack21e4ef22005-01-02 09:53:13 +000028415#if defined(LIBXML_READER_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028416 int mem_base;
28417 xmlTextReaderPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028418 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028419 int n_cur;
28420 const char * URL; /* the base URL to use for the document */
28421 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028422 char * encoding; /* the document encoding, or NULL */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028423 int n_encoding;
28424 int options; /* a combination of xmlParserOption */
28425 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028426
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028427 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
28428 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28429 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028430 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028431 mem_base = xmlMemBlocks();
28432 cur = gen_const_xmlChar_ptr(n_cur, 0);
28433 URL = gen_filepath(n_URL, 1);
28434 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000028435 options = gen_parseroptions(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028436
William M. Brackf13f77f2004-11-12 16:03:48 +000028437 ret_val = xmlReaderForDoc((const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028438 desret_xmlTextReaderPtr(ret_val);
28439 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000028440 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028441 des_filepath(n_URL, URL, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000028442 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000028443 des_parseroptions(n_options, options, 3);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028444 xmlResetLastError();
28445 if (mem_base != xmlMemBlocks()) {
28446 printf("Leak of %d blocks found in xmlReaderForDoc",
28447 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028448 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028449 printf(" %d", n_cur);
28450 printf(" %d", n_URL);
28451 printf(" %d", n_encoding);
28452 printf(" %d", n_options);
28453 printf("\n");
28454 }
28455 }
28456 }
28457 }
28458 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028459 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028460#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000028461
Daniel Veillard42595322004-11-08 10:52:06 +000028462 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028463}
28464
28465
28466static int
28467test_xmlReaderForFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028468 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028469
William M. Brack21e4ef22005-01-02 09:53:13 +000028470#if defined(LIBXML_READER_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028471 int mem_base;
28472 xmlTextReaderPtr ret_val;
28473 const char * filename; /* a file or URL */
28474 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028475 char * encoding; /* the document encoding, or NULL */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028476 int n_encoding;
28477 int options; /* a combination of xmlParserOption */
28478 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028479
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028480 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
28481 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028482 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028483 mem_base = xmlMemBlocks();
28484 filename = gen_filepath(n_filename, 0);
28485 encoding = gen_const_char_ptr(n_encoding, 1);
Daniel Veillard6128c012004-11-08 17:16:15 +000028486 options = gen_parseroptions(n_options, 2);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028487
William M. Brackf13f77f2004-11-12 16:03:48 +000028488 ret_val = xmlReaderForFile(filename, (const char *)encoding, options);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028489 desret_xmlTextReaderPtr(ret_val);
28490 call_tests++;
28491 des_filepath(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000028492 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillard6128c012004-11-08 17:16:15 +000028493 des_parseroptions(n_options, options, 2);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028494 xmlResetLastError();
28495 if (mem_base != xmlMemBlocks()) {
28496 printf("Leak of %d blocks found in xmlReaderForFile",
28497 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028498 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028499 printf(" %d", n_filename);
28500 printf(" %d", n_encoding);
28501 printf(" %d", n_options);
28502 printf("\n");
28503 }
28504 }
28505 }
28506 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028507 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028508#endif
28509
Daniel Veillard42595322004-11-08 10:52:06 +000028510 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028511}
28512
28513
28514static int
28515test_xmlReaderForMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028516 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028517
William M. Brack21e4ef22005-01-02 09:53:13 +000028518#if defined(LIBXML_READER_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028519 int mem_base;
28520 xmlTextReaderPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028521 char * buffer; /* a pointer to a char array */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028522 int n_buffer;
28523 int size; /* the size of the array */
28524 int n_size;
28525 const char * URL; /* the base URL to use for the document */
28526 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028527 char * encoding; /* the document encoding, or NULL */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028528 int n_encoding;
28529 int options; /* a combination of xmlParserOption */
28530 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028531
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028532 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
28533 for (n_size = 0;n_size < gen_nb_int;n_size++) {
28534 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28535 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028536 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028537 mem_base = xmlMemBlocks();
28538 buffer = gen_const_char_ptr(n_buffer, 0);
28539 size = gen_int(n_size, 1);
28540 URL = gen_filepath(n_URL, 2);
28541 encoding = gen_const_char_ptr(n_encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000028542 options = gen_parseroptions(n_options, 4);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028543
William M. Brackf13f77f2004-11-12 16:03:48 +000028544 ret_val = xmlReaderForMemory((const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028545 desret_xmlTextReaderPtr(ret_val);
28546 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000028547 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028548 des_int(n_size, size, 1);
28549 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000028550 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000028551 des_parseroptions(n_options, options, 4);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028552 xmlResetLastError();
28553 if (mem_base != xmlMemBlocks()) {
28554 printf("Leak of %d blocks found in xmlReaderForMemory",
28555 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028556 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028557 printf(" %d", n_buffer);
28558 printf(" %d", n_size);
28559 printf(" %d", n_URL);
28560 printf(" %d", n_encoding);
28561 printf(" %d", n_options);
28562 printf("\n");
28563 }
28564 }
28565 }
28566 }
28567 }
28568 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028569 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028570#endif
28571
Daniel Veillard42595322004-11-08 10:52:06 +000028572 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028573}
28574
28575
28576static int
28577test_xmlReaderNewDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028578 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028579
William M. Brack21e4ef22005-01-02 09:53:13 +000028580#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028581 int mem_base;
28582 int ret_val;
28583 xmlTextReaderPtr reader; /* an XML reader */
28584 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028585 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028586 int n_cur;
28587 const char * URL; /* the base URL to use for the document */
28588 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028589 char * encoding; /* the document encoding, or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028590 int n_encoding;
28591 int options; /* a combination of xmlParserOption */
28592 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028593
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028594 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28595 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
28596 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28597 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028598 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028599 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028600 reader = gen_xmlTextReaderPtr(n_reader, 0);
28601 cur = gen_const_xmlChar_ptr(n_cur, 1);
28602 URL = gen_filepath(n_URL, 2);
28603 encoding = gen_const_char_ptr(n_encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000028604 options = gen_parseroptions(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028605
William M. Brackf13f77f2004-11-12 16:03:48 +000028606 ret_val = xmlReaderNewDoc(reader, (const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028607 desret_int(ret_val);
28608 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028609 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000028610 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000028611 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000028612 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000028613 des_parseroptions(n_options, options, 4);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028614 xmlResetLastError();
28615 if (mem_base != xmlMemBlocks()) {
28616 printf("Leak of %d blocks found in xmlReaderNewDoc",
28617 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028618 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028619 printf(" %d", n_reader);
28620 printf(" %d", n_cur);
28621 printf(" %d", n_URL);
28622 printf(" %d", n_encoding);
28623 printf(" %d", n_options);
28624 printf("\n");
28625 }
28626 }
28627 }
28628 }
28629 }
28630 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028631 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028632#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000028633
Daniel Veillard42595322004-11-08 10:52:06 +000028634 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028635}
28636
28637
28638static int
28639test_xmlReaderNewFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028640 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028641
William M. Brack21e4ef22005-01-02 09:53:13 +000028642#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028643 int mem_base;
28644 int ret_val;
28645 xmlTextReaderPtr reader; /* an XML reader */
28646 int n_reader;
28647 const char * filename; /* a file or URL */
28648 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028649 char * encoding; /* the document encoding, or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028650 int n_encoding;
28651 int options; /* a combination of xmlParserOption */
28652 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028653
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028654 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28655 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
28656 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028657 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028658 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028659 reader = gen_xmlTextReaderPtr(n_reader, 0);
28660 filename = gen_filepath(n_filename, 1);
28661 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000028662 options = gen_parseroptions(n_options, 3);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028663
William M. Brackf13f77f2004-11-12 16:03:48 +000028664 ret_val = xmlReaderNewFile(reader, filename, (const char *)encoding, options);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028665 desret_int(ret_val);
28666 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028667 des_xmlTextReaderPtr(n_reader, reader, 0);
28668 des_filepath(n_filename, filename, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000028669 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000028670 des_parseroptions(n_options, options, 3);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028671 xmlResetLastError();
28672 if (mem_base != xmlMemBlocks()) {
28673 printf("Leak of %d blocks found in xmlReaderNewFile",
28674 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028675 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028676 printf(" %d", n_reader);
28677 printf(" %d", n_filename);
28678 printf(" %d", n_encoding);
28679 printf(" %d", n_options);
28680 printf("\n");
28681 }
28682 }
28683 }
28684 }
28685 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028686 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028687#endif
28688
Daniel Veillard42595322004-11-08 10:52:06 +000028689 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028690}
28691
28692
28693static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000028694test_xmlReaderNewMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028695 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028696
William M. Brack21e4ef22005-01-02 09:53:13 +000028697#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028698 int mem_base;
28699 int ret_val;
28700 xmlTextReaderPtr reader; /* an XML reader */
28701 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028702 char * buffer; /* a pointer to a char array */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028703 int n_buffer;
28704 int size; /* the size of the array */
28705 int n_size;
28706 const char * URL; /* the base URL to use for the document */
28707 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028708 char * encoding; /* the document encoding, or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028709 int n_encoding;
28710 int options; /* a combination of xmlParserOption */
28711 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028712
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028713 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28714 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
28715 for (n_size = 0;n_size < gen_nb_int;n_size++) {
28716 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28717 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028718 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028719 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028720 reader = gen_xmlTextReaderPtr(n_reader, 0);
28721 buffer = gen_const_char_ptr(n_buffer, 1);
28722 size = gen_int(n_size, 2);
28723 URL = gen_filepath(n_URL, 3);
28724 encoding = gen_const_char_ptr(n_encoding, 4);
Daniel Veillard6128c012004-11-08 17:16:15 +000028725 options = gen_parseroptions(n_options, 5);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028726
William M. Brackf13f77f2004-11-12 16:03:48 +000028727 ret_val = xmlReaderNewMemory(reader, (const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028728 desret_int(ret_val);
28729 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028730 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000028731 des_const_char_ptr(n_buffer, (const char *)buffer, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000028732 des_int(n_size, size, 2);
28733 des_filepath(n_URL, URL, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000028734 des_const_char_ptr(n_encoding, (const char *)encoding, 4);
Daniel Veillard6128c012004-11-08 17:16:15 +000028735 des_parseroptions(n_options, options, 5);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028736 xmlResetLastError();
28737 if (mem_base != xmlMemBlocks()) {
28738 printf("Leak of %d blocks found in xmlReaderNewMemory",
28739 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028740 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028741 printf(" %d", n_reader);
28742 printf(" %d", n_buffer);
28743 printf(" %d", n_size);
28744 printf(" %d", n_URL);
28745 printf(" %d", n_encoding);
28746 printf(" %d", n_options);
28747 printf("\n");
28748 }
28749 }
28750 }
28751 }
28752 }
28753 }
28754 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028755 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028756#endif
28757
Daniel Veillard42595322004-11-08 10:52:06 +000028758 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028759}
28760
28761
28762static int
28763test_xmlReaderNewWalker(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028764 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028765
William M. Brack21e4ef22005-01-02 09:53:13 +000028766#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028767 int mem_base;
28768 int ret_val;
28769 xmlTextReaderPtr reader; /* an XML reader */
28770 int n_reader;
28771 xmlDocPtr doc; /* a preparsed document */
28772 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028773
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028774 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28775 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
28776 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028777 reader = gen_xmlTextReaderPtr(n_reader, 0);
28778 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028779
28780 ret_val = xmlReaderNewWalker(reader, doc);
28781 desret_int(ret_val);
28782 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028783 des_xmlTextReaderPtr(n_reader, reader, 0);
28784 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028785 xmlResetLastError();
28786 if (mem_base != xmlMemBlocks()) {
28787 printf("Leak of %d blocks found in xmlReaderNewWalker",
28788 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028789 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028790 printf(" %d", n_reader);
28791 printf(" %d", n_doc);
28792 printf("\n");
28793 }
28794 }
28795 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028796 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028797#endif
28798
Daniel Veillard42595322004-11-08 10:52:06 +000028799 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028800}
28801
28802
28803static int
28804test_xmlReaderWalker(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028805 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028806
William M. Brack21e4ef22005-01-02 09:53:13 +000028807#if defined(LIBXML_READER_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028808 int mem_base;
28809 xmlTextReaderPtr ret_val;
28810 xmlDocPtr doc; /* a preparsed document */
28811 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028812
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028813 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
28814 mem_base = xmlMemBlocks();
28815 doc = gen_xmlDocPtr(n_doc, 0);
28816
28817 ret_val = xmlReaderWalker(doc);
28818 desret_xmlTextReaderPtr(ret_val);
28819 call_tests++;
28820 des_xmlDocPtr(n_doc, doc, 0);
28821 xmlResetLastError();
28822 if (mem_base != xmlMemBlocks()) {
28823 printf("Leak of %d blocks found in xmlReaderWalker",
28824 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028825 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028826 printf(" %d", n_doc);
28827 printf("\n");
28828 }
28829 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028830 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028831#endif
28832
Daniel Veillard42595322004-11-08 10:52:06 +000028833 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028834}
28835
28836
28837static int
28838test_xmlTextReaderAttributeCount(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028839 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028840
William M. Brack21e4ef22005-01-02 09:53:13 +000028841#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028842 int mem_base;
28843 int ret_val;
28844 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28845 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028846
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028847 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28848 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028849 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028850
28851 ret_val = xmlTextReaderAttributeCount(reader);
28852 desret_int(ret_val);
28853 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028854 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028855 xmlResetLastError();
28856 if (mem_base != xmlMemBlocks()) {
28857 printf("Leak of %d blocks found in xmlTextReaderAttributeCount",
28858 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028859 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028860 printf(" %d", n_reader);
28861 printf("\n");
28862 }
28863 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028864 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028865#endif
28866
Daniel Veillard42595322004-11-08 10:52:06 +000028867 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028868}
28869
28870
28871static int
28872test_xmlTextReaderBaseUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028873 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028874
William M. Brack21e4ef22005-01-02 09:53:13 +000028875#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028876 int mem_base;
28877 xmlChar * ret_val;
28878 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28879 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028880
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028881 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28882 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028883 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028884
28885 ret_val = xmlTextReaderBaseUri(reader);
28886 desret_xmlChar_ptr(ret_val);
28887 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028888 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028889 xmlResetLastError();
28890 if (mem_base != xmlMemBlocks()) {
28891 printf("Leak of %d blocks found in xmlTextReaderBaseUri",
28892 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028893 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028894 printf(" %d", n_reader);
28895 printf("\n");
28896 }
28897 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028898 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028899#endif
28900
Daniel Veillard42595322004-11-08 10:52:06 +000028901 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028902}
28903
28904
28905static int
28906test_xmlTextReaderClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028907 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028908
William M. Brack21e4ef22005-01-02 09:53:13 +000028909#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028910 int mem_base;
28911 int ret_val;
28912 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28913 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028914
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028915 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28916 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028917 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028918
28919 ret_val = xmlTextReaderClose(reader);
28920 desret_int(ret_val);
28921 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028922 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028923 xmlResetLastError();
28924 if (mem_base != xmlMemBlocks()) {
28925 printf("Leak of %d blocks found in xmlTextReaderClose",
28926 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028927 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028928 printf(" %d", n_reader);
28929 printf("\n");
28930 }
28931 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028932 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028933#endif
28934
Daniel Veillard42595322004-11-08 10:52:06 +000028935 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028936}
28937
28938
28939static int
28940test_xmlTextReaderConstBaseUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028941 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028942
William M. Brack21e4ef22005-01-02 09:53:13 +000028943#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028944 int mem_base;
28945 const xmlChar * ret_val;
28946 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28947 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028948
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028949 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28950 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028951 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028952
28953 ret_val = xmlTextReaderConstBaseUri(reader);
28954 desret_const_xmlChar_ptr(ret_val);
28955 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028956 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028957 xmlResetLastError();
28958 if (mem_base != xmlMemBlocks()) {
28959 printf("Leak of %d blocks found in xmlTextReaderConstBaseUri",
28960 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028961 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028962 printf(" %d", n_reader);
28963 printf("\n");
28964 }
28965 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028966 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028967#endif
28968
Daniel Veillard42595322004-11-08 10:52:06 +000028969 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028970}
28971
28972
28973static int
28974test_xmlTextReaderConstEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028975 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028976
William M. Brack21e4ef22005-01-02 09:53:13 +000028977#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028978 int mem_base;
28979 const xmlChar * ret_val;
28980 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28981 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028982
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028983 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28984 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028985 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028986
28987 ret_val = xmlTextReaderConstEncoding(reader);
28988 desret_const_xmlChar_ptr(ret_val);
28989 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028990 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028991 xmlResetLastError();
28992 if (mem_base != xmlMemBlocks()) {
28993 printf("Leak of %d blocks found in xmlTextReaderConstEncoding",
28994 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028995 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028996 printf(" %d", n_reader);
28997 printf("\n");
28998 }
28999 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029000 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029001#endif
29002
Daniel Veillard42595322004-11-08 10:52:06 +000029003 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029004}
29005
29006
29007static int
29008test_xmlTextReaderConstLocalName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029009 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029010
William M. Brack21e4ef22005-01-02 09:53:13 +000029011#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029012 int mem_base;
29013 const xmlChar * ret_val;
29014 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29015 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029016
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029017 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29018 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029019 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029020
29021 ret_val = xmlTextReaderConstLocalName(reader);
29022 desret_const_xmlChar_ptr(ret_val);
29023 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029024 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029025 xmlResetLastError();
29026 if (mem_base != xmlMemBlocks()) {
29027 printf("Leak of %d blocks found in xmlTextReaderConstLocalName",
29028 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029029 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029030 printf(" %d", n_reader);
29031 printf("\n");
29032 }
29033 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029034 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029035#endif
29036
Daniel Veillard42595322004-11-08 10:52:06 +000029037 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029038}
29039
29040
29041static int
29042test_xmlTextReaderConstName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029043 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029044
William M. Brack21e4ef22005-01-02 09:53:13 +000029045#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029046 int mem_base;
29047 const xmlChar * ret_val;
29048 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29049 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029050
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029051 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29052 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029053 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029054
29055 ret_val = xmlTextReaderConstName(reader);
29056 desret_const_xmlChar_ptr(ret_val);
29057 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029058 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029059 xmlResetLastError();
29060 if (mem_base != xmlMemBlocks()) {
29061 printf("Leak of %d blocks found in xmlTextReaderConstName",
29062 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029063 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029064 printf(" %d", n_reader);
29065 printf("\n");
29066 }
29067 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029068 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029069#endif
29070
Daniel Veillard42595322004-11-08 10:52:06 +000029071 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029072}
29073
29074
29075static int
29076test_xmlTextReaderConstNamespaceUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029077 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029078
William M. Brack21e4ef22005-01-02 09:53:13 +000029079#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029080 int mem_base;
29081 const xmlChar * ret_val;
29082 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29083 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029084
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029085 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29086 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029087 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029088
29089 ret_val = xmlTextReaderConstNamespaceUri(reader);
29090 desret_const_xmlChar_ptr(ret_val);
29091 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029092 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029093 xmlResetLastError();
29094 if (mem_base != xmlMemBlocks()) {
29095 printf("Leak of %d blocks found in xmlTextReaderConstNamespaceUri",
29096 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029097 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029098 printf(" %d", n_reader);
29099 printf("\n");
29100 }
29101 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029102 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029103#endif
29104
Daniel Veillard42595322004-11-08 10:52:06 +000029105 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029106}
29107
29108
29109static int
29110test_xmlTextReaderConstPrefix(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029111 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029112
William M. Brack21e4ef22005-01-02 09:53:13 +000029113#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029114 int mem_base;
29115 const xmlChar * ret_val;
29116 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29117 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029118
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029119 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29120 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029121 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029122
29123 ret_val = xmlTextReaderConstPrefix(reader);
29124 desret_const_xmlChar_ptr(ret_val);
29125 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029126 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029127 xmlResetLastError();
29128 if (mem_base != xmlMemBlocks()) {
29129 printf("Leak of %d blocks found in xmlTextReaderConstPrefix",
29130 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029131 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029132 printf(" %d", n_reader);
29133 printf("\n");
29134 }
29135 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029136 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029137#endif
29138
Daniel Veillard42595322004-11-08 10:52:06 +000029139 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029140}
29141
29142
29143static int
29144test_xmlTextReaderConstString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029145 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029146
William M. Brack21e4ef22005-01-02 09:53:13 +000029147#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029148 int mem_base;
29149 const xmlChar * ret_val;
29150 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29151 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029152 xmlChar * str; /* the string to intern. */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029153 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029154
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029155 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29156 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
29157 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029158 reader = gen_xmlTextReaderPtr(n_reader, 0);
29159 str = gen_const_xmlChar_ptr(n_str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029160
William M. Brackf13f77f2004-11-12 16:03:48 +000029161 ret_val = xmlTextReaderConstString(reader, (const xmlChar *)str);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029162 desret_const_xmlChar_ptr(ret_val);
29163 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029164 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000029165 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029166 xmlResetLastError();
29167 if (mem_base != xmlMemBlocks()) {
29168 printf("Leak of %d blocks found in xmlTextReaderConstString",
29169 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029170 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029171 printf(" %d", n_reader);
29172 printf(" %d", n_str);
29173 printf("\n");
29174 }
29175 }
29176 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029177 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029178#endif
29179
Daniel Veillard42595322004-11-08 10:52:06 +000029180 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029181}
29182
29183
29184static int
29185test_xmlTextReaderConstValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029186 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029187
William M. Brack21e4ef22005-01-02 09:53:13 +000029188#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029189 int mem_base;
29190 const xmlChar * ret_val;
29191 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29192 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029193
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029194 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29195 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029196 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029197
29198 ret_val = xmlTextReaderConstValue(reader);
29199 desret_const_xmlChar_ptr(ret_val);
29200 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029201 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029202 xmlResetLastError();
29203 if (mem_base != xmlMemBlocks()) {
29204 printf("Leak of %d blocks found in xmlTextReaderConstValue",
29205 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029206 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029207 printf(" %d", n_reader);
29208 printf("\n");
29209 }
29210 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029211 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029212#endif
29213
Daniel Veillard42595322004-11-08 10:52:06 +000029214 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029215}
29216
29217
29218static int
29219test_xmlTextReaderConstXmlLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029220 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029221
William M. Brack21e4ef22005-01-02 09:53:13 +000029222#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029223 int mem_base;
29224 const xmlChar * ret_val;
29225 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29226 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029227
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029228 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29229 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029230 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029231
29232 ret_val = xmlTextReaderConstXmlLang(reader);
29233 desret_const_xmlChar_ptr(ret_val);
29234 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029235 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029236 xmlResetLastError();
29237 if (mem_base != xmlMemBlocks()) {
29238 printf("Leak of %d blocks found in xmlTextReaderConstXmlLang",
29239 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029240 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029241 printf(" %d", n_reader);
29242 printf("\n");
29243 }
29244 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029245 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029246#endif
29247
Daniel Veillard42595322004-11-08 10:52:06 +000029248 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029249}
29250
29251
29252static int
29253test_xmlTextReaderConstXmlVersion(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029254 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029255
William M. Brack21e4ef22005-01-02 09:53:13 +000029256#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029257 int mem_base;
29258 const xmlChar * ret_val;
29259 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29260 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029261
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029262 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29263 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029264 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029265
29266 ret_val = xmlTextReaderConstXmlVersion(reader);
29267 desret_const_xmlChar_ptr(ret_val);
29268 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029269 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029270 xmlResetLastError();
29271 if (mem_base != xmlMemBlocks()) {
29272 printf("Leak of %d blocks found in xmlTextReaderConstXmlVersion",
29273 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029274 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029275 printf(" %d", n_reader);
29276 printf("\n");
29277 }
29278 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029279 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029280#endif
29281
Daniel Veillard42595322004-11-08 10:52:06 +000029282 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029283}
29284
29285
29286static int
29287test_xmlTextReaderCurrentDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029288 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029289
William M. Brack21e4ef22005-01-02 09:53:13 +000029290#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029291 int mem_base;
29292 xmlDocPtr ret_val;
29293 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29294 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029295
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029296 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29297 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029298 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029299
29300 ret_val = xmlTextReaderCurrentDoc(reader);
29301 desret_xmlDocPtr(ret_val);
29302 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029303 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029304 xmlResetLastError();
29305 if (mem_base != xmlMemBlocks()) {
29306 printf("Leak of %d blocks found in xmlTextReaderCurrentDoc",
29307 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029308 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029309 printf(" %d", n_reader);
29310 printf("\n");
29311 }
29312 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029313 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029314#endif
29315
Daniel Veillard42595322004-11-08 10:52:06 +000029316 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029317}
29318
29319
29320static int
29321test_xmlTextReaderCurrentNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029322 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029323
William M. Brack21e4ef22005-01-02 09:53:13 +000029324#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029325 int mem_base;
29326 xmlNodePtr ret_val;
29327 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29328 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029329
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029330 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29331 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029332 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029333
29334 ret_val = xmlTextReaderCurrentNode(reader);
29335 desret_xmlNodePtr(ret_val);
29336 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029337 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029338 xmlResetLastError();
29339 if (mem_base != xmlMemBlocks()) {
29340 printf("Leak of %d blocks found in xmlTextReaderCurrentNode",
29341 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029342 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029343 printf(" %d", n_reader);
29344 printf("\n");
29345 }
29346 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029347 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029348#endif
29349
Daniel Veillard42595322004-11-08 10:52:06 +000029350 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029351}
29352
29353
29354static int
29355test_xmlTextReaderDepth(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029356 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029357
William M. Brack21e4ef22005-01-02 09:53:13 +000029358#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029359 int mem_base;
29360 int ret_val;
29361 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29362 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029363
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029364 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29365 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029366 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029367
29368 ret_val = xmlTextReaderDepth(reader);
29369 desret_int(ret_val);
29370 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029371 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029372 xmlResetLastError();
29373 if (mem_base != xmlMemBlocks()) {
29374 printf("Leak of %d blocks found in xmlTextReaderDepth",
29375 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029376 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029377 printf(" %d", n_reader);
29378 printf("\n");
29379 }
29380 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029381 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029382#endif
29383
Daniel Veillard42595322004-11-08 10:52:06 +000029384 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029385}
29386
29387
29388static int
29389test_xmlTextReaderExpand(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029390 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029391
William M. Brack21e4ef22005-01-02 09:53:13 +000029392#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029393 int mem_base;
29394 xmlNodePtr ret_val;
29395 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29396 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029397
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029398 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29399 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029400 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029401
29402 ret_val = xmlTextReaderExpand(reader);
29403 desret_xmlNodePtr(ret_val);
29404 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029405 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029406 xmlResetLastError();
29407 if (mem_base != xmlMemBlocks()) {
29408 printf("Leak of %d blocks found in xmlTextReaderExpand",
29409 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029410 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029411 printf(" %d", n_reader);
29412 printf("\n");
29413 }
29414 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029415 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029416#endif
29417
Daniel Veillard42595322004-11-08 10:52:06 +000029418 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029419}
29420
29421
29422static int
29423test_xmlTextReaderGetAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029424 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029425
William M. Brack21e4ef22005-01-02 09:53:13 +000029426#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029427 int mem_base;
29428 xmlChar * ret_val;
29429 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29430 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029431 xmlChar * name; /* the qualified name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029432 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029433
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029434 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29435 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
29436 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029437 reader = gen_xmlTextReaderPtr(n_reader, 0);
29438 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029439
William M. Brackf13f77f2004-11-12 16:03:48 +000029440 ret_val = xmlTextReaderGetAttribute(reader, (const xmlChar *)name);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029441 desret_xmlChar_ptr(ret_val);
29442 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029443 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000029444 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029445 xmlResetLastError();
29446 if (mem_base != xmlMemBlocks()) {
29447 printf("Leak of %d blocks found in xmlTextReaderGetAttribute",
29448 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029449 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029450 printf(" %d", n_reader);
29451 printf(" %d", n_name);
29452 printf("\n");
29453 }
29454 }
29455 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029456 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029457#endif
29458
Daniel Veillard42595322004-11-08 10:52:06 +000029459 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029460}
29461
29462
29463static int
29464test_xmlTextReaderGetAttributeNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029465 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029466
William M. Brack21e4ef22005-01-02 09:53:13 +000029467#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029468 int mem_base;
29469 xmlChar * ret_val;
29470 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29471 int n_reader;
29472 int no; /* the zero-based index of the attribute relative to the containing element */
29473 int n_no;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029474
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029475 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29476 for (n_no = 0;n_no < gen_nb_int;n_no++) {
29477 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029478 reader = gen_xmlTextReaderPtr(n_reader, 0);
29479 no = gen_int(n_no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029480
29481 ret_val = xmlTextReaderGetAttributeNo(reader, no);
29482 desret_xmlChar_ptr(ret_val);
29483 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029484 des_xmlTextReaderPtr(n_reader, reader, 0);
29485 des_int(n_no, no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029486 xmlResetLastError();
29487 if (mem_base != xmlMemBlocks()) {
29488 printf("Leak of %d blocks found in xmlTextReaderGetAttributeNo",
29489 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029490 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029491 printf(" %d", n_reader);
29492 printf(" %d", n_no);
29493 printf("\n");
29494 }
29495 }
29496 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029497 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029498#endif
29499
Daniel Veillard42595322004-11-08 10:52:06 +000029500 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029501}
29502
29503
29504static int
29505test_xmlTextReaderGetAttributeNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029506 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029507
William M. Brack21e4ef22005-01-02 09:53:13 +000029508#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029509 int mem_base;
29510 xmlChar * ret_val;
29511 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29512 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029513 xmlChar * localName; /* the local name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029514 int n_localName;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029515 xmlChar * namespaceURI; /* the namespace URI of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029516 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029517
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029518 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29519 for (n_localName = 0;n_localName < gen_nb_const_xmlChar_ptr;n_localName++) {
29520 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
29521 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029522 reader = gen_xmlTextReaderPtr(n_reader, 0);
29523 localName = gen_const_xmlChar_ptr(n_localName, 1);
29524 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029525
William M. Brackf13f77f2004-11-12 16:03:48 +000029526 ret_val = xmlTextReaderGetAttributeNs(reader, (const xmlChar *)localName, (const xmlChar *)namespaceURI);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029527 desret_xmlChar_ptr(ret_val);
29528 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029529 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000029530 des_const_xmlChar_ptr(n_localName, (const xmlChar *)localName, 1);
29531 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029532 xmlResetLastError();
29533 if (mem_base != xmlMemBlocks()) {
29534 printf("Leak of %d blocks found in xmlTextReaderGetAttributeNs",
29535 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029536 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029537 printf(" %d", n_reader);
29538 printf(" %d", n_localName);
29539 printf(" %d", n_namespaceURI);
29540 printf("\n");
29541 }
29542 }
29543 }
29544 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029545 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029546#endif
29547
Daniel Veillard42595322004-11-08 10:52:06 +000029548 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029549}
29550
Daniel Veillarda521d282004-11-09 14:59:59 +000029551#ifdef LIBXML_READER_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000029552
Daniel Veillardce682bc2004-11-05 17:22:25 +000029553#define gen_nb_xmlTextReaderErrorFunc_ptr 1
29554static xmlTextReaderErrorFunc * gen_xmlTextReaderErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
29555 return(NULL);
29556}
29557static void des_xmlTextReaderErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlTextReaderErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
29558}
Daniel Veillarda521d282004-11-09 14:59:59 +000029559#endif
29560
Daniel Veillardce682bc2004-11-05 17:22:25 +000029561
Daniel Veillardd93f6252004-11-02 15:53:51 +000029562static int
29563test_xmlTextReaderGetErrorHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029564 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029565
William M. Brack21e4ef22005-01-02 09:53:13 +000029566#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029567 int mem_base;
29568 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29569 int n_reader;
29570 xmlTextReaderErrorFunc * f; /* the callback function or NULL is no callback has been registered */
29571 int n_f;
29572 void ** arg; /* a user argument */
29573 int n_arg;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029574
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029575 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29576 for (n_f = 0;n_f < gen_nb_xmlTextReaderErrorFunc_ptr;n_f++) {
29577 for (n_arg = 0;n_arg < gen_nb_void_ptr_ptr;n_arg++) {
29578 mem_base = xmlMemBlocks();
29579 reader = gen_xmlTextReaderPtr(n_reader, 0);
29580 f = gen_xmlTextReaderErrorFunc_ptr(n_f, 1);
29581 arg = gen_void_ptr_ptr(n_arg, 2);
29582
29583 xmlTextReaderGetErrorHandler(reader, f, arg);
29584 call_tests++;
29585 des_xmlTextReaderPtr(n_reader, reader, 0);
29586 des_xmlTextReaderErrorFunc_ptr(n_f, f, 1);
29587 des_void_ptr_ptr(n_arg, arg, 2);
29588 xmlResetLastError();
29589 if (mem_base != xmlMemBlocks()) {
29590 printf("Leak of %d blocks found in xmlTextReaderGetErrorHandler",
29591 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029592 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029593 printf(" %d", n_reader);
29594 printf(" %d", n_f);
29595 printf(" %d", n_arg);
29596 printf("\n");
29597 }
29598 }
29599 }
29600 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029601 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029602#endif
29603
Daniel Veillard42595322004-11-08 10:52:06 +000029604 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029605}
29606
29607
29608static int
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000029609test_xmlTextReaderGetParserColumnNumber(void) {
29610 int test_ret = 0;
29611
29612#if defined(LIBXML_READER_ENABLED)
29613 int mem_base;
29614 int ret_val;
29615 xmlTextReaderPtr reader; /* the user data (XML reader context) */
29616 int n_reader;
29617
29618 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29619 mem_base = xmlMemBlocks();
29620 reader = gen_xmlTextReaderPtr(n_reader, 0);
29621
29622 ret_val = xmlTextReaderGetParserColumnNumber(reader);
29623 desret_int(ret_val);
29624 call_tests++;
29625 des_xmlTextReaderPtr(n_reader, reader, 0);
29626 xmlResetLastError();
29627 if (mem_base != xmlMemBlocks()) {
29628 printf("Leak of %d blocks found in xmlTextReaderGetParserColumnNumber",
29629 xmlMemBlocks() - mem_base);
29630 test_ret++;
29631 printf(" %d", n_reader);
29632 printf("\n");
29633 }
29634 }
29635 function_tests++;
29636#endif
29637
29638 return(test_ret);
29639}
29640
29641
29642static int
29643test_xmlTextReaderGetParserLineNumber(void) {
29644 int test_ret = 0;
29645
29646#if defined(LIBXML_READER_ENABLED)
29647 int mem_base;
29648 int ret_val;
29649 xmlTextReaderPtr reader; /* the user data (XML reader context) */
29650 int n_reader;
29651
29652 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29653 mem_base = xmlMemBlocks();
29654 reader = gen_xmlTextReaderPtr(n_reader, 0);
29655
29656 ret_val = xmlTextReaderGetParserLineNumber(reader);
29657 desret_int(ret_val);
29658 call_tests++;
29659 des_xmlTextReaderPtr(n_reader, reader, 0);
29660 xmlResetLastError();
29661 if (mem_base != xmlMemBlocks()) {
29662 printf("Leak of %d blocks found in xmlTextReaderGetParserLineNumber",
29663 xmlMemBlocks() - mem_base);
29664 test_ret++;
29665 printf(" %d", n_reader);
29666 printf("\n");
29667 }
29668 }
29669 function_tests++;
29670#endif
29671
29672 return(test_ret);
29673}
29674
29675
29676static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000029677test_xmlTextReaderGetParserProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029678 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029679
William M. Brack21e4ef22005-01-02 09:53:13 +000029680#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029681 int mem_base;
29682 int ret_val;
29683 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29684 int n_reader;
29685 int prop; /* the xmlParserProperties to get */
29686 int n_prop;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029687
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029688 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29689 for (n_prop = 0;n_prop < gen_nb_int;n_prop++) {
29690 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029691 reader = gen_xmlTextReaderPtr(n_reader, 0);
29692 prop = gen_int(n_prop, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029693
29694 ret_val = xmlTextReaderGetParserProp(reader, prop);
29695 desret_int(ret_val);
29696 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029697 des_xmlTextReaderPtr(n_reader, reader, 0);
29698 des_int(n_prop, prop, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029699 xmlResetLastError();
29700 if (mem_base != xmlMemBlocks()) {
29701 printf("Leak of %d blocks found in xmlTextReaderGetParserProp",
29702 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029703 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029704 printf(" %d", n_reader);
29705 printf(" %d", n_prop);
29706 printf("\n");
29707 }
29708 }
29709 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029710 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029711#endif
29712
Daniel Veillard42595322004-11-08 10:52:06 +000029713 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029714}
29715
29716
29717static int
29718test_xmlTextReaderGetRemainder(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029719 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029720
William M. Brack21e4ef22005-01-02 09:53:13 +000029721#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029722 int mem_base;
29723 xmlParserInputBufferPtr ret_val;
29724 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29725 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029726
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029727 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29728 mem_base = xmlMemBlocks();
29729 reader = gen_xmlTextReaderPtr(n_reader, 0);
29730
29731 ret_val = xmlTextReaderGetRemainder(reader);
29732 desret_xmlParserInputBufferPtr(ret_val);
29733 call_tests++;
29734 des_xmlTextReaderPtr(n_reader, reader, 0);
29735 xmlResetLastError();
29736 if (mem_base != xmlMemBlocks()) {
29737 printf("Leak of %d blocks found in xmlTextReaderGetRemainder",
29738 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029739 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029740 printf(" %d", n_reader);
29741 printf("\n");
29742 }
29743 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029744 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029745#endif
29746
Daniel Veillard42595322004-11-08 10:52:06 +000029747 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029748}
29749
29750
29751static int
29752test_xmlTextReaderHasAttributes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029753 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029754
William M. Brack21e4ef22005-01-02 09:53:13 +000029755#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029756 int mem_base;
29757 int ret_val;
29758 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29759 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029760
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029761 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29762 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029763 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029764
29765 ret_val = xmlTextReaderHasAttributes(reader);
29766 desret_int(ret_val);
29767 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029768 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029769 xmlResetLastError();
29770 if (mem_base != xmlMemBlocks()) {
29771 printf("Leak of %d blocks found in xmlTextReaderHasAttributes",
29772 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029773 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029774 printf(" %d", n_reader);
29775 printf("\n");
29776 }
29777 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029778 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029779#endif
29780
Daniel Veillard42595322004-11-08 10:52:06 +000029781 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029782}
29783
29784
29785static int
29786test_xmlTextReaderHasValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029787 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029788
William M. Brack21e4ef22005-01-02 09:53:13 +000029789#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029790 int mem_base;
29791 int ret_val;
29792 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29793 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029794
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029795 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29796 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029797 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029798
29799 ret_val = xmlTextReaderHasValue(reader);
29800 desret_int(ret_val);
29801 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029802 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029803 xmlResetLastError();
29804 if (mem_base != xmlMemBlocks()) {
29805 printf("Leak of %d blocks found in xmlTextReaderHasValue",
29806 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029807 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029808 printf(" %d", n_reader);
29809 printf("\n");
29810 }
29811 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029812 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029813#endif
29814
Daniel Veillard42595322004-11-08 10:52:06 +000029815 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029816}
29817
29818
29819static int
29820test_xmlTextReaderIsDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029821 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029822
William M. Brack21e4ef22005-01-02 09:53:13 +000029823#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029824 int mem_base;
29825 int ret_val;
29826 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29827 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029828
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029829 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29830 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029831 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029832
29833 ret_val = xmlTextReaderIsDefault(reader);
29834 desret_int(ret_val);
29835 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029836 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029837 xmlResetLastError();
29838 if (mem_base != xmlMemBlocks()) {
29839 printf("Leak of %d blocks found in xmlTextReaderIsDefault",
29840 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029841 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029842 printf(" %d", n_reader);
29843 printf("\n");
29844 }
29845 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029846 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029847#endif
29848
Daniel Veillard42595322004-11-08 10:52:06 +000029849 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029850}
29851
29852
29853static int
29854test_xmlTextReaderIsEmptyElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029855 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029856
William M. Brack21e4ef22005-01-02 09:53:13 +000029857#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029858 int mem_base;
29859 int ret_val;
29860 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29861 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029862
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029863 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29864 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029865 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029866
29867 ret_val = xmlTextReaderIsEmptyElement(reader);
29868 desret_int(ret_val);
29869 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029870 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029871 xmlResetLastError();
29872 if (mem_base != xmlMemBlocks()) {
29873 printf("Leak of %d blocks found in xmlTextReaderIsEmptyElement",
29874 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029875 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029876 printf(" %d", n_reader);
29877 printf("\n");
29878 }
29879 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029880 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029881#endif
29882
Daniel Veillard42595322004-11-08 10:52:06 +000029883 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029884}
29885
29886
29887static int
29888test_xmlTextReaderIsNamespaceDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029889 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029890
William M. Brack21e4ef22005-01-02 09:53:13 +000029891#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029892 int mem_base;
29893 int ret_val;
29894 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29895 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029896
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029897 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29898 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029899 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029900
29901 ret_val = xmlTextReaderIsNamespaceDecl(reader);
29902 desret_int(ret_val);
29903 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029904 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029905 xmlResetLastError();
29906 if (mem_base != xmlMemBlocks()) {
29907 printf("Leak of %d blocks found in xmlTextReaderIsNamespaceDecl",
29908 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029909 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029910 printf(" %d", n_reader);
29911 printf("\n");
29912 }
29913 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029914 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029915#endif
29916
Daniel Veillard42595322004-11-08 10:52:06 +000029917 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029918}
29919
29920
29921static int
29922test_xmlTextReaderIsValid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029923 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029924
William M. Brack21e4ef22005-01-02 09:53:13 +000029925#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029926 int mem_base;
29927 int ret_val;
29928 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29929 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029930
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029931 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29932 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029933 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029934
29935 ret_val = xmlTextReaderIsValid(reader);
29936 desret_int(ret_val);
29937 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029938 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029939 xmlResetLastError();
29940 if (mem_base != xmlMemBlocks()) {
29941 printf("Leak of %d blocks found in xmlTextReaderIsValid",
29942 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029943 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029944 printf(" %d", n_reader);
29945 printf("\n");
29946 }
29947 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029948 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029949#endif
29950
Daniel Veillard42595322004-11-08 10:52:06 +000029951 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029952}
29953
29954
29955static int
29956test_xmlTextReaderLocalName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029957 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029958
William M. Brack21e4ef22005-01-02 09:53:13 +000029959#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029960 int mem_base;
29961 xmlChar * ret_val;
29962 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29963 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029964
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029965 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29966 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029967 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029968
29969 ret_val = xmlTextReaderLocalName(reader);
29970 desret_xmlChar_ptr(ret_val);
29971 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029972 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029973 xmlResetLastError();
29974 if (mem_base != xmlMemBlocks()) {
29975 printf("Leak of %d blocks found in xmlTextReaderLocalName",
29976 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029977 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029978 printf(" %d", n_reader);
29979 printf("\n");
29980 }
29981 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029982 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029983#endif
29984
Daniel Veillard42595322004-11-08 10:52:06 +000029985 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029986}
29987
Daniel Veillarda521d282004-11-09 14:59:59 +000029988#ifdef LIBXML_READER_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000029989
Daniel Veillardce682bc2004-11-05 17:22:25 +000029990#define gen_nb_xmlTextReaderLocatorPtr 1
29991static xmlTextReaderLocatorPtr gen_xmlTextReaderLocatorPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
29992 return(NULL);
29993}
29994static void des_xmlTextReaderLocatorPtr(int no ATTRIBUTE_UNUSED, xmlTextReaderLocatorPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
29995}
Daniel Veillarda521d282004-11-09 14:59:59 +000029996#endif
29997
Daniel Veillardce682bc2004-11-05 17:22:25 +000029998
Daniel Veillardd93f6252004-11-02 15:53:51 +000029999static int
30000test_xmlTextReaderLocatorBaseURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030001 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030002
William M. Brack21e4ef22005-01-02 09:53:13 +000030003#if defined(LIBXML_READER_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000030004 int mem_base;
30005 xmlChar * ret_val;
30006 xmlTextReaderLocatorPtr locator; /* the xmlTextReaderLocatorPtr used */
30007 int n_locator;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030008
Daniel Veillardce682bc2004-11-05 17:22:25 +000030009 for (n_locator = 0;n_locator < gen_nb_xmlTextReaderLocatorPtr;n_locator++) {
30010 mem_base = xmlMemBlocks();
30011 locator = gen_xmlTextReaderLocatorPtr(n_locator, 0);
30012
30013 ret_val = xmlTextReaderLocatorBaseURI(locator);
30014 desret_xmlChar_ptr(ret_val);
30015 call_tests++;
30016 des_xmlTextReaderLocatorPtr(n_locator, locator, 0);
30017 xmlResetLastError();
30018 if (mem_base != xmlMemBlocks()) {
30019 printf("Leak of %d blocks found in xmlTextReaderLocatorBaseURI",
30020 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030021 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030022 printf(" %d", n_locator);
30023 printf("\n");
30024 }
30025 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030026 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030027#endif
30028
Daniel Veillard42595322004-11-08 10:52:06 +000030029 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030030}
30031
30032
30033static int
30034test_xmlTextReaderLocatorLineNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030035 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030036
William M. Brack21e4ef22005-01-02 09:53:13 +000030037#if defined(LIBXML_READER_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000030038 int mem_base;
30039 int ret_val;
30040 xmlTextReaderLocatorPtr locator; /* the xmlTextReaderLocatorPtr used */
30041 int n_locator;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030042
Daniel Veillardce682bc2004-11-05 17:22:25 +000030043 for (n_locator = 0;n_locator < gen_nb_xmlTextReaderLocatorPtr;n_locator++) {
30044 mem_base = xmlMemBlocks();
30045 locator = gen_xmlTextReaderLocatorPtr(n_locator, 0);
30046
30047 ret_val = xmlTextReaderLocatorLineNumber(locator);
30048 desret_int(ret_val);
30049 call_tests++;
30050 des_xmlTextReaderLocatorPtr(n_locator, locator, 0);
30051 xmlResetLastError();
30052 if (mem_base != xmlMemBlocks()) {
30053 printf("Leak of %d blocks found in xmlTextReaderLocatorLineNumber",
30054 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030055 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030056 printf(" %d", n_locator);
30057 printf("\n");
30058 }
30059 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030060 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030061#endif
30062
Daniel Veillard42595322004-11-08 10:52:06 +000030063 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030064}
30065
30066
30067static int
30068test_xmlTextReaderLookupNamespace(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030069 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030070
William M. Brack21e4ef22005-01-02 09:53:13 +000030071#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030072 int mem_base;
30073 xmlChar * ret_val;
30074 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30075 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030076 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 +000030077 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030078
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030079 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30080 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
30081 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030082 reader = gen_xmlTextReaderPtr(n_reader, 0);
30083 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030084
William M. Brackf13f77f2004-11-12 16:03:48 +000030085 ret_val = xmlTextReaderLookupNamespace(reader, (const xmlChar *)prefix);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030086 desret_xmlChar_ptr(ret_val);
30087 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030088 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000030089 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030090 xmlResetLastError();
30091 if (mem_base != xmlMemBlocks()) {
30092 printf("Leak of %d blocks found in xmlTextReaderLookupNamespace",
30093 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030094 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030095 printf(" %d", n_reader);
30096 printf(" %d", n_prefix);
30097 printf("\n");
30098 }
30099 }
30100 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030101 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030102#endif
30103
Daniel Veillard42595322004-11-08 10:52:06 +000030104 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030105}
30106
30107
30108static int
30109test_xmlTextReaderMoveToAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030110 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030111
William M. Brack21e4ef22005-01-02 09:53:13 +000030112#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030113 int mem_base;
30114 int ret_val;
30115 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30116 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030117 xmlChar * name; /* the qualified name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030118 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030119
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030120 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30121 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
30122 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030123 reader = gen_xmlTextReaderPtr(n_reader, 0);
30124 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030125
William M. Brackf13f77f2004-11-12 16:03:48 +000030126 ret_val = xmlTextReaderMoveToAttribute(reader, (const xmlChar *)name);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030127 desret_int(ret_val);
30128 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030129 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000030130 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030131 xmlResetLastError();
30132 if (mem_base != xmlMemBlocks()) {
30133 printf("Leak of %d blocks found in xmlTextReaderMoveToAttribute",
30134 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030135 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030136 printf(" %d", n_reader);
30137 printf(" %d", n_name);
30138 printf("\n");
30139 }
30140 }
30141 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030142 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030143#endif
30144
Daniel Veillard42595322004-11-08 10:52:06 +000030145 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030146}
30147
30148
30149static int
30150test_xmlTextReaderMoveToAttributeNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030151 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030152
William M. Brack21e4ef22005-01-02 09:53:13 +000030153#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030154 int mem_base;
30155 int ret_val;
30156 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30157 int n_reader;
30158 int no; /* the zero-based index of the attribute relative to the containing element. */
30159 int n_no;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030160
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030161 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30162 for (n_no = 0;n_no < gen_nb_int;n_no++) {
30163 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030164 reader = gen_xmlTextReaderPtr(n_reader, 0);
30165 no = gen_int(n_no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030166
30167 ret_val = xmlTextReaderMoveToAttributeNo(reader, no);
30168 desret_int(ret_val);
30169 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030170 des_xmlTextReaderPtr(n_reader, reader, 0);
30171 des_int(n_no, no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030172 xmlResetLastError();
30173 if (mem_base != xmlMemBlocks()) {
30174 printf("Leak of %d blocks found in xmlTextReaderMoveToAttributeNo",
30175 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030176 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030177 printf(" %d", n_reader);
30178 printf(" %d", n_no);
30179 printf("\n");
30180 }
30181 }
30182 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030183 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030184#endif
30185
Daniel Veillard42595322004-11-08 10:52:06 +000030186 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030187}
30188
30189
30190static int
30191test_xmlTextReaderMoveToAttributeNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030192 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030193
William M. Brack21e4ef22005-01-02 09:53:13 +000030194#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030195 int mem_base;
30196 int ret_val;
30197 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30198 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030199 xmlChar * localName; /* the local name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030200 int n_localName;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030201 xmlChar * namespaceURI; /* the namespace URI of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030202 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030203
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030204 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30205 for (n_localName = 0;n_localName < gen_nb_const_xmlChar_ptr;n_localName++) {
30206 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
30207 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030208 reader = gen_xmlTextReaderPtr(n_reader, 0);
30209 localName = gen_const_xmlChar_ptr(n_localName, 1);
30210 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030211
William M. Brackf13f77f2004-11-12 16:03:48 +000030212 ret_val = xmlTextReaderMoveToAttributeNs(reader, (const xmlChar *)localName, (const xmlChar *)namespaceURI);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030213 desret_int(ret_val);
30214 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030215 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000030216 des_const_xmlChar_ptr(n_localName, (const xmlChar *)localName, 1);
30217 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030218 xmlResetLastError();
30219 if (mem_base != xmlMemBlocks()) {
30220 printf("Leak of %d blocks found in xmlTextReaderMoveToAttributeNs",
30221 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030222 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030223 printf(" %d", n_reader);
30224 printf(" %d", n_localName);
30225 printf(" %d", n_namespaceURI);
30226 printf("\n");
30227 }
30228 }
30229 }
30230 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030231 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030232#endif
30233
Daniel Veillard42595322004-11-08 10:52:06 +000030234 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030235}
30236
30237
30238static int
30239test_xmlTextReaderMoveToElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030240 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030241
William M. Brack21e4ef22005-01-02 09:53:13 +000030242#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030243 int mem_base;
30244 int ret_val;
30245 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30246 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030247
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030248 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30249 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030250 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030251
30252 ret_val = xmlTextReaderMoveToElement(reader);
30253 desret_int(ret_val);
30254 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030255 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030256 xmlResetLastError();
30257 if (mem_base != xmlMemBlocks()) {
30258 printf("Leak of %d blocks found in xmlTextReaderMoveToElement",
30259 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030260 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030261 printf(" %d", n_reader);
30262 printf("\n");
30263 }
30264 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030265 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030266#endif
30267
Daniel Veillard42595322004-11-08 10:52:06 +000030268 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030269}
30270
30271
30272static int
30273test_xmlTextReaderMoveToFirstAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030274 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030275
William M. Brack21e4ef22005-01-02 09:53:13 +000030276#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030277 int mem_base;
30278 int ret_val;
30279 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30280 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030281
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030282 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30283 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030284 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030285
30286 ret_val = xmlTextReaderMoveToFirstAttribute(reader);
30287 desret_int(ret_val);
30288 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030289 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030290 xmlResetLastError();
30291 if (mem_base != xmlMemBlocks()) {
30292 printf("Leak of %d blocks found in xmlTextReaderMoveToFirstAttribute",
30293 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030294 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030295 printf(" %d", n_reader);
30296 printf("\n");
30297 }
30298 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030299 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030300#endif
30301
Daniel Veillard42595322004-11-08 10:52:06 +000030302 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030303}
30304
30305
30306static int
30307test_xmlTextReaderMoveToNextAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030308 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030309
William M. Brack21e4ef22005-01-02 09:53:13 +000030310#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030311 int mem_base;
30312 int ret_val;
30313 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30314 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030315
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030316 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30317 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030318 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030319
30320 ret_val = xmlTextReaderMoveToNextAttribute(reader);
30321 desret_int(ret_val);
30322 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030323 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030324 xmlResetLastError();
30325 if (mem_base != xmlMemBlocks()) {
30326 printf("Leak of %d blocks found in xmlTextReaderMoveToNextAttribute",
30327 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030328 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030329 printf(" %d", n_reader);
30330 printf("\n");
30331 }
30332 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030333 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030334#endif
30335
Daniel Veillard42595322004-11-08 10:52:06 +000030336 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030337}
30338
30339
30340static int
30341test_xmlTextReaderName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030342 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030343
William M. Brack21e4ef22005-01-02 09:53:13 +000030344#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030345 int mem_base;
30346 xmlChar * ret_val;
30347 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30348 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030349
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030350 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30351 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030352 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030353
30354 ret_val = xmlTextReaderName(reader);
30355 desret_xmlChar_ptr(ret_val);
30356 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030357 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030358 xmlResetLastError();
30359 if (mem_base != xmlMemBlocks()) {
30360 printf("Leak of %d blocks found in xmlTextReaderName",
30361 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030362 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030363 printf(" %d", n_reader);
30364 printf("\n");
30365 }
30366 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030367 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030368#endif
30369
Daniel Veillard42595322004-11-08 10:52:06 +000030370 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030371}
30372
30373
30374static int
30375test_xmlTextReaderNamespaceUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030376 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030377
William M. Brack21e4ef22005-01-02 09:53:13 +000030378#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030379 int mem_base;
30380 xmlChar * ret_val;
30381 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30382 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030383
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030384 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30385 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030386 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030387
30388 ret_val = xmlTextReaderNamespaceUri(reader);
30389 desret_xmlChar_ptr(ret_val);
30390 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030391 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030392 xmlResetLastError();
30393 if (mem_base != xmlMemBlocks()) {
30394 printf("Leak of %d blocks found in xmlTextReaderNamespaceUri",
30395 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030396 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030397 printf(" %d", n_reader);
30398 printf("\n");
30399 }
30400 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030401 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030402#endif
30403
Daniel Veillard42595322004-11-08 10:52:06 +000030404 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030405}
30406
30407
30408static int
30409test_xmlTextReaderNext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030410 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030411
William M. Brack21e4ef22005-01-02 09:53:13 +000030412#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030413 int mem_base;
30414 int ret_val;
30415 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30416 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030417
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030418 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30419 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030420 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030421
30422 ret_val = xmlTextReaderNext(reader);
30423 desret_int(ret_val);
30424 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030425 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030426 xmlResetLastError();
30427 if (mem_base != xmlMemBlocks()) {
30428 printf("Leak of %d blocks found in xmlTextReaderNext",
30429 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030430 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030431 printf(" %d", n_reader);
30432 printf("\n");
30433 }
30434 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030435 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030436#endif
30437
Daniel Veillard42595322004-11-08 10:52:06 +000030438 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030439}
30440
30441
30442static int
30443test_xmlTextReaderNextSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030444 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030445
William M. Brack21e4ef22005-01-02 09:53:13 +000030446#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030447 int mem_base;
30448 int ret_val;
30449 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30450 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030451
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030452 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30453 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030454 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030455
30456 ret_val = xmlTextReaderNextSibling(reader);
30457 desret_int(ret_val);
30458 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030459 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030460 xmlResetLastError();
30461 if (mem_base != xmlMemBlocks()) {
30462 printf("Leak of %d blocks found in xmlTextReaderNextSibling",
30463 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030464 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030465 printf(" %d", n_reader);
30466 printf("\n");
30467 }
30468 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030469 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030470#endif
30471
Daniel Veillard42595322004-11-08 10:52:06 +000030472 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030473}
30474
30475
30476static int
30477test_xmlTextReaderNodeType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030478 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030479
William M. Brack21e4ef22005-01-02 09:53:13 +000030480#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030481 int mem_base;
30482 int ret_val;
30483 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30484 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030485
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030486 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30487 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030488 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030489
30490 ret_val = xmlTextReaderNodeType(reader);
30491 desret_int(ret_val);
30492 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030493 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030494 xmlResetLastError();
30495 if (mem_base != xmlMemBlocks()) {
30496 printf("Leak of %d blocks found in xmlTextReaderNodeType",
30497 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030498 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030499 printf(" %d", n_reader);
30500 printf("\n");
30501 }
30502 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030503 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030504#endif
30505
Daniel Veillard42595322004-11-08 10:52:06 +000030506 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030507}
30508
30509
30510static int
30511test_xmlTextReaderNormalization(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030512 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030513
William M. Brack21e4ef22005-01-02 09:53:13 +000030514#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030515 int mem_base;
30516 int ret_val;
30517 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30518 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030519
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030520 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30521 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030522 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030523
30524 ret_val = xmlTextReaderNormalization(reader);
30525 desret_int(ret_val);
30526 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030527 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030528 xmlResetLastError();
30529 if (mem_base != xmlMemBlocks()) {
30530 printf("Leak of %d blocks found in xmlTextReaderNormalization",
30531 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030532 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030533 printf(" %d", n_reader);
30534 printf("\n");
30535 }
30536 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030537 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030538#endif
30539
Daniel Veillard42595322004-11-08 10:52:06 +000030540 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030541}
30542
30543
30544static int
30545test_xmlTextReaderPrefix(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030546 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030547
William M. Brack21e4ef22005-01-02 09:53:13 +000030548#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030549 int mem_base;
30550 xmlChar * ret_val;
30551 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30552 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030553
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030554 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30555 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030556 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030557
30558 ret_val = xmlTextReaderPrefix(reader);
30559 desret_xmlChar_ptr(ret_val);
30560 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030561 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030562 xmlResetLastError();
30563 if (mem_base != xmlMemBlocks()) {
30564 printf("Leak of %d blocks found in xmlTextReaderPrefix",
30565 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030566 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030567 printf(" %d", n_reader);
30568 printf("\n");
30569 }
30570 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030571 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030572#endif
30573
Daniel Veillard42595322004-11-08 10:52:06 +000030574 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030575}
30576
30577
30578static int
30579test_xmlTextReaderPreserve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030580 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030581
William M. Brack21e4ef22005-01-02 09:53:13 +000030582#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030583 int mem_base;
30584 xmlNodePtr ret_val;
30585 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30586 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030587
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030588 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30589 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030590 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030591
30592 ret_val = xmlTextReaderPreserve(reader);
30593 desret_xmlNodePtr(ret_val);
30594 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030595 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030596 xmlResetLastError();
30597 if (mem_base != xmlMemBlocks()) {
30598 printf("Leak of %d blocks found in xmlTextReaderPreserve",
30599 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030600 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030601 printf(" %d", n_reader);
30602 printf("\n");
30603 }
30604 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030605 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030606#endif
30607
Daniel Veillard42595322004-11-08 10:52:06 +000030608 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030609}
30610
30611
30612static int
30613test_xmlTextReaderPreservePattern(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030614 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030615
William M. Brack21e4ef22005-01-02 09:53:13 +000030616#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_PATTERN_ENABLED)
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030617#ifdef LIBXML_PATTERN_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030618 int mem_base;
30619 int ret_val;
30620 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30621 int n_reader;
30622 xmlChar * pattern; /* an XPath subset pattern */
30623 int n_pattern;
30624 xmlChar ** namespaces; /* the prefix definitions, array of [URI, prefix] or NULL */
30625 int n_namespaces;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030626
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030627 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30628 for (n_pattern = 0;n_pattern < gen_nb_const_xmlChar_ptr;n_pattern++) {
30629 for (n_namespaces = 0;n_namespaces < gen_nb_const_xmlChar_ptr_ptr;n_namespaces++) {
30630 mem_base = xmlMemBlocks();
30631 reader = gen_xmlTextReaderPtr(n_reader, 0);
30632 pattern = gen_const_xmlChar_ptr(n_pattern, 1);
30633 namespaces = gen_const_xmlChar_ptr_ptr(n_namespaces, 2);
30634
William M. Brackf13f77f2004-11-12 16:03:48 +000030635 ret_val = xmlTextReaderPreservePattern(reader, (const xmlChar *)pattern, (const xmlChar **)namespaces);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030636 desret_int(ret_val);
30637 call_tests++;
30638 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000030639 des_const_xmlChar_ptr(n_pattern, (const xmlChar *)pattern, 1);
30640 des_const_xmlChar_ptr_ptr(n_namespaces, (const xmlChar **)namespaces, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030641 xmlResetLastError();
30642 if (mem_base != xmlMemBlocks()) {
30643 printf("Leak of %d blocks found in xmlTextReaderPreservePattern",
30644 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030645 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030646 printf(" %d", n_reader);
30647 printf(" %d", n_pattern);
30648 printf(" %d", n_namespaces);
30649 printf("\n");
30650 }
30651 }
30652 }
30653 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030654 function_tests++;
30655#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030656#endif
30657
Daniel Veillard42595322004-11-08 10:52:06 +000030658 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030659}
30660
30661
30662static int
30663test_xmlTextReaderQuoteChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030664 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030665
William M. Brack21e4ef22005-01-02 09:53:13 +000030666#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030667 int mem_base;
30668 int ret_val;
30669 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30670 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030671
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030672 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30673 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030674 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030675
30676 ret_val = xmlTextReaderQuoteChar(reader);
30677 desret_int(ret_val);
30678 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030679 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030680 xmlResetLastError();
30681 if (mem_base != xmlMemBlocks()) {
30682 printf("Leak of %d blocks found in xmlTextReaderQuoteChar",
30683 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030684 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030685 printf(" %d", n_reader);
30686 printf("\n");
30687 }
30688 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030689 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030690#endif
30691
Daniel Veillard42595322004-11-08 10:52:06 +000030692 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030693}
30694
30695
30696static int
30697test_xmlTextReaderRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030698 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030699
William M. Brack21e4ef22005-01-02 09:53:13 +000030700#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030701 int mem_base;
30702 int ret_val;
30703 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30704 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030705
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030706 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30707 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030708 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030709
30710 ret_val = xmlTextReaderRead(reader);
30711 desret_int(ret_val);
30712 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030713 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030714 xmlResetLastError();
30715 if (mem_base != xmlMemBlocks()) {
30716 printf("Leak of %d blocks found in xmlTextReaderRead",
30717 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030718 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030719 printf(" %d", n_reader);
30720 printf("\n");
30721 }
30722 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030723 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030724#endif
30725
Daniel Veillard42595322004-11-08 10:52:06 +000030726 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030727}
30728
30729
30730static int
30731test_xmlTextReaderReadAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030732 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030733
William M. Brack21e4ef22005-01-02 09:53:13 +000030734#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030735 int mem_base;
30736 int ret_val;
30737 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30738 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030739
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030740 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30741 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030742 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030743
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030744 ret_val = xmlTextReaderReadAttributeValue(reader);
30745 desret_int(ret_val);
30746 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030747 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030748 xmlResetLastError();
30749 if (mem_base != xmlMemBlocks()) {
30750 printf("Leak of %d blocks found in xmlTextReaderReadAttributeValue",
30751 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030752 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030753 printf(" %d", n_reader);
30754 printf("\n");
30755 }
30756 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030757 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030758#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000030759
Daniel Veillard42595322004-11-08 10:52:06 +000030760 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030761}
30762
30763
30764static int
30765test_xmlTextReaderReadState(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030766 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030767
William M. Brack21e4ef22005-01-02 09:53:13 +000030768#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030769 int mem_base;
30770 int ret_val;
30771 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30772 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030773
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030774 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30775 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030776 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030777
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030778 ret_val = xmlTextReaderReadState(reader);
30779 desret_int(ret_val);
30780 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030781 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030782 xmlResetLastError();
30783 if (mem_base != xmlMemBlocks()) {
30784 printf("Leak of %d blocks found in xmlTextReaderReadState",
30785 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030786 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030787 printf(" %d", n_reader);
30788 printf("\n");
30789 }
30790 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030791 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030792#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000030793
Daniel Veillard42595322004-11-08 10:52:06 +000030794 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030795}
30796
30797
30798static int
30799test_xmlTextReaderRelaxNGSetSchema(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030800 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030801
William M. Brack21e4ef22005-01-02 09:53:13 +000030802#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000030803 int mem_base;
30804 int ret_val;
30805 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30806 int n_reader;
30807 xmlRelaxNGPtr schema; /* a precompiled RelaxNG schema */
30808 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030809
Daniel Veillardce682bc2004-11-05 17:22:25 +000030810 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30811 for (n_schema = 0;n_schema < gen_nb_xmlRelaxNGPtr;n_schema++) {
30812 mem_base = xmlMemBlocks();
30813 reader = gen_xmlTextReaderPtr(n_reader, 0);
30814 schema = gen_xmlRelaxNGPtr(n_schema, 1);
30815
30816 ret_val = xmlTextReaderRelaxNGSetSchema(reader, schema);
30817 desret_int(ret_val);
30818 call_tests++;
30819 des_xmlTextReaderPtr(n_reader, reader, 0);
30820 des_xmlRelaxNGPtr(n_schema, schema, 1);
30821 xmlResetLastError();
30822 if (mem_base != xmlMemBlocks()) {
30823 printf("Leak of %d blocks found in xmlTextReaderRelaxNGSetSchema",
30824 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030825 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030826 printf(" %d", n_reader);
30827 printf(" %d", n_schema);
30828 printf("\n");
30829 }
30830 }
30831 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030832 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030833#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000030834
Daniel Veillard42595322004-11-08 10:52:06 +000030835 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030836}
30837
30838
30839static int
30840test_xmlTextReaderRelaxNGValidate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030841 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030842
William M. Brack21e4ef22005-01-02 09:53:13 +000030843#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030844 int mem_base;
30845 int ret_val;
30846 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30847 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030848 char * rng; /* the path to a RelaxNG schema or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030849 int n_rng;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030850
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030851 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30852 for (n_rng = 0;n_rng < gen_nb_const_char_ptr;n_rng++) {
30853 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030854 reader = gen_xmlTextReaderPtr(n_reader, 0);
30855 rng = gen_const_char_ptr(n_rng, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030856
William M. Brackf13f77f2004-11-12 16:03:48 +000030857 ret_val = xmlTextReaderRelaxNGValidate(reader, (const char *)rng);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030858 desret_int(ret_val);
30859 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030860 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000030861 des_const_char_ptr(n_rng, (const char *)rng, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030862 xmlResetLastError();
30863 if (mem_base != xmlMemBlocks()) {
30864 printf("Leak of %d blocks found in xmlTextReaderRelaxNGValidate",
30865 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030866 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030867 printf(" %d", n_reader);
30868 printf(" %d", n_rng);
30869 printf("\n");
30870 }
30871 }
30872 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030873 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030874#endif
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030875
Daniel Veillard42595322004-11-08 10:52:06 +000030876 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030877}
30878
30879
30880static int
30881test_xmlTextReaderSetErrorHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030882 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030883
30884
30885 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000030886 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030887}
30888
30889
30890static int
30891test_xmlTextReaderSetParserProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030892 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030893
William M. Brack21e4ef22005-01-02 09:53:13 +000030894#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030895 int mem_base;
30896 int ret_val;
30897 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30898 int n_reader;
30899 int prop; /* the xmlParserProperties to set */
30900 int n_prop;
30901 int value; /* usually 0 or 1 to (de)activate it */
30902 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030903
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030904 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30905 for (n_prop = 0;n_prop < gen_nb_int;n_prop++) {
30906 for (n_value = 0;n_value < gen_nb_int;n_value++) {
30907 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030908 reader = gen_xmlTextReaderPtr(n_reader, 0);
30909 prop = gen_int(n_prop, 1);
30910 value = gen_int(n_value, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030911
30912 ret_val = xmlTextReaderSetParserProp(reader, prop, value);
30913 desret_int(ret_val);
30914 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030915 des_xmlTextReaderPtr(n_reader, reader, 0);
30916 des_int(n_prop, prop, 1);
30917 des_int(n_value, value, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030918 xmlResetLastError();
30919 if (mem_base != xmlMemBlocks()) {
30920 printf("Leak of %d blocks found in xmlTextReaderSetParserProp",
30921 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030922 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030923 printf(" %d", n_reader);
30924 printf(" %d", n_prop);
30925 printf(" %d", n_value);
30926 printf("\n");
30927 }
30928 }
30929 }
30930 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030931 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030932#endif
30933
Daniel Veillard42595322004-11-08 10:52:06 +000030934 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030935}
30936
30937
30938static int
30939test_xmlTextReaderSetStructuredErrorHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030940 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030941
30942
30943 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000030944 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030945}
30946
30947
30948static int
30949test_xmlTextReaderStandalone(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030950 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030951
William M. Brack21e4ef22005-01-02 09:53:13 +000030952#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030953 int mem_base;
30954 int ret_val;
30955 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30956 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030957
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030958 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30959 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030960 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030961
30962 ret_val = xmlTextReaderStandalone(reader);
30963 desret_int(ret_val);
30964 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030965 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030966 xmlResetLastError();
30967 if (mem_base != xmlMemBlocks()) {
30968 printf("Leak of %d blocks found in xmlTextReaderStandalone",
30969 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030970 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030971 printf(" %d", n_reader);
30972 printf("\n");
30973 }
30974 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030975 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030976#endif
30977
Daniel Veillard42595322004-11-08 10:52:06 +000030978 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030979}
30980
30981
30982static int
30983test_xmlTextReaderValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030984 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030985
William M. Brack21e4ef22005-01-02 09:53:13 +000030986#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030987 int mem_base;
30988 xmlChar * ret_val;
30989 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30990 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030991
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030992 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30993 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030994 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030995
30996 ret_val = xmlTextReaderValue(reader);
30997 desret_xmlChar_ptr(ret_val);
30998 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030999 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031000 xmlResetLastError();
31001 if (mem_base != xmlMemBlocks()) {
31002 printf("Leak of %d blocks found in xmlTextReaderValue",
31003 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031004 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031005 printf(" %d", n_reader);
31006 printf("\n");
31007 }
31008 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031009 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031010#endif
31011
Daniel Veillard42595322004-11-08 10:52:06 +000031012 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031013}
31014
31015
31016static int
31017test_xmlTextReaderXmlLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031018 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031019
William M. Brack21e4ef22005-01-02 09:53:13 +000031020#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031021 int mem_base;
31022 xmlChar * ret_val;
31023 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
31024 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031025
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031026 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
31027 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000031028 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031029
31030 ret_val = xmlTextReaderXmlLang(reader);
31031 desret_xmlChar_ptr(ret_val);
31032 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000031033 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031034 xmlResetLastError();
31035 if (mem_base != xmlMemBlocks()) {
31036 printf("Leak of %d blocks found in xmlTextReaderXmlLang",
31037 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031038 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031039 printf(" %d", n_reader);
31040 printf("\n");
31041 }
31042 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031043 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000031044#endif
31045
Daniel Veillard42595322004-11-08 10:52:06 +000031046 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031047}
31048
31049static int
31050test_xmlreader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031051 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031052
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000031053 if (quiet == 0) printf("Testing xmlreader : 70 of 80 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000031054 test_ret += test_xmlNewTextReader();
31055 test_ret += test_xmlNewTextReaderFilename();
31056 test_ret += test_xmlReaderForDoc();
31057 test_ret += test_xmlReaderForFile();
31058 test_ret += test_xmlReaderForMemory();
31059 test_ret += test_xmlReaderNewDoc();
31060 test_ret += test_xmlReaderNewFile();
31061 test_ret += test_xmlReaderNewMemory();
31062 test_ret += test_xmlReaderNewWalker();
31063 test_ret += test_xmlReaderWalker();
31064 test_ret += test_xmlTextReaderAttributeCount();
31065 test_ret += test_xmlTextReaderBaseUri();
31066 test_ret += test_xmlTextReaderClose();
31067 test_ret += test_xmlTextReaderConstBaseUri();
31068 test_ret += test_xmlTextReaderConstEncoding();
31069 test_ret += test_xmlTextReaderConstLocalName();
31070 test_ret += test_xmlTextReaderConstName();
31071 test_ret += test_xmlTextReaderConstNamespaceUri();
31072 test_ret += test_xmlTextReaderConstPrefix();
31073 test_ret += test_xmlTextReaderConstString();
31074 test_ret += test_xmlTextReaderConstValue();
31075 test_ret += test_xmlTextReaderConstXmlLang();
31076 test_ret += test_xmlTextReaderConstXmlVersion();
31077 test_ret += test_xmlTextReaderCurrentDoc();
31078 test_ret += test_xmlTextReaderCurrentNode();
31079 test_ret += test_xmlTextReaderDepth();
31080 test_ret += test_xmlTextReaderExpand();
31081 test_ret += test_xmlTextReaderGetAttribute();
31082 test_ret += test_xmlTextReaderGetAttributeNo();
31083 test_ret += test_xmlTextReaderGetAttributeNs();
31084 test_ret += test_xmlTextReaderGetErrorHandler();
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000031085 test_ret += test_xmlTextReaderGetParserColumnNumber();
31086 test_ret += test_xmlTextReaderGetParserLineNumber();
Daniel Veillard42595322004-11-08 10:52:06 +000031087 test_ret += test_xmlTextReaderGetParserProp();
31088 test_ret += test_xmlTextReaderGetRemainder();
31089 test_ret += test_xmlTextReaderHasAttributes();
31090 test_ret += test_xmlTextReaderHasValue();
31091 test_ret += test_xmlTextReaderIsDefault();
31092 test_ret += test_xmlTextReaderIsEmptyElement();
31093 test_ret += test_xmlTextReaderIsNamespaceDecl();
31094 test_ret += test_xmlTextReaderIsValid();
31095 test_ret += test_xmlTextReaderLocalName();
31096 test_ret += test_xmlTextReaderLocatorBaseURI();
31097 test_ret += test_xmlTextReaderLocatorLineNumber();
31098 test_ret += test_xmlTextReaderLookupNamespace();
31099 test_ret += test_xmlTextReaderMoveToAttribute();
31100 test_ret += test_xmlTextReaderMoveToAttributeNo();
31101 test_ret += test_xmlTextReaderMoveToAttributeNs();
31102 test_ret += test_xmlTextReaderMoveToElement();
31103 test_ret += test_xmlTextReaderMoveToFirstAttribute();
31104 test_ret += test_xmlTextReaderMoveToNextAttribute();
31105 test_ret += test_xmlTextReaderName();
31106 test_ret += test_xmlTextReaderNamespaceUri();
31107 test_ret += test_xmlTextReaderNext();
31108 test_ret += test_xmlTextReaderNextSibling();
31109 test_ret += test_xmlTextReaderNodeType();
31110 test_ret += test_xmlTextReaderNormalization();
31111 test_ret += test_xmlTextReaderPrefix();
31112 test_ret += test_xmlTextReaderPreserve();
31113 test_ret += test_xmlTextReaderPreservePattern();
31114 test_ret += test_xmlTextReaderQuoteChar();
31115 test_ret += test_xmlTextReaderRead();
31116 test_ret += test_xmlTextReaderReadAttributeValue();
31117 test_ret += test_xmlTextReaderReadState();
31118 test_ret += test_xmlTextReaderRelaxNGSetSchema();
31119 test_ret += test_xmlTextReaderRelaxNGValidate();
31120 test_ret += test_xmlTextReaderSetErrorHandler();
31121 test_ret += test_xmlTextReaderSetParserProp();
31122 test_ret += test_xmlTextReaderSetStructuredErrorHandler();
31123 test_ret += test_xmlTextReaderStandalone();
31124 test_ret += test_xmlTextReaderValue();
31125 test_ret += test_xmlTextReaderXmlLang();
Daniel Veillardd93f6252004-11-02 15:53:51 +000031126
Daniel Veillard42595322004-11-08 10:52:06 +000031127 if (test_ret != 0)
31128 printf("Module xmlreader: %d errors\n", test_ret);
31129 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031130}
Daniel Veillarda521d282004-11-09 14:59:59 +000031131#ifdef LIBXML_REGEXP_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000031132
Daniel Veillarda82b1822004-11-08 16:24:57 +000031133#define gen_nb_xmlRegExecCtxtPtr 1
31134static xmlRegExecCtxtPtr gen_xmlRegExecCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31135 return(NULL);
31136}
31137static void des_xmlRegExecCtxtPtr(int no ATTRIBUTE_UNUSED, xmlRegExecCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31138}
Daniel Veillarda521d282004-11-09 14:59:59 +000031139#endif
31140
Daniel Veillarda82b1822004-11-08 16:24:57 +000031141
31142static int
31143test_xmlRegExecPushString(void) {
31144 int test_ret = 0;
31145
William M. Brack21e4ef22005-01-02 09:53:13 +000031146#if defined(LIBXML_REGEXP_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000031147 int mem_base;
31148 int ret_val;
31149 xmlRegExecCtxtPtr exec; /* a regexp execution context or NULL to indicate the end */
31150 int n_exec;
31151 xmlChar * value; /* a string token input */
31152 int n_value;
31153 void * data; /* data associated to the token to reuse in callbacks */
31154 int n_data;
31155
31156 for (n_exec = 0;n_exec < gen_nb_xmlRegExecCtxtPtr;n_exec++) {
31157 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
31158 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
31159 mem_base = xmlMemBlocks();
31160 exec = gen_xmlRegExecCtxtPtr(n_exec, 0);
31161 value = gen_const_xmlChar_ptr(n_value, 1);
31162 data = gen_userdata(n_data, 2);
31163
William M. Brackf13f77f2004-11-12 16:03:48 +000031164 ret_val = xmlRegExecPushString(exec, (const xmlChar *)value, data);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031165 desret_int(ret_val);
31166 call_tests++;
31167 des_xmlRegExecCtxtPtr(n_exec, exec, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000031168 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031169 des_userdata(n_data, data, 2);
31170 xmlResetLastError();
31171 if (mem_base != xmlMemBlocks()) {
31172 printf("Leak of %d blocks found in xmlRegExecPushString",
31173 xmlMemBlocks() - mem_base);
31174 test_ret++;
31175 printf(" %d", n_exec);
31176 printf(" %d", n_value);
31177 printf(" %d", n_data);
31178 printf("\n");
31179 }
31180 }
31181 }
31182 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031183 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031184#endif
31185
Daniel Veillarda82b1822004-11-08 16:24:57 +000031186 return(test_ret);
31187}
31188
31189
31190static int
31191test_xmlRegExecPushString2(void) {
31192 int test_ret = 0;
31193
William M. Brack21e4ef22005-01-02 09:53:13 +000031194#if defined(LIBXML_REGEXP_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000031195 int mem_base;
31196 int ret_val;
31197 xmlRegExecCtxtPtr exec; /* a regexp execution context or NULL to indicate the end */
31198 int n_exec;
31199 xmlChar * value; /* the first string token input */
31200 int n_value;
31201 xmlChar * value2; /* the second string token input */
31202 int n_value2;
31203 void * data; /* data associated to the token to reuse in callbacks */
31204 int n_data;
31205
31206 for (n_exec = 0;n_exec < gen_nb_xmlRegExecCtxtPtr;n_exec++) {
31207 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
31208 for (n_value2 = 0;n_value2 < gen_nb_const_xmlChar_ptr;n_value2++) {
31209 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
31210 mem_base = xmlMemBlocks();
31211 exec = gen_xmlRegExecCtxtPtr(n_exec, 0);
31212 value = gen_const_xmlChar_ptr(n_value, 1);
31213 value2 = gen_const_xmlChar_ptr(n_value2, 2);
31214 data = gen_userdata(n_data, 3);
31215
William M. Brackf13f77f2004-11-12 16:03:48 +000031216 ret_val = xmlRegExecPushString2(exec, (const xmlChar *)value, (const xmlChar *)value2, data);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031217 desret_int(ret_val);
31218 call_tests++;
31219 des_xmlRegExecCtxtPtr(n_exec, exec, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000031220 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
31221 des_const_xmlChar_ptr(n_value2, (const xmlChar *)value2, 2);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031222 des_userdata(n_data, data, 3);
31223 xmlResetLastError();
31224 if (mem_base != xmlMemBlocks()) {
31225 printf("Leak of %d blocks found in xmlRegExecPushString2",
31226 xmlMemBlocks() - mem_base);
31227 test_ret++;
31228 printf(" %d", n_exec);
31229 printf(" %d", n_value);
31230 printf(" %d", n_value2);
31231 printf(" %d", n_data);
31232 printf("\n");
31233 }
31234 }
31235 }
31236 }
31237 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031238 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031239#endif
31240
Daniel Veillarda82b1822004-11-08 16:24:57 +000031241 return(test_ret);
31242}
31243
Daniel Veillarda521d282004-11-09 14:59:59 +000031244#ifdef LIBXML_REGEXP_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +000031245
31246#define gen_nb_xmlRegexpPtr 1
31247static xmlRegexpPtr gen_xmlRegexpPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31248 return(NULL);
31249}
31250static void des_xmlRegexpPtr(int no ATTRIBUTE_UNUSED, xmlRegexpPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31251}
Daniel Veillarda521d282004-11-09 14:59:59 +000031252#endif
31253
Daniel Veillarda82b1822004-11-08 16:24:57 +000031254
31255static int
31256test_xmlRegNewExecCtxt(void) {
31257 int test_ret = 0;
31258
31259
31260 /* missing type support */
31261 return(test_ret);
31262}
31263
31264
31265static int
31266test_xmlRegexpCompile(void) {
31267 int test_ret = 0;
31268
31269
31270 /* missing type support */
31271 return(test_ret);
31272}
31273
31274
31275static int
31276test_xmlRegexpExec(void) {
31277 int test_ret = 0;
31278
William M. Brack21e4ef22005-01-02 09:53:13 +000031279#if defined(LIBXML_REGEXP_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000031280 int mem_base;
31281 int ret_val;
31282 xmlRegexpPtr comp; /* the compiled regular expression */
31283 int n_comp;
31284 xmlChar * content; /* the value to check against the regular expression */
31285 int n_content;
31286
31287 for (n_comp = 0;n_comp < gen_nb_xmlRegexpPtr;n_comp++) {
31288 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
31289 mem_base = xmlMemBlocks();
31290 comp = gen_xmlRegexpPtr(n_comp, 0);
31291 content = gen_const_xmlChar_ptr(n_content, 1);
31292
William M. Brackf13f77f2004-11-12 16:03:48 +000031293 ret_val = xmlRegexpExec(comp, (const xmlChar *)content);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031294 desret_int(ret_val);
31295 call_tests++;
31296 des_xmlRegexpPtr(n_comp, comp, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000031297 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031298 xmlResetLastError();
31299 if (mem_base != xmlMemBlocks()) {
31300 printf("Leak of %d blocks found in xmlRegexpExec",
31301 xmlMemBlocks() - mem_base);
31302 test_ret++;
31303 printf(" %d", n_comp);
31304 printf(" %d", n_content);
31305 printf("\n");
31306 }
31307 }
31308 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031309 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031310#endif
31311
Daniel Veillarda82b1822004-11-08 16:24:57 +000031312 return(test_ret);
31313}
31314
31315
31316static int
31317test_xmlRegexpIsDeterminist(void) {
31318 int test_ret = 0;
31319
William M. Brack21e4ef22005-01-02 09:53:13 +000031320#if defined(LIBXML_REGEXP_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000031321 int mem_base;
31322 int ret_val;
31323 xmlRegexpPtr comp; /* the compiled regular expression */
31324 int n_comp;
31325
31326 for (n_comp = 0;n_comp < gen_nb_xmlRegexpPtr;n_comp++) {
31327 mem_base = xmlMemBlocks();
31328 comp = gen_xmlRegexpPtr(n_comp, 0);
31329
31330 ret_val = xmlRegexpIsDeterminist(comp);
31331 desret_int(ret_val);
31332 call_tests++;
31333 des_xmlRegexpPtr(n_comp, comp, 0);
31334 xmlResetLastError();
31335 if (mem_base != xmlMemBlocks()) {
31336 printf("Leak of %d blocks found in xmlRegexpIsDeterminist",
31337 xmlMemBlocks() - mem_base);
31338 test_ret++;
31339 printf(" %d", n_comp);
31340 printf("\n");
31341 }
31342 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031343 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031344#endif
31345
Daniel Veillarda82b1822004-11-08 16:24:57 +000031346 return(test_ret);
31347}
31348
31349
31350static int
31351test_xmlRegexpPrint(void) {
31352 int test_ret = 0;
31353
William M. Brack21e4ef22005-01-02 09:53:13 +000031354#if defined(LIBXML_REGEXP_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000031355 int mem_base;
31356 FILE * output; /* the file for the output debug */
31357 int n_output;
31358 xmlRegexpPtr regexp; /* the compiled regexp */
31359 int n_regexp;
31360
31361 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
31362 for (n_regexp = 0;n_regexp < gen_nb_xmlRegexpPtr;n_regexp++) {
31363 mem_base = xmlMemBlocks();
31364 output = gen_FILE_ptr(n_output, 0);
31365 regexp = gen_xmlRegexpPtr(n_regexp, 1);
31366
31367 xmlRegexpPrint(output, regexp);
31368 call_tests++;
31369 des_FILE_ptr(n_output, output, 0);
31370 des_xmlRegexpPtr(n_regexp, regexp, 1);
31371 xmlResetLastError();
31372 if (mem_base != xmlMemBlocks()) {
31373 printf("Leak of %d blocks found in xmlRegexpPrint",
31374 xmlMemBlocks() - mem_base);
31375 test_ret++;
31376 printf(" %d", n_output);
31377 printf(" %d", n_regexp);
31378 printf("\n");
31379 }
31380 }
31381 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031382 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031383#endif
31384
Daniel Veillarda82b1822004-11-08 16:24:57 +000031385 return(test_ret);
31386}
31387
31388static int
31389test_xmlregexp(void) {
31390 int test_ret = 0;
31391
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031392 if (quiet == 0) printf("Testing xmlregexp : 5 of 9 functions ...\n");
Daniel Veillarda82b1822004-11-08 16:24:57 +000031393 test_ret += test_xmlRegExecPushString();
31394 test_ret += test_xmlRegExecPushString2();
31395 test_ret += test_xmlRegNewExecCtxt();
31396 test_ret += test_xmlRegexpCompile();
31397 test_ret += test_xmlRegexpExec();
31398 test_ret += test_xmlRegexpIsDeterminist();
31399 test_ret += test_xmlRegexpPrint();
31400
31401 if (test_ret != 0)
31402 printf("Module xmlregexp: %d errors\n", test_ret);
31403 return(test_ret);
31404}
Daniel Veillarda521d282004-11-09 14:59:59 +000031405#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +000031406
Daniel Veillardce682bc2004-11-05 17:22:25 +000031407#define gen_nb_xmlSaveCtxtPtr 1
31408static xmlSaveCtxtPtr gen_xmlSaveCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31409 return(NULL);
31410}
31411static void des_xmlSaveCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSaveCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31412}
Daniel Veillarda521d282004-11-09 14:59:59 +000031413#endif
31414
Daniel Veillardce682bc2004-11-05 17:22:25 +000031415
Daniel Veillardd93f6252004-11-02 15:53:51 +000031416static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000031417test_xmlSaveClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031418 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031419
William M. Brack21e4ef22005-01-02 09:53:13 +000031420#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000031421 int mem_base;
31422 int ret_val;
31423 xmlSaveCtxtPtr ctxt; /* a document saving context */
31424 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031425
Daniel Veillardce682bc2004-11-05 17:22:25 +000031426 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
31427 mem_base = xmlMemBlocks();
31428 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
31429
31430 ret_val = xmlSaveClose(ctxt);
31431 desret_int(ret_val);
31432 call_tests++;
31433 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
31434 xmlResetLastError();
31435 if (mem_base != xmlMemBlocks()) {
31436 printf("Leak of %d blocks found in xmlSaveClose",
31437 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031438 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031439 printf(" %d", n_ctxt);
31440 printf("\n");
31441 }
31442 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031443 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031444#endif
31445
Daniel Veillard42595322004-11-08 10:52:06 +000031446 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031447}
31448
31449
31450static int
31451test_xmlSaveDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031452 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031453
William M. Brack21e4ef22005-01-02 09:53:13 +000031454#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000031455 int mem_base;
31456 long ret_val;
31457 xmlSaveCtxtPtr ctxt; /* a document saving context */
31458 int n_ctxt;
31459 xmlDocPtr doc; /* a document */
31460 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031461
Daniel Veillardce682bc2004-11-05 17:22:25 +000031462 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
31463 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
31464 mem_base = xmlMemBlocks();
31465 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
31466 doc = gen_xmlDocPtr(n_doc, 1);
31467
31468 ret_val = xmlSaveDoc(ctxt, doc);
31469 desret_long(ret_val);
31470 call_tests++;
31471 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
31472 des_xmlDocPtr(n_doc, doc, 1);
31473 xmlResetLastError();
31474 if (mem_base != xmlMemBlocks()) {
31475 printf("Leak of %d blocks found in xmlSaveDoc",
31476 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031477 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031478 printf(" %d", n_ctxt);
31479 printf(" %d", n_doc);
31480 printf("\n");
31481 }
31482 }
31483 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031484 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031485#endif
31486
Daniel Veillard42595322004-11-08 10:52:06 +000031487 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031488}
31489
31490
31491static int
31492test_xmlSaveFlush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031493 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031494
William M. Brack21e4ef22005-01-02 09:53:13 +000031495#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000031496 int mem_base;
31497 int ret_val;
31498 xmlSaveCtxtPtr ctxt; /* a document saving context */
31499 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031500
Daniel Veillardce682bc2004-11-05 17:22:25 +000031501 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
31502 mem_base = xmlMemBlocks();
31503 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
31504
31505 ret_val = xmlSaveFlush(ctxt);
31506 desret_int(ret_val);
31507 call_tests++;
31508 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
31509 xmlResetLastError();
31510 if (mem_base != xmlMemBlocks()) {
31511 printf("Leak of %d blocks found in xmlSaveFlush",
31512 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031513 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031514 printf(" %d", n_ctxt);
31515 printf("\n");
31516 }
31517 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031518 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031519#endif
31520
Daniel Veillard42595322004-11-08 10:52:06 +000031521 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031522}
31523
31524
31525static int
31526test_xmlSaveSetAttrEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031527 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031528
31529
31530 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031531 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031532}
31533
31534
31535static int
31536test_xmlSaveSetEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031537 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031538
31539
31540 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031541 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031542}
31543
31544
31545static int
31546test_xmlSaveToFd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031547 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031548
31549
31550 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031551 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031552}
31553
31554
31555static int
31556test_xmlSaveToFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031557 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031558
31559
31560 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031561 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031562}
31563
31564
31565static int
31566test_xmlSaveTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031567 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031568
William M. Brack21e4ef22005-01-02 09:53:13 +000031569#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000031570 int mem_base;
31571 long ret_val;
31572 xmlSaveCtxtPtr ctxt; /* a document saving context */
31573 int n_ctxt;
31574 xmlNodePtr node; /* a document */
31575 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031576
Daniel Veillardce682bc2004-11-05 17:22:25 +000031577 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
31578 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
31579 mem_base = xmlMemBlocks();
31580 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
31581 node = gen_xmlNodePtr(n_node, 1);
31582
31583 ret_val = xmlSaveTree(ctxt, node);
31584 desret_long(ret_val);
31585 call_tests++;
31586 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
31587 des_xmlNodePtr(n_node, node, 1);
31588 xmlResetLastError();
31589 if (mem_base != xmlMemBlocks()) {
31590 printf("Leak of %d blocks found in xmlSaveTree",
31591 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031592 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031593 printf(" %d", n_ctxt);
31594 printf(" %d", n_node);
31595 printf("\n");
31596 }
31597 }
31598 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031599 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031600#endif
31601
Daniel Veillard42595322004-11-08 10:52:06 +000031602 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031603}
31604
31605static int
31606test_xmlsave(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031607 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031608
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031609 if (quiet == 0) printf("Testing xmlsave : 4 of 9 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000031610 test_ret += test_xmlSaveClose();
31611 test_ret += test_xmlSaveDoc();
31612 test_ret += test_xmlSaveFlush();
31613 test_ret += test_xmlSaveSetAttrEscape();
31614 test_ret += test_xmlSaveSetEscape();
31615 test_ret += test_xmlSaveToFd();
31616 test_ret += test_xmlSaveToFilename();
31617 test_ret += test_xmlSaveTree();
Daniel Veillardd93f6252004-11-02 15:53:51 +000031618
Daniel Veillard42595322004-11-08 10:52:06 +000031619 if (test_ret != 0)
31620 printf("Module xmlsave: %d errors\n", test_ret);
31621 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031622}
Daniel Veillarda521d282004-11-09 14:59:59 +000031623#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000031624
Daniel Veillardce682bc2004-11-05 17:22:25 +000031625#define gen_nb_xmlSchemaPtr 1
31626static xmlSchemaPtr gen_xmlSchemaPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31627 return(NULL);
31628}
31629static void des_xmlSchemaPtr(int no ATTRIBUTE_UNUSED, xmlSchemaPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31630}
Daniel Veillarda521d282004-11-09 14:59:59 +000031631#endif
31632
Daniel Veillardce682bc2004-11-05 17:22:25 +000031633
Daniel Veillardd93f6252004-11-02 15:53:51 +000031634static int
31635test_xmlSchemaDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031636 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031637
William M. Brack21e4ef22005-01-02 09:53:13 +000031638#if defined(LIBXML_SCHEMAS_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000031639 int mem_base;
31640 FILE * output; /* the file output */
31641 int n_output;
31642 xmlSchemaPtr schema; /* a schema structure */
31643 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031644
Daniel Veillardce682bc2004-11-05 17:22:25 +000031645 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
31646 for (n_schema = 0;n_schema < gen_nb_xmlSchemaPtr;n_schema++) {
31647 mem_base = xmlMemBlocks();
31648 output = gen_FILE_ptr(n_output, 0);
31649 schema = gen_xmlSchemaPtr(n_schema, 1);
31650
31651 xmlSchemaDump(output, schema);
31652 call_tests++;
31653 des_FILE_ptr(n_output, output, 0);
31654 des_xmlSchemaPtr(n_schema, schema, 1);
31655 xmlResetLastError();
31656 if (mem_base != xmlMemBlocks()) {
31657 printf("Leak of %d blocks found in xmlSchemaDump",
31658 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031659 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031660 printf(" %d", n_output);
31661 printf(" %d", n_schema);
31662 printf("\n");
31663 }
31664 }
31665 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031666 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031667#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000031668
Daniel Veillard42595322004-11-08 10:52:06 +000031669 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031670}
31671
Daniel Veillarda521d282004-11-09 14:59:59 +000031672#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000031673
Daniel Veillardce682bc2004-11-05 17:22:25 +000031674#define gen_nb_xmlSchemaParserCtxtPtr 1
31675static xmlSchemaParserCtxtPtr gen_xmlSchemaParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31676 return(NULL);
31677}
31678static void des_xmlSchemaParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSchemaParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31679}
Daniel Veillarda521d282004-11-09 14:59:59 +000031680#endif
31681
31682#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000031683
31684#define gen_nb_xmlSchemaValidityErrorFunc_ptr 1
31685static xmlSchemaValidityErrorFunc * gen_xmlSchemaValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31686 return(NULL);
31687}
31688static void des_xmlSchemaValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlSchemaValidityErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31689}
Daniel Veillarda521d282004-11-09 14:59:59 +000031690#endif
31691
31692#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000031693
31694#define gen_nb_xmlSchemaValidityWarningFunc_ptr 1
31695static xmlSchemaValidityWarningFunc * gen_xmlSchemaValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31696 return(NULL);
31697}
31698static void des_xmlSchemaValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, xmlSchemaValidityWarningFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31699}
Daniel Veillarda521d282004-11-09 14:59:59 +000031700#endif
31701
Daniel Veillardce682bc2004-11-05 17:22:25 +000031702
Daniel Veillardd93f6252004-11-02 15:53:51 +000031703static int
31704test_xmlSchemaGetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031705 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031706
William M. Brack21e4ef22005-01-02 09:53:13 +000031707#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031708 int mem_base;
31709 int ret_val;
31710 xmlSchemaParserCtxtPtr ctxt; /* a XMl-Schema parser context */
31711 int n_ctxt;
31712 xmlSchemaValidityErrorFunc * err; /* the error callback result */
31713 int n_err;
31714 xmlSchemaValidityWarningFunc * warn; /* the warning callback result */
31715 int n_warn;
31716 void ** ctx; /* contextual data for the callbacks result */
31717 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031718
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031719 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaParserCtxtPtr;n_ctxt++) {
31720 for (n_err = 0;n_err < gen_nb_xmlSchemaValidityErrorFunc_ptr;n_err++) {
31721 for (n_warn = 0;n_warn < gen_nb_xmlSchemaValidityWarningFunc_ptr;n_warn++) {
31722 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
31723 mem_base = xmlMemBlocks();
31724 ctxt = gen_xmlSchemaParserCtxtPtr(n_ctxt, 0);
31725 err = gen_xmlSchemaValidityErrorFunc_ptr(n_err, 1);
31726 warn = gen_xmlSchemaValidityWarningFunc_ptr(n_warn, 2);
31727 ctx = gen_void_ptr_ptr(n_ctx, 3);
31728
31729 ret_val = xmlSchemaGetParserErrors(ctxt, err, warn, ctx);
31730 desret_int(ret_val);
31731 call_tests++;
31732 des_xmlSchemaParserCtxtPtr(n_ctxt, ctxt, 0);
31733 des_xmlSchemaValidityErrorFunc_ptr(n_err, err, 1);
31734 des_xmlSchemaValidityWarningFunc_ptr(n_warn, warn, 2);
31735 des_void_ptr_ptr(n_ctx, ctx, 3);
31736 xmlResetLastError();
31737 if (mem_base != xmlMemBlocks()) {
31738 printf("Leak of %d blocks found in xmlSchemaGetParserErrors",
31739 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031740 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031741 printf(" %d", n_ctxt);
31742 printf(" %d", n_err);
31743 printf(" %d", n_warn);
31744 printf(" %d", n_ctx);
31745 printf("\n");
31746 }
31747 }
31748 }
31749 }
31750 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031751 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031752#endif
31753
Daniel Veillard42595322004-11-08 10:52:06 +000031754 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031755}
31756
Daniel Veillarda521d282004-11-09 14:59:59 +000031757#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000031758
Daniel Veillardce682bc2004-11-05 17:22:25 +000031759#define gen_nb_xmlSchemaValidCtxtPtr 1
31760static xmlSchemaValidCtxtPtr gen_xmlSchemaValidCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31761 return(NULL);
31762}
31763static void des_xmlSchemaValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSchemaValidCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31764}
Daniel Veillarda521d282004-11-09 14:59:59 +000031765#endif
31766
Daniel Veillardce682bc2004-11-05 17:22:25 +000031767
Daniel Veillardd93f6252004-11-02 15:53:51 +000031768static int
31769test_xmlSchemaGetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031770 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031771
William M. Brack21e4ef22005-01-02 09:53:13 +000031772#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031773 int mem_base;
31774 int ret_val;
31775 xmlSchemaValidCtxtPtr ctxt; /* a XML-Schema validation context */
31776 int n_ctxt;
31777 xmlSchemaValidityErrorFunc * err; /* the error function result */
31778 int n_err;
31779 xmlSchemaValidityWarningFunc * warn; /* the warning function result */
31780 int n_warn;
31781 void ** ctx; /* the functions context result */
31782 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031783
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031784 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
31785 for (n_err = 0;n_err < gen_nb_xmlSchemaValidityErrorFunc_ptr;n_err++) {
31786 for (n_warn = 0;n_warn < gen_nb_xmlSchemaValidityWarningFunc_ptr;n_warn++) {
31787 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
31788 mem_base = xmlMemBlocks();
31789 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
31790 err = gen_xmlSchemaValidityErrorFunc_ptr(n_err, 1);
31791 warn = gen_xmlSchemaValidityWarningFunc_ptr(n_warn, 2);
31792 ctx = gen_void_ptr_ptr(n_ctx, 3);
31793
31794 ret_val = xmlSchemaGetValidErrors(ctxt, err, warn, ctx);
31795 desret_int(ret_val);
31796 call_tests++;
31797 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
31798 des_xmlSchemaValidityErrorFunc_ptr(n_err, err, 1);
31799 des_xmlSchemaValidityWarningFunc_ptr(n_warn, warn, 2);
31800 des_void_ptr_ptr(n_ctx, ctx, 3);
31801 xmlResetLastError();
31802 if (mem_base != xmlMemBlocks()) {
31803 printf("Leak of %d blocks found in xmlSchemaGetValidErrors",
31804 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031805 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031806 printf(" %d", n_ctxt);
31807 printf(" %d", n_err);
31808 printf(" %d", n_warn);
31809 printf(" %d", n_ctx);
31810 printf("\n");
31811 }
31812 }
31813 }
31814 }
31815 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031816 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031817#endif
31818
Daniel Veillard42595322004-11-08 10:52:06 +000031819 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031820}
31821
31822
31823static int
31824test_xmlSchemaNewDocParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031825 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031826
William M. Brack21e4ef22005-01-02 09:53:13 +000031827#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000031828 int mem_base;
31829 xmlSchemaParserCtxtPtr ret_val;
31830 xmlDocPtr doc; /* a preparsed document tree */
31831 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031832
Daniel Veillard42595322004-11-08 10:52:06 +000031833 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
31834 mem_base = xmlMemBlocks();
31835 doc = gen_xmlDocPtr(n_doc, 0);
31836
31837 ret_val = xmlSchemaNewDocParserCtxt(doc);
31838 desret_xmlSchemaParserCtxtPtr(ret_val);
31839 call_tests++;
31840 des_xmlDocPtr(n_doc, doc, 0);
31841 xmlResetLastError();
31842 if (mem_base != xmlMemBlocks()) {
31843 printf("Leak of %d blocks found in xmlSchemaNewDocParserCtxt",
31844 xmlMemBlocks() - mem_base);
31845 test_ret++;
31846 printf(" %d", n_doc);
31847 printf("\n");
31848 }
31849 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031850 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031851#endif
31852
Daniel Veillard42595322004-11-08 10:52:06 +000031853 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031854}
31855
31856
31857static int
31858test_xmlSchemaNewMemParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031859 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031860
William M. Brack21e4ef22005-01-02 09:53:13 +000031861#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000031862 int mem_base;
31863 xmlSchemaParserCtxtPtr ret_val;
31864 char * buffer; /* a pointer to a char array containing the schemas */
31865 int n_buffer;
31866 int size; /* the size of the array */
31867 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031868
Daniel Veillard42595322004-11-08 10:52:06 +000031869 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
31870 for (n_size = 0;n_size < gen_nb_int;n_size++) {
31871 mem_base = xmlMemBlocks();
31872 buffer = gen_const_char_ptr(n_buffer, 0);
31873 size = gen_int(n_size, 1);
31874
William M. Brackf13f77f2004-11-12 16:03:48 +000031875 ret_val = xmlSchemaNewMemParserCtxt((const char *)buffer, size);
Daniel Veillard42595322004-11-08 10:52:06 +000031876 desret_xmlSchemaParserCtxtPtr(ret_val);
31877 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000031878 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard42595322004-11-08 10:52:06 +000031879 des_int(n_size, size, 1);
31880 xmlResetLastError();
31881 if (mem_base != xmlMemBlocks()) {
31882 printf("Leak of %d blocks found in xmlSchemaNewMemParserCtxt",
31883 xmlMemBlocks() - mem_base);
31884 test_ret++;
31885 printf(" %d", n_buffer);
31886 printf(" %d", n_size);
31887 printf("\n");
31888 }
31889 }
31890 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031891 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031892#endif
31893
Daniel Veillard42595322004-11-08 10:52:06 +000031894 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031895}
31896
31897
31898static int
31899test_xmlSchemaNewParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031900 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031901
William M. Brack21e4ef22005-01-02 09:53:13 +000031902#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000031903 int mem_base;
31904 xmlSchemaParserCtxtPtr ret_val;
31905 char * URL; /* the location of the schema */
31906 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031907
Daniel Veillard42595322004-11-08 10:52:06 +000031908 for (n_URL = 0;n_URL < gen_nb_const_char_ptr;n_URL++) {
31909 mem_base = xmlMemBlocks();
31910 URL = gen_const_char_ptr(n_URL, 0);
31911
William M. Brackf13f77f2004-11-12 16:03:48 +000031912 ret_val = xmlSchemaNewParserCtxt((const char *)URL);
Daniel Veillard42595322004-11-08 10:52:06 +000031913 desret_xmlSchemaParserCtxtPtr(ret_val);
31914 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000031915 des_const_char_ptr(n_URL, (const char *)URL, 0);
Daniel Veillard42595322004-11-08 10:52:06 +000031916 xmlResetLastError();
31917 if (mem_base != xmlMemBlocks()) {
31918 printf("Leak of %d blocks found in xmlSchemaNewParserCtxt",
31919 xmlMemBlocks() - mem_base);
31920 test_ret++;
31921 printf(" %d", n_URL);
31922 printf("\n");
31923 }
31924 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031925 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031926#endif
31927
Daniel Veillard42595322004-11-08 10:52:06 +000031928 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031929}
31930
31931
31932static int
31933test_xmlSchemaNewValidCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031934 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031935
31936
31937 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031938 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031939}
31940
31941
31942static int
31943test_xmlSchemaParse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031944 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031945
31946
31947 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031948 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031949}
31950
31951
31952static int
31953test_xmlSchemaSetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031954 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031955
31956
31957 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031958 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031959}
31960
31961
31962static int
31963test_xmlSchemaSetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031964 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031965
31966
31967 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031968 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031969}
31970
31971
31972static int
31973test_xmlSchemaSetValidOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031974 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031975
William M. Brack21e4ef22005-01-02 09:53:13 +000031976#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000031977 int mem_base;
31978 int ret_val;
31979 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
31980 int n_ctxt;
31981 int options; /* a combination of xmlSchemaValidOption */
31982 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031983
Daniel Veillardce682bc2004-11-05 17:22:25 +000031984 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
31985 for (n_options = 0;n_options < gen_nb_int;n_options++) {
31986 mem_base = xmlMemBlocks();
31987 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
31988 options = gen_int(n_options, 1);
31989
31990 ret_val = xmlSchemaSetValidOptions(ctxt, options);
31991 desret_int(ret_val);
31992 call_tests++;
31993 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
31994 des_int(n_options, options, 1);
31995 xmlResetLastError();
31996 if (mem_base != xmlMemBlocks()) {
31997 printf("Leak of %d blocks found in xmlSchemaSetValidOptions",
31998 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031999 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032000 printf(" %d", n_ctxt);
32001 printf(" %d", n_options);
32002 printf("\n");
32003 }
32004 }
32005 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032006 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032007#endif
32008
Daniel Veillard42595322004-11-08 10:52:06 +000032009 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032010}
32011
32012
32013static int
32014test_xmlSchemaValidCtxtGetOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032015 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032016
William M. Brack21e4ef22005-01-02 09:53:13 +000032017#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032018 int mem_base;
32019 int ret_val;
32020 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
32021 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032022
Daniel Veillardce682bc2004-11-05 17:22:25 +000032023 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
32024 mem_base = xmlMemBlocks();
32025 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
32026
32027 ret_val = xmlSchemaValidCtxtGetOptions(ctxt);
32028 desret_int(ret_val);
32029 call_tests++;
32030 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
32031 xmlResetLastError();
32032 if (mem_base != xmlMemBlocks()) {
32033 printf("Leak of %d blocks found in xmlSchemaValidCtxtGetOptions",
32034 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032035 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032036 printf(" %d", n_ctxt);
32037 printf("\n");
32038 }
32039 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032040 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032041#endif
32042
Daniel Veillard42595322004-11-08 10:52:06 +000032043 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032044}
32045
32046
32047static int
32048test_xmlSchemaValidateDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032049 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032050
William M. Brack21e4ef22005-01-02 09:53:13 +000032051#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032052 int mem_base;
32053 int ret_val;
32054 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
32055 int n_ctxt;
32056 xmlDocPtr doc; /* a parsed document tree */
32057 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032058
Daniel Veillardce682bc2004-11-05 17:22:25 +000032059 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
32060 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
32061 mem_base = xmlMemBlocks();
32062 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
32063 doc = gen_xmlDocPtr(n_doc, 1);
32064
32065 ret_val = xmlSchemaValidateDoc(ctxt, doc);
32066 desret_int(ret_val);
32067 call_tests++;
32068 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
32069 des_xmlDocPtr(n_doc, doc, 1);
32070 xmlResetLastError();
32071 if (mem_base != xmlMemBlocks()) {
32072 printf("Leak of %d blocks found in xmlSchemaValidateDoc",
32073 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032074 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032075 printf(" %d", n_ctxt);
32076 printf(" %d", n_doc);
32077 printf("\n");
32078 }
32079 }
32080 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032081 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032082#endif
32083
Daniel Veillard42595322004-11-08 10:52:06 +000032084 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032085}
32086
32087
32088static int
32089test_xmlSchemaValidateOneElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032090 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032091
William M. Brack21e4ef22005-01-02 09:53:13 +000032092#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032093 int mem_base;
32094 int ret_val;
32095 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
32096 int n_ctxt;
32097 xmlNodePtr elem; /* an element node */
32098 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032099
Daniel Veillardce682bc2004-11-05 17:22:25 +000032100 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
32101 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
32102 mem_base = xmlMemBlocks();
32103 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
32104 elem = gen_xmlNodePtr(n_elem, 1);
32105
32106 ret_val = xmlSchemaValidateOneElement(ctxt, elem);
32107 desret_int(ret_val);
32108 call_tests++;
32109 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
32110 des_xmlNodePtr(n_elem, elem, 1);
32111 xmlResetLastError();
32112 if (mem_base != xmlMemBlocks()) {
32113 printf("Leak of %d blocks found in xmlSchemaValidateOneElement",
32114 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032115 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032116 printf(" %d", n_ctxt);
32117 printf(" %d", n_elem);
32118 printf("\n");
32119 }
32120 }
32121 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032122 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032123#endif
32124
Daniel Veillard42595322004-11-08 10:52:06 +000032125 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032126}
32127
32128
32129static int
32130test_xmlSchemaValidateStream(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032131 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032132
William M. Brack21e4ef22005-01-02 09:53:13 +000032133#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032134 int mem_base;
32135 int ret_val;
32136 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
32137 int n_ctxt;
32138 xmlParserInputBufferPtr input; /* the input to use for reading the data */
32139 int n_input;
32140 xmlCharEncoding enc; /* an optional encoding information */
32141 int n_enc;
32142 xmlSAXHandlerPtr sax; /* a SAX handler for the resulting events */
32143 int n_sax;
32144 void * user_data; /* the context to provide to the SAX handler. */
32145 int n_user_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032146
Daniel Veillardce682bc2004-11-05 17:22:25 +000032147 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
32148 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
32149 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
32150 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
32151 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
32152 mem_base = xmlMemBlocks();
32153 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
32154 input = gen_xmlParserInputBufferPtr(n_input, 1);
32155 enc = gen_xmlCharEncoding(n_enc, 2);
32156 sax = gen_xmlSAXHandlerPtr(n_sax, 3);
32157 user_data = gen_userdata(n_user_data, 4);
32158
32159 ret_val = xmlSchemaValidateStream(ctxt, input, enc, sax, user_data);
32160 desret_int(ret_val);
32161 call_tests++;
32162 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
32163 des_xmlParserInputBufferPtr(n_input, input, 1);
32164 des_xmlCharEncoding(n_enc, enc, 2);
32165 des_xmlSAXHandlerPtr(n_sax, sax, 3);
32166 des_userdata(n_user_data, user_data, 4);
32167 xmlResetLastError();
32168 if (mem_base != xmlMemBlocks()) {
32169 printf("Leak of %d blocks found in xmlSchemaValidateStream",
32170 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032171 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032172 printf(" %d", n_ctxt);
32173 printf(" %d", n_input);
32174 printf(" %d", n_enc);
32175 printf(" %d", n_sax);
32176 printf(" %d", n_user_data);
32177 printf("\n");
32178 }
32179 }
32180 }
32181 }
32182 }
32183 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032184 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032185#endif
32186
Daniel Veillard42595322004-11-08 10:52:06 +000032187 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032188}
32189
32190static int
32191test_xmlschemas(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032192 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032193
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032194 if (quiet == 0) printf("Testing xmlschemas : 11 of 18 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000032195 test_ret += test_xmlSchemaDump();
32196 test_ret += test_xmlSchemaGetParserErrors();
32197 test_ret += test_xmlSchemaGetValidErrors();
32198 test_ret += test_xmlSchemaNewDocParserCtxt();
32199 test_ret += test_xmlSchemaNewMemParserCtxt();
32200 test_ret += test_xmlSchemaNewParserCtxt();
32201 test_ret += test_xmlSchemaNewValidCtxt();
32202 test_ret += test_xmlSchemaParse();
32203 test_ret += test_xmlSchemaSetParserErrors();
32204 test_ret += test_xmlSchemaSetValidErrors();
32205 test_ret += test_xmlSchemaSetValidOptions();
32206 test_ret += test_xmlSchemaValidCtxtGetOptions();
32207 test_ret += test_xmlSchemaValidateDoc();
32208 test_ret += test_xmlSchemaValidateOneElement();
32209 test_ret += test_xmlSchemaValidateStream();
Daniel Veillardd93f6252004-11-02 15:53:51 +000032210
Daniel Veillard42595322004-11-08 10:52:06 +000032211 if (test_ret != 0)
32212 printf("Module xmlschemas: %d errors\n", test_ret);
32213 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032214}
Daniel Veillarda521d282004-11-09 14:59:59 +000032215#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000032216
Daniel Veillardce682bc2004-11-05 17:22:25 +000032217#define gen_nb_xmlSchemaFacetPtr 1
32218static xmlSchemaFacetPtr gen_xmlSchemaFacetPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32219 return(NULL);
32220}
32221static void des_xmlSchemaFacetPtr(int no ATTRIBUTE_UNUSED, xmlSchemaFacetPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32222}
Daniel Veillarda521d282004-11-09 14:59:59 +000032223#endif
32224
32225#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000032226
32227#define gen_nb_xmlSchemaTypePtr 1
32228static xmlSchemaTypePtr gen_xmlSchemaTypePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32229 return(NULL);
32230}
32231static void des_xmlSchemaTypePtr(int no ATTRIBUTE_UNUSED, xmlSchemaTypePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32232}
Daniel Veillarda521d282004-11-09 14:59:59 +000032233#endif
32234
Daniel Veillardce682bc2004-11-05 17:22:25 +000032235
Daniel Veillardd93f6252004-11-02 15:53:51 +000032236static int
32237test_xmlSchemaCheckFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032238 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032239
William M. Brack21e4ef22005-01-02 09:53:13 +000032240#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032241 int mem_base;
32242 int ret_val;
32243 xmlSchemaFacetPtr facet; /* the facet */
32244 int n_facet;
32245 xmlSchemaTypePtr typeDecl; /* the schema type definition */
32246 int n_typeDecl;
32247 xmlSchemaParserCtxtPtr ctxt; /* the schema parser context or NULL */
32248 int n_ctxt;
32249 xmlChar * name; /* name of the type */
32250 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032251
Daniel Veillardce682bc2004-11-05 17:22:25 +000032252 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
32253 for (n_typeDecl = 0;n_typeDecl < gen_nb_xmlSchemaTypePtr;n_typeDecl++) {
32254 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaParserCtxtPtr;n_ctxt++) {
32255 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
32256 mem_base = xmlMemBlocks();
32257 facet = gen_xmlSchemaFacetPtr(n_facet, 0);
32258 typeDecl = gen_xmlSchemaTypePtr(n_typeDecl, 1);
32259 ctxt = gen_xmlSchemaParserCtxtPtr(n_ctxt, 2);
32260 name = gen_const_xmlChar_ptr(n_name, 3);
32261
William M. Brackf13f77f2004-11-12 16:03:48 +000032262 ret_val = xmlSchemaCheckFacet(facet, typeDecl, ctxt, (const xmlChar *)name);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032263 desret_int(ret_val);
32264 call_tests++;
32265 des_xmlSchemaFacetPtr(n_facet, facet, 0);
32266 des_xmlSchemaTypePtr(n_typeDecl, typeDecl, 1);
32267 des_xmlSchemaParserCtxtPtr(n_ctxt, ctxt, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000032268 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 3);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032269 xmlResetLastError();
32270 if (mem_base != xmlMemBlocks()) {
32271 printf("Leak of %d blocks found in xmlSchemaCheckFacet",
32272 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032273 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032274 printf(" %d", n_facet);
32275 printf(" %d", n_typeDecl);
32276 printf(" %d", n_ctxt);
32277 printf(" %d", n_name);
32278 printf("\n");
32279 }
32280 }
32281 }
32282 }
32283 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032284 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032285#endif
32286
Daniel Veillard42595322004-11-08 10:52:06 +000032287 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032288}
32289
32290
32291static int
32292test_xmlSchemaCleanupTypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032293 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032294
William M. Brack21e4ef22005-01-02 09:53:13 +000032295#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000032296 int mem_base;
32297
32298 mem_base = xmlMemBlocks();
32299
32300 xmlSchemaCleanupTypes();
32301 call_tests++;
32302 xmlResetLastError();
32303 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000032304 printf("Leak of %d blocks found in xmlSchemaCleanupTypes",
Daniel Veillardd93f6252004-11-02 15:53:51 +000032305 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032306 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000032307 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000032308 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032309 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032310#endif
32311
Daniel Veillard42595322004-11-08 10:52:06 +000032312 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032313}
32314
32315
32316static int
32317test_xmlSchemaCollapseString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032318 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032319
William M. Brack21e4ef22005-01-02 09:53:13 +000032320#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032321 int mem_base;
32322 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032323 xmlChar * value; /* a value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032324 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032325
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032326 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32327 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000032328 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032329
William M. Brackf13f77f2004-11-12 16:03:48 +000032330 ret_val = xmlSchemaCollapseString((const xmlChar *)value);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032331 desret_xmlChar_ptr(ret_val);
32332 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000032333 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032334 xmlResetLastError();
32335 if (mem_base != xmlMemBlocks()) {
32336 printf("Leak of %d blocks found in xmlSchemaCollapseString",
32337 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032338 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032339 printf(" %d", n_value);
32340 printf("\n");
32341 }
32342 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032343 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032344#endif
32345
Daniel Veillard42595322004-11-08 10:52:06 +000032346 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032347}
32348
Daniel Veillarda521d282004-11-09 14:59:59 +000032349#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000032350
Daniel Veillardce682bc2004-11-05 17:22:25 +000032351#define gen_nb_xmlSchemaValPtr 1
32352static xmlSchemaValPtr gen_xmlSchemaValPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32353 return(NULL);
32354}
32355static void des_xmlSchemaValPtr(int no ATTRIBUTE_UNUSED, xmlSchemaValPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32356}
Daniel Veillarda521d282004-11-09 14:59:59 +000032357#endif
32358
Daniel Veillardce682bc2004-11-05 17:22:25 +000032359
Daniel Veillardd93f6252004-11-02 15:53:51 +000032360static int
32361test_xmlSchemaCompareValues(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032362 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032363
William M. Brack21e4ef22005-01-02 09:53:13 +000032364#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032365 int mem_base;
32366 int ret_val;
32367 xmlSchemaValPtr x; /* a first value */
32368 int n_x;
32369 xmlSchemaValPtr y; /* a second value */
32370 int n_y;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032371
Daniel Veillardce682bc2004-11-05 17:22:25 +000032372 for (n_x = 0;n_x < gen_nb_xmlSchemaValPtr;n_x++) {
32373 for (n_y = 0;n_y < gen_nb_xmlSchemaValPtr;n_y++) {
32374 mem_base = xmlMemBlocks();
32375 x = gen_xmlSchemaValPtr(n_x, 0);
32376 y = gen_xmlSchemaValPtr(n_y, 1);
32377
32378 ret_val = xmlSchemaCompareValues(x, y);
32379 desret_int(ret_val);
32380 call_tests++;
32381 des_xmlSchemaValPtr(n_x, x, 0);
32382 des_xmlSchemaValPtr(n_y, y, 1);
32383 xmlResetLastError();
32384 if (mem_base != xmlMemBlocks()) {
32385 printf("Leak of %d blocks found in xmlSchemaCompareValues",
32386 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032387 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032388 printf(" %d", n_x);
32389 printf(" %d", n_y);
32390 printf("\n");
32391 }
32392 }
32393 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032394 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032395#endif
32396
Daniel Veillard42595322004-11-08 10:52:06 +000032397 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032398}
32399
32400
32401static int
32402test_xmlSchemaGetBuiltInListSimpleTypeItemType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032403 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032404
William M. Brack21e4ef22005-01-02 09:53:13 +000032405#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000032406 int mem_base;
32407 xmlSchemaTypePtr ret_val;
32408 xmlSchemaTypePtr type; /* the built-in simple type. */
32409 int n_type;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032410
Daniel Veillard42595322004-11-08 10:52:06 +000032411 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32412 mem_base = xmlMemBlocks();
32413 type = gen_xmlSchemaTypePtr(n_type, 0);
32414
32415 ret_val = xmlSchemaGetBuiltInListSimpleTypeItemType(type);
32416 desret_xmlSchemaTypePtr(ret_val);
32417 call_tests++;
32418 des_xmlSchemaTypePtr(n_type, type, 0);
32419 xmlResetLastError();
32420 if (mem_base != xmlMemBlocks()) {
32421 printf("Leak of %d blocks found in xmlSchemaGetBuiltInListSimpleTypeItemType",
32422 xmlMemBlocks() - mem_base);
32423 test_ret++;
32424 printf(" %d", n_type);
32425 printf("\n");
32426 }
32427 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032428 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032429#endif
32430
Daniel Veillard42595322004-11-08 10:52:06 +000032431 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032432}
32433
32434
32435static int
32436test_xmlSchemaGetBuiltInType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032437 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032438
William M. Brack21e4ef22005-01-02 09:53:13 +000032439#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000032440 xmlSchemaTypePtr ret_val;
32441 xmlSchemaValType type; /* the type of the built in type */
32442 int n_type;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032443
Daniel Veillard42595322004-11-08 10:52:06 +000032444 for (n_type = 0;n_type < gen_nb_xmlSchemaValType;n_type++) {
32445 type = gen_xmlSchemaValType(n_type, 0);
32446
32447 ret_val = xmlSchemaGetBuiltInType(type);
32448 desret_xmlSchemaTypePtr(ret_val);
32449 call_tests++;
32450 des_xmlSchemaValType(n_type, type, 0);
32451 xmlResetLastError();
32452 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032453 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032454#endif
32455
Daniel Veillard42595322004-11-08 10:52:06 +000032456 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032457}
32458
32459
32460static int
32461test_xmlSchemaGetFacetValueAsULong(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032462 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032463
William M. Brack21e4ef22005-01-02 09:53:13 +000032464#if defined(LIBXML_SCHEMAS_ENABLED)
William M. Brack094dd862004-11-14 14:28:34 +000032465 int mem_base;
32466 unsigned long ret_val;
32467 xmlSchemaFacetPtr facet; /* an schemas type facet */
32468 int n_facet;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032469
William M. Brack094dd862004-11-14 14:28:34 +000032470 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
32471 mem_base = xmlMemBlocks();
32472 facet = gen_xmlSchemaFacetPtr(n_facet, 0);
32473
32474 ret_val = xmlSchemaGetFacetValueAsULong(facet);
32475 desret_unsigned_long(ret_val);
32476 call_tests++;
32477 des_xmlSchemaFacetPtr(n_facet, facet, 0);
32478 xmlResetLastError();
32479 if (mem_base != xmlMemBlocks()) {
32480 printf("Leak of %d blocks found in xmlSchemaGetFacetValueAsULong",
32481 xmlMemBlocks() - mem_base);
32482 test_ret++;
32483 printf(" %d", n_facet);
32484 printf("\n");
32485 }
32486 }
32487 function_tests++;
32488#endif
32489
Daniel Veillard42595322004-11-08 10:52:06 +000032490 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032491}
32492
32493
32494static int
32495test_xmlSchemaGetPredefinedType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032496 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032497
William M. Brack21e4ef22005-01-02 09:53:13 +000032498#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000032499 int mem_base;
32500 xmlSchemaTypePtr ret_val;
32501 xmlChar * name; /* the type name */
32502 int n_name;
32503 xmlChar * ns; /* the URI of the namespace usually "http://www.w3.org/2001/XMLSchema" */
32504 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032505
Daniel Veillard42595322004-11-08 10:52:06 +000032506 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
32507 for (n_ns = 0;n_ns < gen_nb_const_xmlChar_ptr;n_ns++) {
32508 mem_base = xmlMemBlocks();
32509 name = gen_const_xmlChar_ptr(n_name, 0);
32510 ns = gen_const_xmlChar_ptr(n_ns, 1);
32511
William M. Brackf13f77f2004-11-12 16:03:48 +000032512 ret_val = xmlSchemaGetPredefinedType((const xmlChar *)name, (const xmlChar *)ns);
Daniel Veillard42595322004-11-08 10:52:06 +000032513 desret_xmlSchemaTypePtr(ret_val);
32514 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000032515 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
32516 des_const_xmlChar_ptr(n_ns, (const xmlChar *)ns, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000032517 xmlResetLastError();
32518 if (mem_base != xmlMemBlocks()) {
32519 printf("Leak of %d blocks found in xmlSchemaGetPredefinedType",
32520 xmlMemBlocks() - mem_base);
32521 test_ret++;
32522 printf(" %d", n_name);
32523 printf(" %d", n_ns);
32524 printf("\n");
32525 }
32526 }
32527 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032528 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032529#endif
32530
Daniel Veillard42595322004-11-08 10:52:06 +000032531 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032532}
32533
32534
32535static int
32536test_xmlSchemaInitTypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032537 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032538
William M. Brack21e4ef22005-01-02 09:53:13 +000032539#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000032540
32541
32542 xmlSchemaInitTypes();
32543 call_tests++;
32544 xmlResetLastError();
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032545 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032546#endif
32547
Daniel Veillard42595322004-11-08 10:52:06 +000032548 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032549}
32550
32551
32552static int
32553test_xmlSchemaIsBuiltInTypeFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032554 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032555
William M. Brack21e4ef22005-01-02 09:53:13 +000032556#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032557 int mem_base;
32558 int ret_val;
32559 xmlSchemaTypePtr type; /* the built-in type */
32560 int n_type;
32561 int facetType; /* the facet type */
32562 int n_facetType;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032563
Daniel Veillardce682bc2004-11-05 17:22:25 +000032564 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32565 for (n_facetType = 0;n_facetType < gen_nb_int;n_facetType++) {
32566 mem_base = xmlMemBlocks();
32567 type = gen_xmlSchemaTypePtr(n_type, 0);
32568 facetType = gen_int(n_facetType, 1);
32569
32570 ret_val = xmlSchemaIsBuiltInTypeFacet(type, facetType);
32571 desret_int(ret_val);
32572 call_tests++;
32573 des_xmlSchemaTypePtr(n_type, type, 0);
32574 des_int(n_facetType, facetType, 1);
32575 xmlResetLastError();
32576 if (mem_base != xmlMemBlocks()) {
32577 printf("Leak of %d blocks found in xmlSchemaIsBuiltInTypeFacet",
32578 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032579 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032580 printf(" %d", n_type);
32581 printf(" %d", n_facetType);
32582 printf("\n");
32583 }
32584 }
32585 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032586 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032587#endif
32588
Daniel Veillard42595322004-11-08 10:52:06 +000032589 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032590}
32591
32592
32593static int
32594test_xmlSchemaNewFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032595 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032596
32597
32598 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000032599 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032600}
32601
Daniel Veillarda521d282004-11-09 14:59:59 +000032602#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000032603
Daniel Veillardce682bc2004-11-05 17:22:25 +000032604#define gen_nb_xmlSchemaValPtr_ptr 1
32605static xmlSchemaValPtr * gen_xmlSchemaValPtr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32606 return(NULL);
32607}
32608static void des_xmlSchemaValPtr_ptr(int no ATTRIBUTE_UNUSED, xmlSchemaValPtr * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32609}
Daniel Veillarda521d282004-11-09 14:59:59 +000032610#endif
32611
Daniel Veillardce682bc2004-11-05 17:22:25 +000032612
Daniel Veillardd93f6252004-11-02 15:53:51 +000032613static int
32614test_xmlSchemaValPredefTypeNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032615 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032616
William M. Brack21e4ef22005-01-02 09:53:13 +000032617#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032618 int mem_base;
32619 int ret_val;
32620 xmlSchemaTypePtr type; /* the predefined type */
32621 int n_type;
32622 xmlChar * value; /* the value to check */
32623 int n_value;
32624 xmlSchemaValPtr * val; /* the return computed value */
32625 int n_val;
32626 xmlNodePtr node; /* the node containing the value */
32627 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032628
Daniel Veillardce682bc2004-11-05 17:22:25 +000032629 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32630 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32631 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr_ptr;n_val++) {
32632 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
32633 mem_base = xmlMemBlocks();
32634 type = gen_xmlSchemaTypePtr(n_type, 0);
32635 value = gen_const_xmlChar_ptr(n_value, 1);
32636 val = gen_xmlSchemaValPtr_ptr(n_val, 2);
32637 node = gen_xmlNodePtr(n_node, 3);
32638
William M. Brackf13f77f2004-11-12 16:03:48 +000032639 ret_val = xmlSchemaValPredefTypeNode(type, (const xmlChar *)value, val, node);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032640 desret_int(ret_val);
32641 call_tests++;
32642 des_xmlSchemaTypePtr(n_type, type, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000032643 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032644 des_xmlSchemaValPtr_ptr(n_val, val, 2);
32645 des_xmlNodePtr(n_node, node, 3);
32646 xmlResetLastError();
32647 if (mem_base != xmlMemBlocks()) {
32648 printf("Leak of %d blocks found in xmlSchemaValPredefTypeNode",
32649 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032650 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032651 printf(" %d", n_type);
32652 printf(" %d", n_value);
32653 printf(" %d", n_val);
32654 printf(" %d", n_node);
32655 printf("\n");
32656 }
32657 }
32658 }
32659 }
32660 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032661 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032662#endif
32663
Daniel Veillard42595322004-11-08 10:52:06 +000032664 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032665}
32666
32667
32668static int
32669test_xmlSchemaValPredefTypeNodeNoNorm(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032670 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032671
William M. Brack21e4ef22005-01-02 09:53:13 +000032672#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032673 int mem_base;
32674 int ret_val;
32675 xmlSchemaTypePtr type; /* the predefined type */
32676 int n_type;
32677 xmlChar * value; /* the value to check */
32678 int n_value;
32679 xmlSchemaValPtr * val; /* the return computed value */
32680 int n_val;
32681 xmlNodePtr node; /* the node containing the value */
32682 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032683
Daniel Veillardce682bc2004-11-05 17:22:25 +000032684 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32685 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32686 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr_ptr;n_val++) {
32687 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
32688 mem_base = xmlMemBlocks();
32689 type = gen_xmlSchemaTypePtr(n_type, 0);
32690 value = gen_const_xmlChar_ptr(n_value, 1);
32691 val = gen_xmlSchemaValPtr_ptr(n_val, 2);
32692 node = gen_xmlNodePtr(n_node, 3);
32693
William M. Brackf13f77f2004-11-12 16:03:48 +000032694 ret_val = xmlSchemaValPredefTypeNodeNoNorm(type, (const xmlChar *)value, val, node);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032695 desret_int(ret_val);
32696 call_tests++;
32697 des_xmlSchemaTypePtr(n_type, type, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000032698 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032699 des_xmlSchemaValPtr_ptr(n_val, val, 2);
32700 des_xmlNodePtr(n_node, node, 3);
32701 xmlResetLastError();
32702 if (mem_base != xmlMemBlocks()) {
32703 printf("Leak of %d blocks found in xmlSchemaValPredefTypeNodeNoNorm",
32704 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032705 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032706 printf(" %d", n_type);
32707 printf(" %d", n_value);
32708 printf(" %d", n_val);
32709 printf(" %d", n_node);
32710 printf("\n");
32711 }
32712 }
32713 }
32714 }
32715 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032716 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032717#endif
32718
Daniel Veillard42595322004-11-08 10:52:06 +000032719 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032720}
32721
32722
32723static int
32724test_xmlSchemaValidateFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032725 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032726
William M. Brack21e4ef22005-01-02 09:53:13 +000032727#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032728 int mem_base;
32729 int ret_val;
32730 xmlSchemaTypePtr base; /* the base type */
32731 int n_base;
32732 xmlSchemaFacetPtr facet; /* the facet to check */
32733 int n_facet;
32734 xmlChar * value; /* the lexical repr of the value to validate */
32735 int n_value;
32736 xmlSchemaValPtr val; /* the precomputed value */
32737 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032738
Daniel Veillardce682bc2004-11-05 17:22:25 +000032739 for (n_base = 0;n_base < gen_nb_xmlSchemaTypePtr;n_base++) {
32740 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
32741 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32742 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) {
32743 mem_base = xmlMemBlocks();
32744 base = gen_xmlSchemaTypePtr(n_base, 0);
32745 facet = gen_xmlSchemaFacetPtr(n_facet, 1);
32746 value = gen_const_xmlChar_ptr(n_value, 2);
32747 val = gen_xmlSchemaValPtr(n_val, 3);
32748
William M. Brackf13f77f2004-11-12 16:03:48 +000032749 ret_val = xmlSchemaValidateFacet(base, facet, (const xmlChar *)value, val);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032750 desret_int(ret_val);
32751 call_tests++;
32752 des_xmlSchemaTypePtr(n_base, base, 0);
32753 des_xmlSchemaFacetPtr(n_facet, facet, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000032754 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032755 des_xmlSchemaValPtr(n_val, val, 3);
32756 xmlResetLastError();
32757 if (mem_base != xmlMemBlocks()) {
32758 printf("Leak of %d blocks found in xmlSchemaValidateFacet",
32759 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032760 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032761 printf(" %d", n_base);
32762 printf(" %d", n_facet);
32763 printf(" %d", n_value);
32764 printf(" %d", n_val);
32765 printf("\n");
32766 }
32767 }
32768 }
32769 }
32770 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032771 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032772#endif
32773
Daniel Veillard42595322004-11-08 10:52:06 +000032774 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032775}
32776
32777
32778static int
32779test_xmlSchemaValidateLengthFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032780 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032781
William M. Brack21e4ef22005-01-02 09:53:13 +000032782#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032783 int mem_base;
32784 int ret_val;
32785 xmlSchemaTypePtr type; /* the built-in type */
32786 int n_type;
32787 xmlSchemaFacetPtr facet; /* the facet to check */
32788 int n_facet;
32789 xmlChar * value; /* the lexical repr. of the value to be validated */
32790 int n_value;
32791 xmlSchemaValPtr val; /* the precomputed value */
32792 int n_val;
32793 unsigned long * length; /* the actual length of the value */
32794 int n_length;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032795
Daniel Veillardce682bc2004-11-05 17:22:25 +000032796 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32797 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
32798 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32799 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) {
32800 for (n_length = 0;n_length < gen_nb_unsigned_long_ptr;n_length++) {
32801 mem_base = xmlMemBlocks();
32802 type = gen_xmlSchemaTypePtr(n_type, 0);
32803 facet = gen_xmlSchemaFacetPtr(n_facet, 1);
32804 value = gen_const_xmlChar_ptr(n_value, 2);
32805 val = gen_xmlSchemaValPtr(n_val, 3);
32806 length = gen_unsigned_long_ptr(n_length, 4);
32807
William M. Brackf13f77f2004-11-12 16:03:48 +000032808 ret_val = xmlSchemaValidateLengthFacet(type, facet, (const xmlChar *)value, val, length);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032809 desret_int(ret_val);
32810 call_tests++;
32811 des_xmlSchemaTypePtr(n_type, type, 0);
32812 des_xmlSchemaFacetPtr(n_facet, facet, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000032813 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032814 des_xmlSchemaValPtr(n_val, val, 3);
32815 des_unsigned_long_ptr(n_length, length, 4);
32816 xmlResetLastError();
32817 if (mem_base != xmlMemBlocks()) {
32818 printf("Leak of %d blocks found in xmlSchemaValidateLengthFacet",
32819 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032820 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032821 printf(" %d", n_type);
32822 printf(" %d", n_facet);
32823 printf(" %d", n_value);
32824 printf(" %d", n_val);
32825 printf(" %d", n_length);
32826 printf("\n");
32827 }
32828 }
32829 }
32830 }
32831 }
32832 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032833 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032834#endif
32835
Daniel Veillard42595322004-11-08 10:52:06 +000032836 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032837}
32838
32839
32840static int
32841test_xmlSchemaValidateListSimpleTypeFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032842 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032843
William M. Brack21e4ef22005-01-02 09:53:13 +000032844#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032845 int mem_base;
32846 int ret_val;
32847 xmlSchemaFacetPtr facet; /* the facet to check */
32848 int n_facet;
32849 xmlChar * value; /* the lexical repr of the value to validate */
32850 int n_value;
32851 unsigned long actualLen; /* the number of list items */
32852 int n_actualLen;
32853 unsigned long * expectedLen; /* the resulting expected number of list items */
32854 int n_expectedLen;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032855
Daniel Veillardce682bc2004-11-05 17:22:25 +000032856 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
32857 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32858 for (n_actualLen = 0;n_actualLen < gen_nb_unsigned_long;n_actualLen++) {
32859 for (n_expectedLen = 0;n_expectedLen < gen_nb_unsigned_long_ptr;n_expectedLen++) {
32860 mem_base = xmlMemBlocks();
32861 facet = gen_xmlSchemaFacetPtr(n_facet, 0);
32862 value = gen_const_xmlChar_ptr(n_value, 1);
32863 actualLen = gen_unsigned_long(n_actualLen, 2);
32864 expectedLen = gen_unsigned_long_ptr(n_expectedLen, 3);
32865
William M. Brackf13f77f2004-11-12 16:03:48 +000032866 ret_val = xmlSchemaValidateListSimpleTypeFacet(facet, (const xmlChar *)value, actualLen, expectedLen);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032867 desret_int(ret_val);
32868 call_tests++;
32869 des_xmlSchemaFacetPtr(n_facet, facet, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000032870 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032871 des_unsigned_long(n_actualLen, actualLen, 2);
32872 des_unsigned_long_ptr(n_expectedLen, expectedLen, 3);
32873 xmlResetLastError();
32874 if (mem_base != xmlMemBlocks()) {
32875 printf("Leak of %d blocks found in xmlSchemaValidateListSimpleTypeFacet",
32876 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032877 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032878 printf(" %d", n_facet);
32879 printf(" %d", n_value);
32880 printf(" %d", n_actualLen);
32881 printf(" %d", n_expectedLen);
32882 printf("\n");
32883 }
32884 }
32885 }
32886 }
32887 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032888 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032889#endif
32890
Daniel Veillard42595322004-11-08 10:52:06 +000032891 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032892}
32893
32894
32895static int
32896test_xmlSchemaValidatePredefinedType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032897 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032898
William M. Brack21e4ef22005-01-02 09:53:13 +000032899#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032900 int mem_base;
32901 int ret_val;
32902 xmlSchemaTypePtr type; /* the predefined type */
32903 int n_type;
32904 xmlChar * value; /* the value to check */
32905 int n_value;
32906 xmlSchemaValPtr * val; /* the return computed value */
32907 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032908
Daniel Veillardce682bc2004-11-05 17:22:25 +000032909 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32910 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32911 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr_ptr;n_val++) {
32912 mem_base = xmlMemBlocks();
32913 type = gen_xmlSchemaTypePtr(n_type, 0);
32914 value = gen_const_xmlChar_ptr(n_value, 1);
32915 val = gen_xmlSchemaValPtr_ptr(n_val, 2);
32916
William M. Brackf13f77f2004-11-12 16:03:48 +000032917 ret_val = xmlSchemaValidatePredefinedType(type, (const xmlChar *)value, val);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032918 desret_int(ret_val);
32919 call_tests++;
32920 des_xmlSchemaTypePtr(n_type, type, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000032921 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032922 des_xmlSchemaValPtr_ptr(n_val, val, 2);
32923 xmlResetLastError();
32924 if (mem_base != xmlMemBlocks()) {
32925 printf("Leak of %d blocks found in xmlSchemaValidatePredefinedType",
32926 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032927 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032928 printf(" %d", n_type);
32929 printf(" %d", n_value);
32930 printf(" %d", n_val);
32931 printf("\n");
32932 }
32933 }
32934 }
32935 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032936 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032937#endif
32938
Daniel Veillard42595322004-11-08 10:52:06 +000032939 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032940}
32941
Daniel Veillard91b955c2004-12-10 10:26:42 +000032942
32943static int
32944test_xmlSchemaWhiteSpaceReplace(void) {
32945 int test_ret = 0;
32946
William M. Brack21e4ef22005-01-02 09:53:13 +000032947#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard91b955c2004-12-10 10:26:42 +000032948 int mem_base;
32949 xmlChar * ret_val;
32950 xmlChar * value; /* a value */
32951 int n_value;
32952
32953 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32954 mem_base = xmlMemBlocks();
32955 value = gen_const_xmlChar_ptr(n_value, 0);
32956
32957 ret_val = xmlSchemaWhiteSpaceReplace((const xmlChar *)value);
32958 desret_xmlChar_ptr(ret_val);
32959 call_tests++;
32960 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
32961 xmlResetLastError();
32962 if (mem_base != xmlMemBlocks()) {
32963 printf("Leak of %d blocks found in xmlSchemaWhiteSpaceReplace",
32964 xmlMemBlocks() - mem_base);
32965 test_ret++;
32966 printf(" %d", n_value);
32967 printf("\n");
32968 }
32969 }
32970 function_tests++;
32971#endif
32972
32973 return(test_ret);
32974}
32975
Daniel Veillardd93f6252004-11-02 15:53:51 +000032976static int
32977test_xmlschemastypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032978 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032979
Daniel Veillard91b955c2004-12-10 10:26:42 +000032980 if (quiet == 0) printf("Testing xmlschemastypes : 17 of 20 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000032981 test_ret += test_xmlSchemaCheckFacet();
32982 test_ret += test_xmlSchemaCleanupTypes();
32983 test_ret += test_xmlSchemaCollapseString();
32984 test_ret += test_xmlSchemaCompareValues();
32985 test_ret += test_xmlSchemaGetBuiltInListSimpleTypeItemType();
32986 test_ret += test_xmlSchemaGetBuiltInType();
32987 test_ret += test_xmlSchemaGetFacetValueAsULong();
32988 test_ret += test_xmlSchemaGetPredefinedType();
32989 test_ret += test_xmlSchemaInitTypes();
32990 test_ret += test_xmlSchemaIsBuiltInTypeFacet();
32991 test_ret += test_xmlSchemaNewFacet();
32992 test_ret += test_xmlSchemaValPredefTypeNode();
32993 test_ret += test_xmlSchemaValPredefTypeNodeNoNorm();
32994 test_ret += test_xmlSchemaValidateFacet();
32995 test_ret += test_xmlSchemaValidateLengthFacet();
32996 test_ret += test_xmlSchemaValidateListSimpleTypeFacet();
32997 test_ret += test_xmlSchemaValidatePredefinedType();
Daniel Veillard91b955c2004-12-10 10:26:42 +000032998 test_ret += test_xmlSchemaWhiteSpaceReplace();
Daniel Veillardd93f6252004-11-02 15:53:51 +000032999
Daniel Veillard42595322004-11-08 10:52:06 +000033000 if (test_ret != 0)
33001 printf("Module xmlschemastypes: %d errors\n", test_ret);
33002 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033003}
33004
33005static int
33006test_xmlCharStrdup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033007 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033008
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033009 int mem_base;
33010 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033011 char * cur; /* the input char * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033012 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033013
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033014 for (n_cur = 0;n_cur < gen_nb_const_char_ptr;n_cur++) {
33015 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033016 cur = gen_const_char_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033017
William M. Brackf13f77f2004-11-12 16:03:48 +000033018 ret_val = xmlCharStrdup((const char *)cur);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033019 desret_xmlChar_ptr(ret_val);
33020 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033021 des_const_char_ptr(n_cur, (const char *)cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033022 xmlResetLastError();
33023 if (mem_base != xmlMemBlocks()) {
33024 printf("Leak of %d blocks found in xmlCharStrdup",
33025 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033026 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033027 printf(" %d", n_cur);
33028 printf("\n");
33029 }
33030 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033031 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033032
Daniel Veillard42595322004-11-08 10:52:06 +000033033 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033034}
33035
33036
33037static int
33038test_xmlCharStrndup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033039 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033040
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033041 int mem_base;
33042 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033043 char * cur; /* the input char * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033044 int n_cur;
33045 int len; /* the len of @cur */
33046 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033047
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033048 for (n_cur = 0;n_cur < gen_nb_const_char_ptr;n_cur++) {
33049 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33050 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033051 cur = gen_const_char_ptr(n_cur, 0);
33052 len = gen_int(n_len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033053
William M. Brackf13f77f2004-11-12 16:03:48 +000033054 ret_val = xmlCharStrndup((const char *)cur, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033055 desret_xmlChar_ptr(ret_val);
33056 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033057 des_const_char_ptr(n_cur, (const char *)cur, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033058 des_int(n_len, len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033059 xmlResetLastError();
33060 if (mem_base != xmlMemBlocks()) {
33061 printf("Leak of %d blocks found in xmlCharStrndup",
33062 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033063 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033064 printf(" %d", n_cur);
33065 printf(" %d", n_len);
33066 printf("\n");
33067 }
33068 }
33069 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033070 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033071
Daniel Veillard42595322004-11-08 10:52:06 +000033072 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033073}
33074
33075
33076static int
33077test_xmlCheckUTF8(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033078 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033079
Daniel Veillardce682bc2004-11-05 17:22:25 +000033080 int mem_base;
33081 int ret_val;
33082 unsigned char * utf; /* Pointer to putative UTF-8 encoded string. */
33083 int n_utf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033084
Daniel Veillardce682bc2004-11-05 17:22:25 +000033085 for (n_utf = 0;n_utf < gen_nb_const_unsigned_char_ptr;n_utf++) {
33086 mem_base = xmlMemBlocks();
33087 utf = gen_const_unsigned_char_ptr(n_utf, 0);
33088
William M. Brackf13f77f2004-11-12 16:03:48 +000033089 ret_val = xmlCheckUTF8((const unsigned char *)utf);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033090 desret_int(ret_val);
33091 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033092 des_const_unsigned_char_ptr(n_utf, (const unsigned char *)utf, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033093 xmlResetLastError();
33094 if (mem_base != xmlMemBlocks()) {
33095 printf("Leak of %d blocks found in xmlCheckUTF8",
33096 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033097 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033098 printf(" %d", n_utf);
33099 printf("\n");
33100 }
33101 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000033102 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033103
Daniel Veillard42595322004-11-08 10:52:06 +000033104 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033105}
33106
33107
33108static int
33109test_xmlGetUTF8Char(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033110 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033111
Daniel Veillardce682bc2004-11-05 17:22:25 +000033112 int mem_base;
33113 int ret_val;
33114 unsigned char * utf; /* a sequence of UTF-8 encoded bytes */
33115 int n_utf;
33116 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. */
33117 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033118
Daniel Veillardce682bc2004-11-05 17:22:25 +000033119 for (n_utf = 0;n_utf < gen_nb_const_unsigned_char_ptr;n_utf++) {
33120 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
33121 mem_base = xmlMemBlocks();
33122 utf = gen_const_unsigned_char_ptr(n_utf, 0);
33123 len = gen_int_ptr(n_len, 1);
33124
William M. Brackf13f77f2004-11-12 16:03:48 +000033125 ret_val = xmlGetUTF8Char((const unsigned char *)utf, len);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033126 desret_int(ret_val);
33127 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033128 des_const_unsigned_char_ptr(n_utf, (const unsigned char *)utf, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000033129 des_int_ptr(n_len, len, 1);
33130 xmlResetLastError();
33131 if (mem_base != xmlMemBlocks()) {
33132 printf("Leak of %d blocks found in xmlGetUTF8Char",
33133 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033134 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033135 printf(" %d", n_utf);
33136 printf(" %d", n_len);
33137 printf("\n");
33138 }
33139 }
33140 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000033141 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033142
Daniel Veillard42595322004-11-08 10:52:06 +000033143 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033144}
33145
33146
33147static int
33148test_xmlStrEqual(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033149 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033150
33151 int mem_base;
33152 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033153 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033154 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033155 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033156 int n_str2;
33157
33158 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33159 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33160 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033161 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33162 str2 = gen_const_xmlChar_ptr(n_str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033163
William M. Brackf13f77f2004-11-12 16:03:48 +000033164 ret_val = xmlStrEqual((const xmlChar *)str1, (const xmlChar *)str2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033165 desret_int(ret_val);
33166 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033167 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
33168 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033169 xmlResetLastError();
33170 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033171 printf("Leak of %d blocks found in xmlStrEqual",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033172 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033173 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033174 printf(" %d", n_str1);
33175 printf(" %d", n_str2);
33176 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033177 }
33178 }
33179 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033180 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033181
Daniel Veillard42595322004-11-08 10:52:06 +000033182 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033183}
33184
33185
33186static int
33187test_xmlStrPrintf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033188 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033189
33190
33191 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000033192 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033193}
33194
33195
33196static int
33197test_xmlStrQEqual(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033198 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033199
33200 int mem_base;
33201 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033202 xmlChar * pref; /* the prefix of the QName */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033203 int n_pref;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033204 xmlChar * name; /* the localname of the QName */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033205 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033206 xmlChar * str; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033207 int n_str;
33208
33209 for (n_pref = 0;n_pref < gen_nb_const_xmlChar_ptr;n_pref++) {
33210 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
33211 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33212 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033213 pref = gen_const_xmlChar_ptr(n_pref, 0);
33214 name = gen_const_xmlChar_ptr(n_name, 1);
33215 str = gen_const_xmlChar_ptr(n_str, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033216
William M. Brackf13f77f2004-11-12 16:03:48 +000033217 ret_val = xmlStrQEqual((const xmlChar *)pref, (const xmlChar *)name, (const xmlChar *)str);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033218 desret_int(ret_val);
33219 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033220 des_const_xmlChar_ptr(n_pref, (const xmlChar *)pref, 0);
33221 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
33222 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033223 xmlResetLastError();
33224 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033225 printf("Leak of %d blocks found in xmlStrQEqual",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033226 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033227 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033228 printf(" %d", n_pref);
33229 printf(" %d", n_name);
33230 printf(" %d", n_str);
33231 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033232 }
33233 }
33234 }
33235 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033236 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033237
Daniel Veillard42595322004-11-08 10:52:06 +000033238 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033239}
33240
33241
33242static int
33243test_xmlStrVPrintf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033244 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033245
33246
33247 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000033248 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033249}
33250
33251
33252static int
33253test_xmlStrcasecmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033254 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033255
33256 int mem_base;
33257 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033258 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033259 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033260 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033261 int n_str2;
33262
33263 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33264 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33265 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033266 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33267 str2 = gen_const_xmlChar_ptr(n_str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033268
William M. Brackf13f77f2004-11-12 16:03:48 +000033269 ret_val = xmlStrcasecmp((const xmlChar *)str1, (const xmlChar *)str2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033270 desret_int(ret_val);
33271 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033272 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
33273 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033274 xmlResetLastError();
33275 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033276 printf("Leak of %d blocks found in xmlStrcasecmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033277 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033278 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033279 printf(" %d", n_str1);
33280 printf(" %d", n_str2);
33281 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033282 }
33283 }
33284 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033285 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033286
Daniel Veillard42595322004-11-08 10:52:06 +000033287 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033288}
33289
33290
33291static int
33292test_xmlStrcasestr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033293 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033294
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033295 int mem_base;
33296 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033297 xmlChar * str; /* the xmlChar * array (haystack) */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033298 int n_str;
33299 xmlChar * val; /* the xmlChar to search (needle) */
33300 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033301
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033302 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33303 for (n_val = 0;n_val < gen_nb_xmlChar_ptr;n_val++) {
33304 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033305 str = gen_const_xmlChar_ptr(n_str, 0);
33306 val = gen_xmlChar_ptr(n_val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033307
William M. Brackf13f77f2004-11-12 16:03:48 +000033308 ret_val = xmlStrcasestr((const xmlChar *)str, val);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033309 desret_const_xmlChar_ptr(ret_val);
33310 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033311 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033312 des_xmlChar_ptr(n_val, val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033313 xmlResetLastError();
33314 if (mem_base != xmlMemBlocks()) {
33315 printf("Leak of %d blocks found in xmlStrcasestr",
33316 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033317 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033318 printf(" %d", n_str);
33319 printf(" %d", n_val);
33320 printf("\n");
33321 }
33322 }
33323 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033324 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033325
Daniel Veillard42595322004-11-08 10:52:06 +000033326 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033327}
33328
33329
33330static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000033331test_xmlStrchr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033332 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033333
Daniel Veillardf2a36f92004-11-08 17:55:01 +000033334 int mem_base;
33335 const xmlChar * ret_val;
33336 xmlChar * str; /* the xmlChar * array */
33337 int n_str;
33338 xmlChar val; /* the xmlChar to search */
33339 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033340
Daniel Veillardf2a36f92004-11-08 17:55:01 +000033341 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33342 for (n_val = 0;n_val < gen_nb_xmlChar;n_val++) {
33343 mem_base = xmlMemBlocks();
33344 str = gen_const_xmlChar_ptr(n_str, 0);
33345 val = gen_xmlChar(n_val, 1);
33346
William M. Brackf13f77f2004-11-12 16:03:48 +000033347 ret_val = xmlStrchr((const xmlChar *)str, val);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000033348 desret_const_xmlChar_ptr(ret_val);
33349 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033350 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000033351 des_xmlChar(n_val, val, 1);
33352 xmlResetLastError();
33353 if (mem_base != xmlMemBlocks()) {
33354 printf("Leak of %d blocks found in xmlStrchr",
33355 xmlMemBlocks() - mem_base);
33356 test_ret++;
33357 printf(" %d", n_str);
33358 printf(" %d", n_val);
33359 printf("\n");
33360 }
33361 }
33362 }
Daniel Veillardf2a36f92004-11-08 17:55:01 +000033363 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033364
Daniel Veillard42595322004-11-08 10:52:06 +000033365 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033366}
33367
33368
33369static int
33370test_xmlStrcmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033371 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033372
33373 int mem_base;
33374 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033375 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033376 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033377 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033378 int n_str2;
33379
33380 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33381 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33382 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033383 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33384 str2 = gen_const_xmlChar_ptr(n_str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033385
William M. Brackf13f77f2004-11-12 16:03:48 +000033386 ret_val = xmlStrcmp((const xmlChar *)str1, (const xmlChar *)str2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033387 desret_int(ret_val);
33388 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033389 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
33390 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033391 xmlResetLastError();
33392 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033393 printf("Leak of %d blocks found in xmlStrcmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033394 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033395 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033396 printf(" %d", n_str1);
33397 printf(" %d", n_str2);
33398 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033399 }
33400 }
33401 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033402 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033403
Daniel Veillard42595322004-11-08 10:52:06 +000033404 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033405}
33406
33407
33408static int
33409test_xmlStrdup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033410 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033411
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033412 int mem_base;
33413 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033414 xmlChar * cur; /* the input xmlChar * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033415 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033416
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033417 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
33418 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033419 cur = gen_const_xmlChar_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033420
William M. Brackf13f77f2004-11-12 16:03:48 +000033421 ret_val = xmlStrdup((const xmlChar *)cur);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033422 desret_xmlChar_ptr(ret_val);
33423 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033424 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033425 xmlResetLastError();
33426 if (mem_base != xmlMemBlocks()) {
33427 printf("Leak of %d blocks found in xmlStrdup",
33428 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033429 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033430 printf(" %d", n_cur);
33431 printf("\n");
33432 }
33433 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033434 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033435
Daniel Veillard42595322004-11-08 10:52:06 +000033436 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033437}
33438
33439
33440static int
33441test_xmlStrlen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033442 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033443
33444 int mem_base;
33445 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033446 xmlChar * str; /* the xmlChar * array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033447 int n_str;
33448
33449 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33450 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033451 str = gen_const_xmlChar_ptr(n_str, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033452
William M. Brackf13f77f2004-11-12 16:03:48 +000033453 ret_val = xmlStrlen((const xmlChar *)str);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033454 desret_int(ret_val);
33455 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033456 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033457 xmlResetLastError();
33458 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033459 printf("Leak of %d blocks found in xmlStrlen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033460 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033461 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033462 printf(" %d", n_str);
33463 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033464 }
33465 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033466 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033467
Daniel Veillard42595322004-11-08 10:52:06 +000033468 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033469}
33470
33471
33472static int
33473test_xmlStrncasecmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033474 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033475
33476 int mem_base;
33477 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033478 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033479 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033480 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033481 int n_str2;
33482 int len; /* the max comparison length */
33483 int n_len;
33484
33485 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33486 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33487 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33488 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033489 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33490 str2 = gen_const_xmlChar_ptr(n_str2, 1);
33491 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033492
William M. Brackf13f77f2004-11-12 16:03:48 +000033493 ret_val = xmlStrncasecmp((const xmlChar *)str1, (const xmlChar *)str2, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033494 desret_int(ret_val);
33495 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033496 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
33497 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033498 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033499 xmlResetLastError();
33500 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033501 printf("Leak of %d blocks found in xmlStrncasecmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033502 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033503 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033504 printf(" %d", n_str1);
33505 printf(" %d", n_str2);
33506 printf(" %d", n_len);
33507 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033508 }
33509 }
33510 }
33511 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033512 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033513
Daniel Veillard42595322004-11-08 10:52:06 +000033514 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033515}
33516
33517
33518static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000033519test_xmlStrncatNew(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033520 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033521
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033522 int mem_base;
33523 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033524 xmlChar * str1; /* first xmlChar string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033525 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033526 xmlChar * str2; /* second xmlChar string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033527 int n_str2;
33528 int len; /* the len of @str2 */
33529 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033530
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033531 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33532 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33533 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33534 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033535 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33536 str2 = gen_const_xmlChar_ptr(n_str2, 1);
33537 len = gen_int(n_len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033538
William M. Brackf13f77f2004-11-12 16:03:48 +000033539 ret_val = xmlStrncatNew((const xmlChar *)str1, (const xmlChar *)str2, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033540 desret_xmlChar_ptr(ret_val);
33541 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033542 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
33543 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033544 des_int(n_len, len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033545 xmlResetLastError();
33546 if (mem_base != xmlMemBlocks()) {
33547 printf("Leak of %d blocks found in xmlStrncatNew",
33548 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033549 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033550 printf(" %d", n_str1);
33551 printf(" %d", n_str2);
33552 printf(" %d", n_len);
33553 printf("\n");
33554 }
33555 }
33556 }
33557 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033558 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033559
Daniel Veillard42595322004-11-08 10:52:06 +000033560 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033561}
33562
33563
33564static int
33565test_xmlStrncmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033566 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033567
33568 int mem_base;
33569 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033570 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033571 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033572 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033573 int n_str2;
33574 int len; /* the max comparison length */
33575 int n_len;
33576
33577 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33578 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33579 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33580 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033581 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33582 str2 = gen_const_xmlChar_ptr(n_str2, 1);
33583 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033584
William M. Brackf13f77f2004-11-12 16:03:48 +000033585 ret_val = xmlStrncmp((const xmlChar *)str1, (const xmlChar *)str2, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033586 desret_int(ret_val);
33587 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033588 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
33589 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033590 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033591 xmlResetLastError();
33592 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033593 printf("Leak of %d blocks found in xmlStrncmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033594 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033595 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033596 printf(" %d", n_str1);
33597 printf(" %d", n_str2);
33598 printf(" %d", n_len);
33599 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033600 }
33601 }
33602 }
33603 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033604 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033605
Daniel Veillard42595322004-11-08 10:52:06 +000033606 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033607}
33608
33609
33610static int
33611test_xmlStrndup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033612 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033613
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033614 int mem_base;
33615 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033616 xmlChar * cur; /* the input xmlChar * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033617 int n_cur;
33618 int len; /* the len of @cur */
33619 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033620
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033621 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
33622 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33623 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033624 cur = gen_const_xmlChar_ptr(n_cur, 0);
33625 len = gen_int(n_len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033626
William M. Brackf13f77f2004-11-12 16:03:48 +000033627 ret_val = xmlStrndup((const xmlChar *)cur, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033628 desret_xmlChar_ptr(ret_val);
33629 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033630 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033631 des_int(n_len, len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033632 xmlResetLastError();
33633 if (mem_base != xmlMemBlocks()) {
33634 printf("Leak of %d blocks found in xmlStrndup",
33635 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033636 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033637 printf(" %d", n_cur);
33638 printf(" %d", n_len);
33639 printf("\n");
33640 }
33641 }
33642 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033643 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033644
Daniel Veillard42595322004-11-08 10:52:06 +000033645 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033646}
33647
33648
33649static int
33650test_xmlStrstr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033651 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033652
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033653 int mem_base;
33654 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033655 xmlChar * str; /* the xmlChar * array (haystack) */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033656 int n_str;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033657 xmlChar * val; /* the xmlChar to search (needle) */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033658 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033659
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033660 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33661 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
33662 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033663 str = gen_const_xmlChar_ptr(n_str, 0);
33664 val = gen_const_xmlChar_ptr(n_val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033665
William M. Brackf13f77f2004-11-12 16:03:48 +000033666 ret_val = xmlStrstr((const xmlChar *)str, (const xmlChar *)val);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033667 desret_const_xmlChar_ptr(ret_val);
33668 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033669 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
33670 des_const_xmlChar_ptr(n_val, (const xmlChar *)val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033671 xmlResetLastError();
33672 if (mem_base != xmlMemBlocks()) {
33673 printf("Leak of %d blocks found in xmlStrstr",
33674 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033675 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033676 printf(" %d", n_str);
33677 printf(" %d", n_val);
33678 printf("\n");
33679 }
33680 }
33681 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033682 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033683
Daniel Veillard42595322004-11-08 10:52:06 +000033684 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033685}
33686
33687
33688static int
33689test_xmlStrsub(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033690 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033691
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033692 int mem_base;
33693 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033694 xmlChar * str; /* the xmlChar * array (haystack) */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033695 int n_str;
33696 int start; /* the index of the first char (zero based) */
33697 int n_start;
33698 int len; /* the length of the substring */
33699 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033700
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033701 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33702 for (n_start = 0;n_start < gen_nb_int;n_start++) {
33703 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33704 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033705 str = gen_const_xmlChar_ptr(n_str, 0);
33706 start = gen_int(n_start, 1);
33707 len = gen_int(n_len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033708
William M. Brackf13f77f2004-11-12 16:03:48 +000033709 ret_val = xmlStrsub((const xmlChar *)str, start, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033710 desret_xmlChar_ptr(ret_val);
33711 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033712 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033713 des_int(n_start, start, 1);
33714 des_int(n_len, len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033715 xmlResetLastError();
33716 if (mem_base != xmlMemBlocks()) {
33717 printf("Leak of %d blocks found in xmlStrsub",
33718 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033719 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033720 printf(" %d", n_str);
33721 printf(" %d", n_start);
33722 printf(" %d", n_len);
33723 printf("\n");
33724 }
33725 }
33726 }
33727 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033728 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033729
Daniel Veillard42595322004-11-08 10:52:06 +000033730 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033731}
33732
33733
33734static int
33735test_xmlUTF8Charcmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033736 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033737
33738 int mem_base;
33739 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033740 xmlChar * utf1; /* pointer to first UTF8 char */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033741 int n_utf1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033742 xmlChar * utf2; /* pointer to second UTF8 char */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033743 int n_utf2;
33744
33745 for (n_utf1 = 0;n_utf1 < gen_nb_const_xmlChar_ptr;n_utf1++) {
33746 for (n_utf2 = 0;n_utf2 < gen_nb_const_xmlChar_ptr;n_utf2++) {
33747 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033748 utf1 = gen_const_xmlChar_ptr(n_utf1, 0);
33749 utf2 = gen_const_xmlChar_ptr(n_utf2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033750
William M. Brackf13f77f2004-11-12 16:03:48 +000033751 ret_val = xmlUTF8Charcmp((const xmlChar *)utf1, (const xmlChar *)utf2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033752 desret_int(ret_val);
33753 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033754 des_const_xmlChar_ptr(n_utf1, (const xmlChar *)utf1, 0);
33755 des_const_xmlChar_ptr(n_utf2, (const xmlChar *)utf2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033756 xmlResetLastError();
33757 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033758 printf("Leak of %d blocks found in xmlUTF8Charcmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033759 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033760 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033761 printf(" %d", n_utf1);
33762 printf(" %d", n_utf2);
33763 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033764 }
33765 }
33766 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033767 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033768
Daniel Veillard42595322004-11-08 10:52:06 +000033769 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033770}
33771
33772
33773static int
33774test_xmlUTF8Size(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033775 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033776
33777 int mem_base;
33778 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033779 xmlChar * utf; /* pointer to the UTF8 character */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033780 int n_utf;
33781
33782 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33783 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033784 utf = gen_const_xmlChar_ptr(n_utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033785
William M. Brackf13f77f2004-11-12 16:03:48 +000033786 ret_val = xmlUTF8Size((const xmlChar *)utf);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033787 desret_int(ret_val);
33788 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033789 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033790 xmlResetLastError();
33791 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033792 printf("Leak of %d blocks found in xmlUTF8Size",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033793 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033794 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033795 printf(" %d", n_utf);
33796 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033797 }
33798 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033799 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033800
Daniel Veillard42595322004-11-08 10:52:06 +000033801 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033802}
33803
33804
33805static int
33806test_xmlUTF8Strlen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033807 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033808
33809 int mem_base;
33810 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033811 xmlChar * utf; /* a sequence of UTF-8 encoded bytes */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033812 int n_utf;
33813
33814 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33815 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033816 utf = gen_const_xmlChar_ptr(n_utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033817
William M. Brackf13f77f2004-11-12 16:03:48 +000033818 ret_val = xmlUTF8Strlen((const xmlChar *)utf);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033819 desret_int(ret_val);
33820 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033821 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033822 xmlResetLastError();
33823 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033824 printf("Leak of %d blocks found in xmlUTF8Strlen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033825 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033826 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033827 printf(" %d", n_utf);
33828 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033829 }
33830 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033831 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033832
Daniel Veillard42595322004-11-08 10:52:06 +000033833 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033834}
33835
33836
33837static int
33838test_xmlUTF8Strloc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033839 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033840
33841 int mem_base;
33842 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033843 xmlChar * utf; /* the input UTF8 * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033844 int n_utf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033845 xmlChar * utfchar; /* the UTF8 character to be found */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033846 int n_utfchar;
33847
33848 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33849 for (n_utfchar = 0;n_utfchar < gen_nb_const_xmlChar_ptr;n_utfchar++) {
33850 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033851 utf = gen_const_xmlChar_ptr(n_utf, 0);
33852 utfchar = gen_const_xmlChar_ptr(n_utfchar, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033853
William M. Brackf13f77f2004-11-12 16:03:48 +000033854 ret_val = xmlUTF8Strloc((const xmlChar *)utf, (const xmlChar *)utfchar);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033855 desret_int(ret_val);
33856 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033857 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
33858 des_const_xmlChar_ptr(n_utfchar, (const xmlChar *)utfchar, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033859 xmlResetLastError();
33860 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033861 printf("Leak of %d blocks found in xmlUTF8Strloc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033862 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033863 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033864 printf(" %d", n_utf);
33865 printf(" %d", n_utfchar);
33866 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033867 }
33868 }
33869 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033870 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033871
Daniel Veillard42595322004-11-08 10:52:06 +000033872 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033873}
33874
33875
33876static int
33877test_xmlUTF8Strndup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033878 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033879
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033880 int mem_base;
33881 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033882 xmlChar * utf; /* the input UTF8 * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033883 int n_utf;
33884 int len; /* the len of @utf (in chars) */
33885 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033886
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033887 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33888 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33889 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033890 utf = gen_const_xmlChar_ptr(n_utf, 0);
33891 len = gen_int(n_len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033892
William M. Brackf13f77f2004-11-12 16:03:48 +000033893 ret_val = xmlUTF8Strndup((const xmlChar *)utf, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033894 desret_xmlChar_ptr(ret_val);
33895 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033896 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033897 des_int(n_len, len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033898 xmlResetLastError();
33899 if (mem_base != xmlMemBlocks()) {
33900 printf("Leak of %d blocks found in xmlUTF8Strndup",
33901 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033902 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033903 printf(" %d", n_utf);
33904 printf(" %d", n_len);
33905 printf("\n");
33906 }
33907 }
33908 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033909 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033910
Daniel Veillard42595322004-11-08 10:52:06 +000033911 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033912}
33913
33914
33915static int
33916test_xmlUTF8Strpos(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033917 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033918
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033919 int mem_base;
33920 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033921 xmlChar * utf; /* the input UTF8 * */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033922 int n_utf;
33923 int pos; /* the position of the desired UTF8 char (in chars) */
33924 int n_pos;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033925
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033926 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33927 for (n_pos = 0;n_pos < gen_nb_int;n_pos++) {
33928 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033929 utf = gen_const_xmlChar_ptr(n_utf, 0);
33930 pos = gen_int(n_pos, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033931
William M. Brackf13f77f2004-11-12 16:03:48 +000033932 ret_val = xmlUTF8Strpos((const xmlChar *)utf, pos);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033933 desret_const_xmlChar_ptr(ret_val);
33934 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033935 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033936 des_int(n_pos, pos, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033937 xmlResetLastError();
33938 if (mem_base != xmlMemBlocks()) {
33939 printf("Leak of %d blocks found in xmlUTF8Strpos",
33940 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033941 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033942 printf(" %d", n_utf);
33943 printf(" %d", n_pos);
33944 printf("\n");
33945 }
33946 }
33947 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033948 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033949
Daniel Veillard42595322004-11-08 10:52:06 +000033950 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033951}
33952
33953
33954static int
33955test_xmlUTF8Strsize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033956 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033957
33958 int mem_base;
33959 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033960 xmlChar * utf; /* a sequence of UTF-8 encoded bytes */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033961 int n_utf;
33962 int len; /* the number of characters in the array */
33963 int n_len;
33964
33965 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33966 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33967 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033968 utf = gen_const_xmlChar_ptr(n_utf, 0);
33969 len = gen_int(n_len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033970
William M. Brackf13f77f2004-11-12 16:03:48 +000033971 ret_val = xmlUTF8Strsize((const xmlChar *)utf, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033972 desret_int(ret_val);
33973 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033974 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033975 des_int(n_len, len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033976 xmlResetLastError();
33977 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033978 printf("Leak of %d blocks found in xmlUTF8Strsize",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033979 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033980 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033981 printf(" %d", n_utf);
33982 printf(" %d", n_len);
33983 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033984 }
33985 }
33986 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033987 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033988
Daniel Veillard42595322004-11-08 10:52:06 +000033989 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033990}
33991
33992
33993static int
33994test_xmlUTF8Strsub(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033995 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033996
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033997 int mem_base;
33998 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033999 xmlChar * utf; /* a sequence of UTF-8 encoded bytes */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034000 int n_utf;
34001 int start; /* relative pos of first char */
34002 int n_start;
34003 int len; /* total number to copy */
34004 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034005
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034006 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
34007 for (n_start = 0;n_start < gen_nb_int;n_start++) {
34008 for (n_len = 0;n_len < gen_nb_int;n_len++) {
34009 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000034010 utf = gen_const_xmlChar_ptr(n_utf, 0);
34011 start = gen_int(n_start, 1);
34012 len = gen_int(n_len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034013
William M. Brackf13f77f2004-11-12 16:03:48 +000034014 ret_val = xmlUTF8Strsub((const xmlChar *)utf, start, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034015 desret_xmlChar_ptr(ret_val);
34016 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000034017 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000034018 des_int(n_start, start, 1);
34019 des_int(n_len, len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034020 xmlResetLastError();
34021 if (mem_base != xmlMemBlocks()) {
34022 printf("Leak of %d blocks found in xmlUTF8Strsub",
34023 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034024 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000034025 printf(" %d", n_utf);
34026 printf(" %d", n_start);
34027 printf(" %d", n_len);
34028 printf("\n");
34029 }
34030 }
34031 }
34032 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000034033 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034034
Daniel Veillard42595322004-11-08 10:52:06 +000034035 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034036}
34037
34038static int
34039test_xmlstring(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034040 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000034041
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034042 if (quiet == 0) printf("Testing xmlstring : 26 of 30 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000034043 test_ret += test_xmlCharStrdup();
34044 test_ret += test_xmlCharStrndup();
34045 test_ret += test_xmlCheckUTF8();
34046 test_ret += test_xmlGetUTF8Char();
34047 test_ret += test_xmlStrEqual();
34048 test_ret += test_xmlStrPrintf();
34049 test_ret += test_xmlStrQEqual();
34050 test_ret += test_xmlStrVPrintf();
34051 test_ret += test_xmlStrcasecmp();
34052 test_ret += test_xmlStrcasestr();
34053 test_ret += test_xmlStrchr();
34054 test_ret += test_xmlStrcmp();
34055 test_ret += test_xmlStrdup();
34056 test_ret += test_xmlStrlen();
34057 test_ret += test_xmlStrncasecmp();
34058 test_ret += test_xmlStrncatNew();
34059 test_ret += test_xmlStrncmp();
34060 test_ret += test_xmlStrndup();
34061 test_ret += test_xmlStrstr();
34062 test_ret += test_xmlStrsub();
34063 test_ret += test_xmlUTF8Charcmp();
34064 test_ret += test_xmlUTF8Size();
34065 test_ret += test_xmlUTF8Strlen();
34066 test_ret += test_xmlUTF8Strloc();
34067 test_ret += test_xmlUTF8Strndup();
34068 test_ret += test_xmlUTF8Strpos();
34069 test_ret += test_xmlUTF8Strsize();
34070 test_ret += test_xmlUTF8Strsub();
Daniel Veillardd93f6252004-11-02 15:53:51 +000034071
Daniel Veillard42595322004-11-08 10:52:06 +000034072 if (test_ret != 0)
34073 printf("Module xmlstring: %d errors\n", test_ret);
34074 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000034075}
34076
34077static int
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034078test_xmlUCSIsAegeanNumbers(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034079 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034080
William M. Brack21e4ef22005-01-02 09:53:13 +000034081#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034082 int mem_base;
34083 int ret_val;
34084 int code; /* UCS code point */
34085 int n_code;
34086
34087 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34088 mem_base = xmlMemBlocks();
34089 code = gen_int(n_code, 0);
34090
34091 ret_val = xmlUCSIsAegeanNumbers(code);
34092 desret_int(ret_val);
34093 call_tests++;
34094 des_int(n_code, code, 0);
34095 xmlResetLastError();
34096 if (mem_base != xmlMemBlocks()) {
34097 printf("Leak of %d blocks found in xmlUCSIsAegeanNumbers",
34098 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034099 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034100 printf(" %d", n_code);
34101 printf("\n");
34102 }
34103 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034104 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034105#endif
34106
Daniel Veillard42595322004-11-08 10:52:06 +000034107 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034108}
34109
34110
34111static int
34112test_xmlUCSIsAlphabeticPresentationForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034113 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034114
William M. Brack21e4ef22005-01-02 09:53:13 +000034115#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034116 int mem_base;
34117 int ret_val;
34118 int code; /* UCS code point */
34119 int n_code;
34120
34121 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34122 mem_base = xmlMemBlocks();
34123 code = gen_int(n_code, 0);
34124
34125 ret_val = xmlUCSIsAlphabeticPresentationForms(code);
34126 desret_int(ret_val);
34127 call_tests++;
34128 des_int(n_code, code, 0);
34129 xmlResetLastError();
34130 if (mem_base != xmlMemBlocks()) {
34131 printf("Leak of %d blocks found in xmlUCSIsAlphabeticPresentationForms",
34132 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034133 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034134 printf(" %d", n_code);
34135 printf("\n");
34136 }
34137 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034138 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034139#endif
34140
Daniel Veillard42595322004-11-08 10:52:06 +000034141 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034142}
34143
34144
34145static int
34146test_xmlUCSIsArabic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034147 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034148
William M. Brack21e4ef22005-01-02 09:53:13 +000034149#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034150 int mem_base;
34151 int ret_val;
34152 int code; /* UCS code point */
34153 int n_code;
34154
34155 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34156 mem_base = xmlMemBlocks();
34157 code = gen_int(n_code, 0);
34158
34159 ret_val = xmlUCSIsArabic(code);
34160 desret_int(ret_val);
34161 call_tests++;
34162 des_int(n_code, code, 0);
34163 xmlResetLastError();
34164 if (mem_base != xmlMemBlocks()) {
34165 printf("Leak of %d blocks found in xmlUCSIsArabic",
34166 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034167 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034168 printf(" %d", n_code);
34169 printf("\n");
34170 }
34171 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034172 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034173#endif
34174
Daniel Veillard42595322004-11-08 10:52:06 +000034175 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034176}
34177
34178
34179static int
34180test_xmlUCSIsArabicPresentationFormsA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034181 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034182
William M. Brack21e4ef22005-01-02 09:53:13 +000034183#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034184 int mem_base;
34185 int ret_val;
34186 int code; /* UCS code point */
34187 int n_code;
34188
34189 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34190 mem_base = xmlMemBlocks();
34191 code = gen_int(n_code, 0);
34192
34193 ret_val = xmlUCSIsArabicPresentationFormsA(code);
34194 desret_int(ret_val);
34195 call_tests++;
34196 des_int(n_code, code, 0);
34197 xmlResetLastError();
34198 if (mem_base != xmlMemBlocks()) {
34199 printf("Leak of %d blocks found in xmlUCSIsArabicPresentationFormsA",
34200 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034201 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034202 printf(" %d", n_code);
34203 printf("\n");
34204 }
34205 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034206 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034207#endif
34208
Daniel Veillard42595322004-11-08 10:52:06 +000034209 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034210}
34211
34212
34213static int
34214test_xmlUCSIsArabicPresentationFormsB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034215 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034216
William M. Brack21e4ef22005-01-02 09:53:13 +000034217#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034218 int mem_base;
34219 int ret_val;
34220 int code; /* UCS code point */
34221 int n_code;
34222
34223 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34224 mem_base = xmlMemBlocks();
34225 code = gen_int(n_code, 0);
34226
34227 ret_val = xmlUCSIsArabicPresentationFormsB(code);
34228 desret_int(ret_val);
34229 call_tests++;
34230 des_int(n_code, code, 0);
34231 xmlResetLastError();
34232 if (mem_base != xmlMemBlocks()) {
34233 printf("Leak of %d blocks found in xmlUCSIsArabicPresentationFormsB",
34234 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034235 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034236 printf(" %d", n_code);
34237 printf("\n");
34238 }
34239 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034240 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034241#endif
34242
Daniel Veillard42595322004-11-08 10:52:06 +000034243 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034244}
34245
34246
34247static int
34248test_xmlUCSIsArmenian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034249 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034250
William M. Brack21e4ef22005-01-02 09:53:13 +000034251#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034252 int mem_base;
34253 int ret_val;
34254 int code; /* UCS code point */
34255 int n_code;
34256
34257 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34258 mem_base = xmlMemBlocks();
34259 code = gen_int(n_code, 0);
34260
34261 ret_val = xmlUCSIsArmenian(code);
34262 desret_int(ret_val);
34263 call_tests++;
34264 des_int(n_code, code, 0);
34265 xmlResetLastError();
34266 if (mem_base != xmlMemBlocks()) {
34267 printf("Leak of %d blocks found in xmlUCSIsArmenian",
34268 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034269 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034270 printf(" %d", n_code);
34271 printf("\n");
34272 }
34273 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034274 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034275#endif
34276
Daniel Veillard42595322004-11-08 10:52:06 +000034277 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034278}
34279
34280
34281static int
34282test_xmlUCSIsArrows(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034283 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034284
William M. Brack21e4ef22005-01-02 09:53:13 +000034285#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034286 int mem_base;
34287 int ret_val;
34288 int code; /* UCS code point */
34289 int n_code;
34290
34291 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34292 mem_base = xmlMemBlocks();
34293 code = gen_int(n_code, 0);
34294
34295 ret_val = xmlUCSIsArrows(code);
34296 desret_int(ret_val);
34297 call_tests++;
34298 des_int(n_code, code, 0);
34299 xmlResetLastError();
34300 if (mem_base != xmlMemBlocks()) {
34301 printf("Leak of %d blocks found in xmlUCSIsArrows",
34302 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034303 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034304 printf(" %d", n_code);
34305 printf("\n");
34306 }
34307 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034308 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034309#endif
34310
Daniel Veillard42595322004-11-08 10:52:06 +000034311 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034312}
34313
34314
34315static int
34316test_xmlUCSIsBasicLatin(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034317 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034318
William M. Brack21e4ef22005-01-02 09:53:13 +000034319#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034320 int mem_base;
34321 int ret_val;
34322 int code; /* UCS code point */
34323 int n_code;
34324
34325 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34326 mem_base = xmlMemBlocks();
34327 code = gen_int(n_code, 0);
34328
34329 ret_val = xmlUCSIsBasicLatin(code);
34330 desret_int(ret_val);
34331 call_tests++;
34332 des_int(n_code, code, 0);
34333 xmlResetLastError();
34334 if (mem_base != xmlMemBlocks()) {
34335 printf("Leak of %d blocks found in xmlUCSIsBasicLatin",
34336 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034337 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034338 printf(" %d", n_code);
34339 printf("\n");
34340 }
34341 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034342 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034343#endif
34344
Daniel Veillard42595322004-11-08 10:52:06 +000034345 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034346}
34347
34348
34349static int
34350test_xmlUCSIsBengali(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034351 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034352
William M. Brack21e4ef22005-01-02 09:53:13 +000034353#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034354 int mem_base;
34355 int ret_val;
34356 int code; /* UCS code point */
34357 int n_code;
34358
34359 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34360 mem_base = xmlMemBlocks();
34361 code = gen_int(n_code, 0);
34362
34363 ret_val = xmlUCSIsBengali(code);
34364 desret_int(ret_val);
34365 call_tests++;
34366 des_int(n_code, code, 0);
34367 xmlResetLastError();
34368 if (mem_base != xmlMemBlocks()) {
34369 printf("Leak of %d blocks found in xmlUCSIsBengali",
34370 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034371 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034372 printf(" %d", n_code);
34373 printf("\n");
34374 }
34375 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034376 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034377#endif
34378
Daniel Veillard42595322004-11-08 10:52:06 +000034379 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034380}
34381
34382
34383static int
34384test_xmlUCSIsBlock(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034385 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034386
William M. Brack21e4ef22005-01-02 09:53:13 +000034387#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034388 int mem_base;
34389 int ret_val;
34390 int code; /* UCS code point */
34391 int n_code;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034392 char * block; /* UCS block name */
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034393 int n_block;
34394
34395 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34396 for (n_block = 0;n_block < gen_nb_const_char_ptr;n_block++) {
34397 mem_base = xmlMemBlocks();
34398 code = gen_int(n_code, 0);
34399 block = gen_const_char_ptr(n_block, 1);
34400
William M. Brackf13f77f2004-11-12 16:03:48 +000034401 ret_val = xmlUCSIsBlock(code, (const char *)block);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034402 desret_int(ret_val);
34403 call_tests++;
34404 des_int(n_code, code, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000034405 des_const_char_ptr(n_block, (const char *)block, 1);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034406 xmlResetLastError();
34407 if (mem_base != xmlMemBlocks()) {
34408 printf("Leak of %d blocks found in xmlUCSIsBlock",
34409 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034410 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034411 printf(" %d", n_code);
34412 printf(" %d", n_block);
34413 printf("\n");
34414 }
34415 }
34416 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034417 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034418#endif
34419
Daniel Veillard42595322004-11-08 10:52:06 +000034420 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034421}
34422
34423
34424static int
34425test_xmlUCSIsBlockElements(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034426 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034427
William M. Brack21e4ef22005-01-02 09:53:13 +000034428#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034429 int mem_base;
34430 int ret_val;
34431 int code; /* UCS code point */
34432 int n_code;
34433
34434 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34435 mem_base = xmlMemBlocks();
34436 code = gen_int(n_code, 0);
34437
34438 ret_val = xmlUCSIsBlockElements(code);
34439 desret_int(ret_val);
34440 call_tests++;
34441 des_int(n_code, code, 0);
34442 xmlResetLastError();
34443 if (mem_base != xmlMemBlocks()) {
34444 printf("Leak of %d blocks found in xmlUCSIsBlockElements",
34445 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034446 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034447 printf(" %d", n_code);
34448 printf("\n");
34449 }
34450 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034451 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034452#endif
34453
Daniel Veillard42595322004-11-08 10:52:06 +000034454 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034455}
34456
34457
34458static int
34459test_xmlUCSIsBopomofo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034460 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034461
William M. Brack21e4ef22005-01-02 09:53:13 +000034462#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034463 int mem_base;
34464 int ret_val;
34465 int code; /* UCS code point */
34466 int n_code;
34467
34468 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34469 mem_base = xmlMemBlocks();
34470 code = gen_int(n_code, 0);
34471
34472 ret_val = xmlUCSIsBopomofo(code);
34473 desret_int(ret_val);
34474 call_tests++;
34475 des_int(n_code, code, 0);
34476 xmlResetLastError();
34477 if (mem_base != xmlMemBlocks()) {
34478 printf("Leak of %d blocks found in xmlUCSIsBopomofo",
34479 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034480 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034481 printf(" %d", n_code);
34482 printf("\n");
34483 }
34484 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034485 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034486#endif
34487
Daniel Veillard42595322004-11-08 10:52:06 +000034488 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034489}
34490
34491
34492static int
34493test_xmlUCSIsBopomofoExtended(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034494 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034495
William M. Brack21e4ef22005-01-02 09:53:13 +000034496#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034497 int mem_base;
34498 int ret_val;
34499 int code; /* UCS code point */
34500 int n_code;
34501
34502 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34503 mem_base = xmlMemBlocks();
34504 code = gen_int(n_code, 0);
34505
34506 ret_val = xmlUCSIsBopomofoExtended(code);
34507 desret_int(ret_val);
34508 call_tests++;
34509 des_int(n_code, code, 0);
34510 xmlResetLastError();
34511 if (mem_base != xmlMemBlocks()) {
34512 printf("Leak of %d blocks found in xmlUCSIsBopomofoExtended",
34513 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034514 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034515 printf(" %d", n_code);
34516 printf("\n");
34517 }
34518 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034519 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034520#endif
34521
Daniel Veillard42595322004-11-08 10:52:06 +000034522 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034523}
34524
34525
34526static int
34527test_xmlUCSIsBoxDrawing(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034528 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034529
William M. Brack21e4ef22005-01-02 09:53:13 +000034530#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034531 int mem_base;
34532 int ret_val;
34533 int code; /* UCS code point */
34534 int n_code;
34535
34536 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34537 mem_base = xmlMemBlocks();
34538 code = gen_int(n_code, 0);
34539
34540 ret_val = xmlUCSIsBoxDrawing(code);
34541 desret_int(ret_val);
34542 call_tests++;
34543 des_int(n_code, code, 0);
34544 xmlResetLastError();
34545 if (mem_base != xmlMemBlocks()) {
34546 printf("Leak of %d blocks found in xmlUCSIsBoxDrawing",
34547 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034548 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034549 printf(" %d", n_code);
34550 printf("\n");
34551 }
34552 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034553 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034554#endif
34555
Daniel Veillard42595322004-11-08 10:52:06 +000034556 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034557}
34558
34559
34560static int
34561test_xmlUCSIsBraillePatterns(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034562 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034563
William M. Brack21e4ef22005-01-02 09:53:13 +000034564#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034565 int mem_base;
34566 int ret_val;
34567 int code; /* UCS code point */
34568 int n_code;
34569
34570 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34571 mem_base = xmlMemBlocks();
34572 code = gen_int(n_code, 0);
34573
34574 ret_val = xmlUCSIsBraillePatterns(code);
34575 desret_int(ret_val);
34576 call_tests++;
34577 des_int(n_code, code, 0);
34578 xmlResetLastError();
34579 if (mem_base != xmlMemBlocks()) {
34580 printf("Leak of %d blocks found in xmlUCSIsBraillePatterns",
34581 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034582 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034583 printf(" %d", n_code);
34584 printf("\n");
34585 }
34586 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034587 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034588#endif
34589
Daniel Veillard42595322004-11-08 10:52:06 +000034590 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034591}
34592
34593
34594static int
34595test_xmlUCSIsBuhid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034596 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034597
William M. Brack21e4ef22005-01-02 09:53:13 +000034598#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034599 int mem_base;
34600 int ret_val;
34601 int code; /* UCS code point */
34602 int n_code;
34603
34604 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34605 mem_base = xmlMemBlocks();
34606 code = gen_int(n_code, 0);
34607
34608 ret_val = xmlUCSIsBuhid(code);
34609 desret_int(ret_val);
34610 call_tests++;
34611 des_int(n_code, code, 0);
34612 xmlResetLastError();
34613 if (mem_base != xmlMemBlocks()) {
34614 printf("Leak of %d blocks found in xmlUCSIsBuhid",
34615 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034616 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034617 printf(" %d", n_code);
34618 printf("\n");
34619 }
34620 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034621 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034622#endif
34623
Daniel Veillard42595322004-11-08 10:52:06 +000034624 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034625}
34626
34627
34628static int
34629test_xmlUCSIsByzantineMusicalSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034630 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034631
William M. Brack21e4ef22005-01-02 09:53:13 +000034632#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034633 int mem_base;
34634 int ret_val;
34635 int code; /* UCS code point */
34636 int n_code;
34637
34638 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34639 mem_base = xmlMemBlocks();
34640 code = gen_int(n_code, 0);
34641
34642 ret_val = xmlUCSIsByzantineMusicalSymbols(code);
34643 desret_int(ret_val);
34644 call_tests++;
34645 des_int(n_code, code, 0);
34646 xmlResetLastError();
34647 if (mem_base != xmlMemBlocks()) {
34648 printf("Leak of %d blocks found in xmlUCSIsByzantineMusicalSymbols",
34649 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034650 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034651 printf(" %d", n_code);
34652 printf("\n");
34653 }
34654 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034655 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034656#endif
34657
Daniel Veillard42595322004-11-08 10:52:06 +000034658 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034659}
34660
34661
34662static int
34663test_xmlUCSIsCJKCompatibility(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034664 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034665
William M. Brack21e4ef22005-01-02 09:53:13 +000034666#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034667 int mem_base;
34668 int ret_val;
34669 int code; /* UCS code point */
34670 int n_code;
34671
34672 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34673 mem_base = xmlMemBlocks();
34674 code = gen_int(n_code, 0);
34675
34676 ret_val = xmlUCSIsCJKCompatibility(code);
34677 desret_int(ret_val);
34678 call_tests++;
34679 des_int(n_code, code, 0);
34680 xmlResetLastError();
34681 if (mem_base != xmlMemBlocks()) {
34682 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibility",
34683 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034684 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034685 printf(" %d", n_code);
34686 printf("\n");
34687 }
34688 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034689 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034690#endif
34691
Daniel Veillard42595322004-11-08 10:52:06 +000034692 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034693}
34694
34695
34696static int
34697test_xmlUCSIsCJKCompatibilityForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034698 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034699
William M. Brack21e4ef22005-01-02 09:53:13 +000034700#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034701 int mem_base;
34702 int ret_val;
34703 int code; /* UCS code point */
34704 int n_code;
34705
34706 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34707 mem_base = xmlMemBlocks();
34708 code = gen_int(n_code, 0);
34709
34710 ret_val = xmlUCSIsCJKCompatibilityForms(code);
34711 desret_int(ret_val);
34712 call_tests++;
34713 des_int(n_code, code, 0);
34714 xmlResetLastError();
34715 if (mem_base != xmlMemBlocks()) {
34716 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibilityForms",
34717 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034718 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034719 printf(" %d", n_code);
34720 printf("\n");
34721 }
34722 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034723 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034724#endif
34725
Daniel Veillard42595322004-11-08 10:52:06 +000034726 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034727}
34728
34729
34730static int
34731test_xmlUCSIsCJKCompatibilityIdeographs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034732 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034733
William M. Brack21e4ef22005-01-02 09:53:13 +000034734#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034735 int mem_base;
34736 int ret_val;
34737 int code; /* UCS code point */
34738 int n_code;
34739
34740 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34741 mem_base = xmlMemBlocks();
34742 code = gen_int(n_code, 0);
34743
34744 ret_val = xmlUCSIsCJKCompatibilityIdeographs(code);
34745 desret_int(ret_val);
34746 call_tests++;
34747 des_int(n_code, code, 0);
34748 xmlResetLastError();
34749 if (mem_base != xmlMemBlocks()) {
34750 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibilityIdeographs",
34751 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034752 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034753 printf(" %d", n_code);
34754 printf("\n");
34755 }
34756 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034757 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034758#endif
34759
Daniel Veillard42595322004-11-08 10:52:06 +000034760 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034761}
34762
34763
34764static int
34765test_xmlUCSIsCJKCompatibilityIdeographsSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034766 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034767
William M. Brack21e4ef22005-01-02 09:53:13 +000034768#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034769 int mem_base;
34770 int ret_val;
34771 int code; /* UCS code point */
34772 int n_code;
34773
34774 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34775 mem_base = xmlMemBlocks();
34776 code = gen_int(n_code, 0);
34777
34778 ret_val = xmlUCSIsCJKCompatibilityIdeographsSupplement(code);
34779 desret_int(ret_val);
34780 call_tests++;
34781 des_int(n_code, code, 0);
34782 xmlResetLastError();
34783 if (mem_base != xmlMemBlocks()) {
34784 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibilityIdeographsSupplement",
34785 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034786 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034787 printf(" %d", n_code);
34788 printf("\n");
34789 }
34790 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034791 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034792#endif
34793
Daniel Veillard42595322004-11-08 10:52:06 +000034794 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034795}
34796
34797
34798static int
34799test_xmlUCSIsCJKRadicalsSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034800 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034801
William M. Brack21e4ef22005-01-02 09:53:13 +000034802#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034803 int mem_base;
34804 int ret_val;
34805 int code; /* UCS code point */
34806 int n_code;
34807
34808 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34809 mem_base = xmlMemBlocks();
34810 code = gen_int(n_code, 0);
34811
34812 ret_val = xmlUCSIsCJKRadicalsSupplement(code);
34813 desret_int(ret_val);
34814 call_tests++;
34815 des_int(n_code, code, 0);
34816 xmlResetLastError();
34817 if (mem_base != xmlMemBlocks()) {
34818 printf("Leak of %d blocks found in xmlUCSIsCJKRadicalsSupplement",
34819 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034820 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034821 printf(" %d", n_code);
34822 printf("\n");
34823 }
34824 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034825 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034826#endif
34827
Daniel Veillard42595322004-11-08 10:52:06 +000034828 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034829}
34830
34831
34832static int
34833test_xmlUCSIsCJKSymbolsandPunctuation(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034834 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034835
William M. Brack21e4ef22005-01-02 09:53:13 +000034836#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034837 int mem_base;
34838 int ret_val;
34839 int code; /* UCS code point */
34840 int n_code;
34841
34842 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34843 mem_base = xmlMemBlocks();
34844 code = gen_int(n_code, 0);
34845
34846 ret_val = xmlUCSIsCJKSymbolsandPunctuation(code);
34847 desret_int(ret_val);
34848 call_tests++;
34849 des_int(n_code, code, 0);
34850 xmlResetLastError();
34851 if (mem_base != xmlMemBlocks()) {
34852 printf("Leak of %d blocks found in xmlUCSIsCJKSymbolsandPunctuation",
34853 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034854 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034855 printf(" %d", n_code);
34856 printf("\n");
34857 }
34858 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034859 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034860#endif
34861
Daniel Veillard42595322004-11-08 10:52:06 +000034862 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034863}
34864
34865
34866static int
34867test_xmlUCSIsCJKUnifiedIdeographs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034868 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034869
William M. Brack21e4ef22005-01-02 09:53:13 +000034870#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034871 int mem_base;
34872 int ret_val;
34873 int code; /* UCS code point */
34874 int n_code;
34875
34876 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34877 mem_base = xmlMemBlocks();
34878 code = gen_int(n_code, 0);
34879
34880 ret_val = xmlUCSIsCJKUnifiedIdeographs(code);
34881 desret_int(ret_val);
34882 call_tests++;
34883 des_int(n_code, code, 0);
34884 xmlResetLastError();
34885 if (mem_base != xmlMemBlocks()) {
34886 printf("Leak of %d blocks found in xmlUCSIsCJKUnifiedIdeographs",
34887 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034888 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034889 printf(" %d", n_code);
34890 printf("\n");
34891 }
34892 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034893 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034894#endif
34895
Daniel Veillard42595322004-11-08 10:52:06 +000034896 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034897}
34898
34899
34900static int
34901test_xmlUCSIsCJKUnifiedIdeographsExtensionA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034902 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034903
William M. Brack21e4ef22005-01-02 09:53:13 +000034904#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034905 int mem_base;
34906 int ret_val;
34907 int code; /* UCS code point */
34908 int n_code;
34909
34910 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34911 mem_base = xmlMemBlocks();
34912 code = gen_int(n_code, 0);
34913
34914 ret_val = xmlUCSIsCJKUnifiedIdeographsExtensionA(code);
34915 desret_int(ret_val);
34916 call_tests++;
34917 des_int(n_code, code, 0);
34918 xmlResetLastError();
34919 if (mem_base != xmlMemBlocks()) {
34920 printf("Leak of %d blocks found in xmlUCSIsCJKUnifiedIdeographsExtensionA",
34921 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034922 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034923 printf(" %d", n_code);
34924 printf("\n");
34925 }
34926 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034927 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034928#endif
34929
Daniel Veillard42595322004-11-08 10:52:06 +000034930 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034931}
34932
34933
34934static int
34935test_xmlUCSIsCJKUnifiedIdeographsExtensionB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034936 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034937
William M. Brack21e4ef22005-01-02 09:53:13 +000034938#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034939 int mem_base;
34940 int ret_val;
34941 int code; /* UCS code point */
34942 int n_code;
34943
34944 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34945 mem_base = xmlMemBlocks();
34946 code = gen_int(n_code, 0);
34947
34948 ret_val = xmlUCSIsCJKUnifiedIdeographsExtensionB(code);
34949 desret_int(ret_val);
34950 call_tests++;
34951 des_int(n_code, code, 0);
34952 xmlResetLastError();
34953 if (mem_base != xmlMemBlocks()) {
34954 printf("Leak of %d blocks found in xmlUCSIsCJKUnifiedIdeographsExtensionB",
34955 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034956 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034957 printf(" %d", n_code);
34958 printf("\n");
34959 }
34960 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034961 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034962#endif
34963
Daniel Veillard42595322004-11-08 10:52:06 +000034964 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034965}
34966
34967
34968static int
34969test_xmlUCSIsCat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034970 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034971
William M. Brack21e4ef22005-01-02 09:53:13 +000034972#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034973 int mem_base;
34974 int ret_val;
34975 int code; /* UCS code point */
34976 int n_code;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034977 char * cat; /* UCS Category name */
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034978 int n_cat;
34979
34980 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34981 for (n_cat = 0;n_cat < gen_nb_const_char_ptr;n_cat++) {
34982 mem_base = xmlMemBlocks();
34983 code = gen_int(n_code, 0);
34984 cat = gen_const_char_ptr(n_cat, 1);
34985
William M. Brackf13f77f2004-11-12 16:03:48 +000034986 ret_val = xmlUCSIsCat(code, (const char *)cat);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034987 desret_int(ret_val);
34988 call_tests++;
34989 des_int(n_code, code, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000034990 des_const_char_ptr(n_cat, (const char *)cat, 1);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034991 xmlResetLastError();
34992 if (mem_base != xmlMemBlocks()) {
34993 printf("Leak of %d blocks found in xmlUCSIsCat",
34994 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034995 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034996 printf(" %d", n_code);
34997 printf(" %d", n_cat);
34998 printf("\n");
34999 }
35000 }
35001 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035002 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035003#endif
35004
Daniel Veillard42595322004-11-08 10:52:06 +000035005 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035006}
35007
35008
35009static int
35010test_xmlUCSIsCatC(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035011 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035012
William M. Brack21e4ef22005-01-02 09:53:13 +000035013#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035014 int mem_base;
35015 int ret_val;
35016 int code; /* UCS code point */
35017 int n_code;
35018
35019 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35020 mem_base = xmlMemBlocks();
35021 code = gen_int(n_code, 0);
35022
35023 ret_val = xmlUCSIsCatC(code);
35024 desret_int(ret_val);
35025 call_tests++;
35026 des_int(n_code, code, 0);
35027 xmlResetLastError();
35028 if (mem_base != xmlMemBlocks()) {
35029 printf("Leak of %d blocks found in xmlUCSIsCatC",
35030 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035031 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035032 printf(" %d", n_code);
35033 printf("\n");
35034 }
35035 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035036 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035037#endif
35038
Daniel Veillard42595322004-11-08 10:52:06 +000035039 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035040}
35041
35042
35043static int
35044test_xmlUCSIsCatCc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035045 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035046
William M. Brack21e4ef22005-01-02 09:53:13 +000035047#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035048 int mem_base;
35049 int ret_val;
35050 int code; /* UCS code point */
35051 int n_code;
35052
35053 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35054 mem_base = xmlMemBlocks();
35055 code = gen_int(n_code, 0);
35056
35057 ret_val = xmlUCSIsCatCc(code);
35058 desret_int(ret_val);
35059 call_tests++;
35060 des_int(n_code, code, 0);
35061 xmlResetLastError();
35062 if (mem_base != xmlMemBlocks()) {
35063 printf("Leak of %d blocks found in xmlUCSIsCatCc",
35064 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035065 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035066 printf(" %d", n_code);
35067 printf("\n");
35068 }
35069 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035070 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035071#endif
35072
Daniel Veillard42595322004-11-08 10:52:06 +000035073 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035074}
35075
35076
35077static int
35078test_xmlUCSIsCatCf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035079 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035080
William M. Brack21e4ef22005-01-02 09:53:13 +000035081#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035082 int mem_base;
35083 int ret_val;
35084 int code; /* UCS code point */
35085 int n_code;
35086
35087 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35088 mem_base = xmlMemBlocks();
35089 code = gen_int(n_code, 0);
35090
35091 ret_val = xmlUCSIsCatCf(code);
35092 desret_int(ret_val);
35093 call_tests++;
35094 des_int(n_code, code, 0);
35095 xmlResetLastError();
35096 if (mem_base != xmlMemBlocks()) {
35097 printf("Leak of %d blocks found in xmlUCSIsCatCf",
35098 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035099 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035100 printf(" %d", n_code);
35101 printf("\n");
35102 }
35103 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035104 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035105#endif
35106
Daniel Veillard42595322004-11-08 10:52:06 +000035107 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035108}
35109
35110
35111static int
35112test_xmlUCSIsCatCo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035113 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035114
William M. Brack21e4ef22005-01-02 09:53:13 +000035115#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035116 int mem_base;
35117 int ret_val;
35118 int code; /* UCS code point */
35119 int n_code;
35120
35121 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35122 mem_base = xmlMemBlocks();
35123 code = gen_int(n_code, 0);
35124
35125 ret_val = xmlUCSIsCatCo(code);
35126 desret_int(ret_val);
35127 call_tests++;
35128 des_int(n_code, code, 0);
35129 xmlResetLastError();
35130 if (mem_base != xmlMemBlocks()) {
35131 printf("Leak of %d blocks found in xmlUCSIsCatCo",
35132 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035133 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035134 printf(" %d", n_code);
35135 printf("\n");
35136 }
35137 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035138 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035139#endif
35140
Daniel Veillard42595322004-11-08 10:52:06 +000035141 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035142}
35143
35144
35145static int
35146test_xmlUCSIsCatCs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035147 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035148
William M. Brack21e4ef22005-01-02 09:53:13 +000035149#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035150 int mem_base;
35151 int ret_val;
35152 int code; /* UCS code point */
35153 int n_code;
35154
35155 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35156 mem_base = xmlMemBlocks();
35157 code = gen_int(n_code, 0);
35158
35159 ret_val = xmlUCSIsCatCs(code);
35160 desret_int(ret_val);
35161 call_tests++;
35162 des_int(n_code, code, 0);
35163 xmlResetLastError();
35164 if (mem_base != xmlMemBlocks()) {
35165 printf("Leak of %d blocks found in xmlUCSIsCatCs",
35166 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035167 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035168 printf(" %d", n_code);
35169 printf("\n");
35170 }
35171 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035172 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035173#endif
35174
Daniel Veillard42595322004-11-08 10:52:06 +000035175 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035176}
35177
35178
35179static int
35180test_xmlUCSIsCatL(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035181 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035182
William M. Brack21e4ef22005-01-02 09:53:13 +000035183#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035184 int mem_base;
35185 int ret_val;
35186 int code; /* UCS code point */
35187 int n_code;
35188
35189 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35190 mem_base = xmlMemBlocks();
35191 code = gen_int(n_code, 0);
35192
35193 ret_val = xmlUCSIsCatL(code);
35194 desret_int(ret_val);
35195 call_tests++;
35196 des_int(n_code, code, 0);
35197 xmlResetLastError();
35198 if (mem_base != xmlMemBlocks()) {
35199 printf("Leak of %d blocks found in xmlUCSIsCatL",
35200 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035201 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035202 printf(" %d", n_code);
35203 printf("\n");
35204 }
35205 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035206 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035207#endif
35208
Daniel Veillard42595322004-11-08 10:52:06 +000035209 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035210}
35211
35212
35213static int
35214test_xmlUCSIsCatLl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035215 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035216
William M. Brack21e4ef22005-01-02 09:53:13 +000035217#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035218 int mem_base;
35219 int ret_val;
35220 int code; /* UCS code point */
35221 int n_code;
35222
35223 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35224 mem_base = xmlMemBlocks();
35225 code = gen_int(n_code, 0);
35226
35227 ret_val = xmlUCSIsCatLl(code);
35228 desret_int(ret_val);
35229 call_tests++;
35230 des_int(n_code, code, 0);
35231 xmlResetLastError();
35232 if (mem_base != xmlMemBlocks()) {
35233 printf("Leak of %d blocks found in xmlUCSIsCatLl",
35234 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035235 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035236 printf(" %d", n_code);
35237 printf("\n");
35238 }
35239 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035240 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035241#endif
35242
Daniel Veillard42595322004-11-08 10:52:06 +000035243 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035244}
35245
35246
35247static int
35248test_xmlUCSIsCatLm(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035249 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035250
William M. Brack21e4ef22005-01-02 09:53:13 +000035251#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035252 int mem_base;
35253 int ret_val;
35254 int code; /* UCS code point */
35255 int n_code;
35256
35257 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35258 mem_base = xmlMemBlocks();
35259 code = gen_int(n_code, 0);
35260
35261 ret_val = xmlUCSIsCatLm(code);
35262 desret_int(ret_val);
35263 call_tests++;
35264 des_int(n_code, code, 0);
35265 xmlResetLastError();
35266 if (mem_base != xmlMemBlocks()) {
35267 printf("Leak of %d blocks found in xmlUCSIsCatLm",
35268 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035269 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035270 printf(" %d", n_code);
35271 printf("\n");
35272 }
35273 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035274 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035275#endif
35276
Daniel Veillard42595322004-11-08 10:52:06 +000035277 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035278}
35279
35280
35281static int
35282test_xmlUCSIsCatLo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035283 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035284
William M. Brack21e4ef22005-01-02 09:53:13 +000035285#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035286 int mem_base;
35287 int ret_val;
35288 int code; /* UCS code point */
35289 int n_code;
35290
35291 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35292 mem_base = xmlMemBlocks();
35293 code = gen_int(n_code, 0);
35294
35295 ret_val = xmlUCSIsCatLo(code);
35296 desret_int(ret_val);
35297 call_tests++;
35298 des_int(n_code, code, 0);
35299 xmlResetLastError();
35300 if (mem_base != xmlMemBlocks()) {
35301 printf("Leak of %d blocks found in xmlUCSIsCatLo",
35302 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035303 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035304 printf(" %d", n_code);
35305 printf("\n");
35306 }
35307 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035308 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035309#endif
35310
Daniel Veillard42595322004-11-08 10:52:06 +000035311 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035312}
35313
35314
35315static int
35316test_xmlUCSIsCatLt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035317 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035318
William M. Brack21e4ef22005-01-02 09:53:13 +000035319#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035320 int mem_base;
35321 int ret_val;
35322 int code; /* UCS code point */
35323 int n_code;
35324
35325 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35326 mem_base = xmlMemBlocks();
35327 code = gen_int(n_code, 0);
35328
35329 ret_val = xmlUCSIsCatLt(code);
35330 desret_int(ret_val);
35331 call_tests++;
35332 des_int(n_code, code, 0);
35333 xmlResetLastError();
35334 if (mem_base != xmlMemBlocks()) {
35335 printf("Leak of %d blocks found in xmlUCSIsCatLt",
35336 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035337 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035338 printf(" %d", n_code);
35339 printf("\n");
35340 }
35341 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035342 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035343#endif
35344
Daniel Veillard42595322004-11-08 10:52:06 +000035345 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035346}
35347
35348
35349static int
35350test_xmlUCSIsCatLu(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035351 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035352
William M. Brack21e4ef22005-01-02 09:53:13 +000035353#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035354 int mem_base;
35355 int ret_val;
35356 int code; /* UCS code point */
35357 int n_code;
35358
35359 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35360 mem_base = xmlMemBlocks();
35361 code = gen_int(n_code, 0);
35362
35363 ret_val = xmlUCSIsCatLu(code);
35364 desret_int(ret_val);
35365 call_tests++;
35366 des_int(n_code, code, 0);
35367 xmlResetLastError();
35368 if (mem_base != xmlMemBlocks()) {
35369 printf("Leak of %d blocks found in xmlUCSIsCatLu",
35370 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035371 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035372 printf(" %d", n_code);
35373 printf("\n");
35374 }
35375 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035376 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035377#endif
35378
Daniel Veillard42595322004-11-08 10:52:06 +000035379 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035380}
35381
35382
35383static int
35384test_xmlUCSIsCatM(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035385 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035386
William M. Brack21e4ef22005-01-02 09:53:13 +000035387#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035388 int mem_base;
35389 int ret_val;
35390 int code; /* UCS code point */
35391 int n_code;
35392
35393 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35394 mem_base = xmlMemBlocks();
35395 code = gen_int(n_code, 0);
35396
35397 ret_val = xmlUCSIsCatM(code);
35398 desret_int(ret_val);
35399 call_tests++;
35400 des_int(n_code, code, 0);
35401 xmlResetLastError();
35402 if (mem_base != xmlMemBlocks()) {
35403 printf("Leak of %d blocks found in xmlUCSIsCatM",
35404 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035405 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035406 printf(" %d", n_code);
35407 printf("\n");
35408 }
35409 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035410 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035411#endif
35412
Daniel Veillard42595322004-11-08 10:52:06 +000035413 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035414}
35415
35416
35417static int
35418test_xmlUCSIsCatMc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035419 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035420
William M. Brack21e4ef22005-01-02 09:53:13 +000035421#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035422 int mem_base;
35423 int ret_val;
35424 int code; /* UCS code point */
35425 int n_code;
35426
35427 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35428 mem_base = xmlMemBlocks();
35429 code = gen_int(n_code, 0);
35430
35431 ret_val = xmlUCSIsCatMc(code);
35432 desret_int(ret_val);
35433 call_tests++;
35434 des_int(n_code, code, 0);
35435 xmlResetLastError();
35436 if (mem_base != xmlMemBlocks()) {
35437 printf("Leak of %d blocks found in xmlUCSIsCatMc",
35438 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035439 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035440 printf(" %d", n_code);
35441 printf("\n");
35442 }
35443 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035444 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035445#endif
35446
Daniel Veillard42595322004-11-08 10:52:06 +000035447 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035448}
35449
35450
35451static int
35452test_xmlUCSIsCatMe(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035453 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035454
William M. Brack21e4ef22005-01-02 09:53:13 +000035455#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035456 int mem_base;
35457 int ret_val;
35458 int code; /* UCS code point */
35459 int n_code;
35460
35461 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35462 mem_base = xmlMemBlocks();
35463 code = gen_int(n_code, 0);
35464
35465 ret_val = xmlUCSIsCatMe(code);
35466 desret_int(ret_val);
35467 call_tests++;
35468 des_int(n_code, code, 0);
35469 xmlResetLastError();
35470 if (mem_base != xmlMemBlocks()) {
35471 printf("Leak of %d blocks found in xmlUCSIsCatMe",
35472 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035473 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035474 printf(" %d", n_code);
35475 printf("\n");
35476 }
35477 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035478 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035479#endif
35480
Daniel Veillard42595322004-11-08 10:52:06 +000035481 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035482}
35483
35484
35485static int
35486test_xmlUCSIsCatMn(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035487 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035488
William M. Brack21e4ef22005-01-02 09:53:13 +000035489#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035490 int mem_base;
35491 int ret_val;
35492 int code; /* UCS code point */
35493 int n_code;
35494
35495 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35496 mem_base = xmlMemBlocks();
35497 code = gen_int(n_code, 0);
35498
35499 ret_val = xmlUCSIsCatMn(code);
35500 desret_int(ret_val);
35501 call_tests++;
35502 des_int(n_code, code, 0);
35503 xmlResetLastError();
35504 if (mem_base != xmlMemBlocks()) {
35505 printf("Leak of %d blocks found in xmlUCSIsCatMn",
35506 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035507 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035508 printf(" %d", n_code);
35509 printf("\n");
35510 }
35511 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035512 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035513#endif
35514
Daniel Veillard42595322004-11-08 10:52:06 +000035515 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035516}
35517
35518
35519static int
35520test_xmlUCSIsCatN(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035521 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035522
William M. Brack21e4ef22005-01-02 09:53:13 +000035523#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035524 int mem_base;
35525 int ret_val;
35526 int code; /* UCS code point */
35527 int n_code;
35528
35529 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35530 mem_base = xmlMemBlocks();
35531 code = gen_int(n_code, 0);
35532
35533 ret_val = xmlUCSIsCatN(code);
35534 desret_int(ret_val);
35535 call_tests++;
35536 des_int(n_code, code, 0);
35537 xmlResetLastError();
35538 if (mem_base != xmlMemBlocks()) {
35539 printf("Leak of %d blocks found in xmlUCSIsCatN",
35540 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035541 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035542 printf(" %d", n_code);
35543 printf("\n");
35544 }
35545 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035546 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035547#endif
35548
Daniel Veillard42595322004-11-08 10:52:06 +000035549 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035550}
35551
35552
35553static int
35554test_xmlUCSIsCatNd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035555 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035556
William M. Brack21e4ef22005-01-02 09:53:13 +000035557#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035558 int mem_base;
35559 int ret_val;
35560 int code; /* UCS code point */
35561 int n_code;
35562
35563 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35564 mem_base = xmlMemBlocks();
35565 code = gen_int(n_code, 0);
35566
35567 ret_val = xmlUCSIsCatNd(code);
35568 desret_int(ret_val);
35569 call_tests++;
35570 des_int(n_code, code, 0);
35571 xmlResetLastError();
35572 if (mem_base != xmlMemBlocks()) {
35573 printf("Leak of %d blocks found in xmlUCSIsCatNd",
35574 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035575 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035576 printf(" %d", n_code);
35577 printf("\n");
35578 }
35579 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035580 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035581#endif
35582
Daniel Veillard42595322004-11-08 10:52:06 +000035583 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035584}
35585
35586
35587static int
35588test_xmlUCSIsCatNl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035589 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035590
William M. Brack21e4ef22005-01-02 09:53:13 +000035591#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035592 int mem_base;
35593 int ret_val;
35594 int code; /* UCS code point */
35595 int n_code;
35596
35597 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35598 mem_base = xmlMemBlocks();
35599 code = gen_int(n_code, 0);
35600
35601 ret_val = xmlUCSIsCatNl(code);
35602 desret_int(ret_val);
35603 call_tests++;
35604 des_int(n_code, code, 0);
35605 xmlResetLastError();
35606 if (mem_base != xmlMemBlocks()) {
35607 printf("Leak of %d blocks found in xmlUCSIsCatNl",
35608 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035609 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035610 printf(" %d", n_code);
35611 printf("\n");
35612 }
35613 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035614 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035615#endif
35616
Daniel Veillard42595322004-11-08 10:52:06 +000035617 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035618}
35619
35620
35621static int
35622test_xmlUCSIsCatNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035623 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035624
William M. Brack21e4ef22005-01-02 09:53:13 +000035625#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035626 int mem_base;
35627 int ret_val;
35628 int code; /* UCS code point */
35629 int n_code;
35630
35631 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35632 mem_base = xmlMemBlocks();
35633 code = gen_int(n_code, 0);
35634
35635 ret_val = xmlUCSIsCatNo(code);
35636 desret_int(ret_val);
35637 call_tests++;
35638 des_int(n_code, code, 0);
35639 xmlResetLastError();
35640 if (mem_base != xmlMemBlocks()) {
35641 printf("Leak of %d blocks found in xmlUCSIsCatNo",
35642 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035643 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035644 printf(" %d", n_code);
35645 printf("\n");
35646 }
35647 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035648 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035649#endif
35650
Daniel Veillard42595322004-11-08 10:52:06 +000035651 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035652}
35653
35654
35655static int
35656test_xmlUCSIsCatP(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035657 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035658
William M. Brack21e4ef22005-01-02 09:53:13 +000035659#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035660 int mem_base;
35661 int ret_val;
35662 int code; /* UCS code point */
35663 int n_code;
35664
35665 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35666 mem_base = xmlMemBlocks();
35667 code = gen_int(n_code, 0);
35668
35669 ret_val = xmlUCSIsCatP(code);
35670 desret_int(ret_val);
35671 call_tests++;
35672 des_int(n_code, code, 0);
35673 xmlResetLastError();
35674 if (mem_base != xmlMemBlocks()) {
35675 printf("Leak of %d blocks found in xmlUCSIsCatP",
35676 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035677 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035678 printf(" %d", n_code);
35679 printf("\n");
35680 }
35681 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035682 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035683#endif
35684
Daniel Veillard42595322004-11-08 10:52:06 +000035685 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035686}
35687
35688
35689static int
35690test_xmlUCSIsCatPc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035691 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035692
William M. Brack21e4ef22005-01-02 09:53:13 +000035693#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035694 int mem_base;
35695 int ret_val;
35696 int code; /* UCS code point */
35697 int n_code;
35698
35699 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35700 mem_base = xmlMemBlocks();
35701 code = gen_int(n_code, 0);
35702
35703 ret_val = xmlUCSIsCatPc(code);
35704 desret_int(ret_val);
35705 call_tests++;
35706 des_int(n_code, code, 0);
35707 xmlResetLastError();
35708 if (mem_base != xmlMemBlocks()) {
35709 printf("Leak of %d blocks found in xmlUCSIsCatPc",
35710 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035711 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035712 printf(" %d", n_code);
35713 printf("\n");
35714 }
35715 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035716 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035717#endif
35718
Daniel Veillard42595322004-11-08 10:52:06 +000035719 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035720}
35721
35722
35723static int
35724test_xmlUCSIsCatPd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035725 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035726
William M. Brack21e4ef22005-01-02 09:53:13 +000035727#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035728 int mem_base;
35729 int ret_val;
35730 int code; /* UCS code point */
35731 int n_code;
35732
35733 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35734 mem_base = xmlMemBlocks();
35735 code = gen_int(n_code, 0);
35736
35737 ret_val = xmlUCSIsCatPd(code);
35738 desret_int(ret_val);
35739 call_tests++;
35740 des_int(n_code, code, 0);
35741 xmlResetLastError();
35742 if (mem_base != xmlMemBlocks()) {
35743 printf("Leak of %d blocks found in xmlUCSIsCatPd",
35744 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035745 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035746 printf(" %d", n_code);
35747 printf("\n");
35748 }
35749 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035750 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035751#endif
35752
Daniel Veillard42595322004-11-08 10:52:06 +000035753 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035754}
35755
35756
35757static int
35758test_xmlUCSIsCatPe(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035759 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035760
William M. Brack21e4ef22005-01-02 09:53:13 +000035761#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035762 int mem_base;
35763 int ret_val;
35764 int code; /* UCS code point */
35765 int n_code;
35766
35767 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35768 mem_base = xmlMemBlocks();
35769 code = gen_int(n_code, 0);
35770
35771 ret_val = xmlUCSIsCatPe(code);
35772 desret_int(ret_val);
35773 call_tests++;
35774 des_int(n_code, code, 0);
35775 xmlResetLastError();
35776 if (mem_base != xmlMemBlocks()) {
35777 printf("Leak of %d blocks found in xmlUCSIsCatPe",
35778 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035779 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035780 printf(" %d", n_code);
35781 printf("\n");
35782 }
35783 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035784 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035785#endif
35786
Daniel Veillard42595322004-11-08 10:52:06 +000035787 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035788}
35789
35790
35791static int
35792test_xmlUCSIsCatPf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035793 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035794
William M. Brack21e4ef22005-01-02 09:53:13 +000035795#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035796 int mem_base;
35797 int ret_val;
35798 int code; /* UCS code point */
35799 int n_code;
35800
35801 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35802 mem_base = xmlMemBlocks();
35803 code = gen_int(n_code, 0);
35804
35805 ret_val = xmlUCSIsCatPf(code);
35806 desret_int(ret_val);
35807 call_tests++;
35808 des_int(n_code, code, 0);
35809 xmlResetLastError();
35810 if (mem_base != xmlMemBlocks()) {
35811 printf("Leak of %d blocks found in xmlUCSIsCatPf",
35812 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035813 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035814 printf(" %d", n_code);
35815 printf("\n");
35816 }
35817 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035818 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035819#endif
35820
Daniel Veillard42595322004-11-08 10:52:06 +000035821 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035822}
35823
35824
35825static int
35826test_xmlUCSIsCatPi(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035827 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035828
William M. Brack21e4ef22005-01-02 09:53:13 +000035829#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035830 int mem_base;
35831 int ret_val;
35832 int code; /* UCS code point */
35833 int n_code;
35834
35835 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35836 mem_base = xmlMemBlocks();
35837 code = gen_int(n_code, 0);
35838
35839 ret_val = xmlUCSIsCatPi(code);
35840 desret_int(ret_val);
35841 call_tests++;
35842 des_int(n_code, code, 0);
35843 xmlResetLastError();
35844 if (mem_base != xmlMemBlocks()) {
35845 printf("Leak of %d blocks found in xmlUCSIsCatPi",
35846 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035847 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035848 printf(" %d", n_code);
35849 printf("\n");
35850 }
35851 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035852 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035853#endif
35854
Daniel Veillard42595322004-11-08 10:52:06 +000035855 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035856}
35857
35858
35859static int
35860test_xmlUCSIsCatPo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035861 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035862
William M. Brack21e4ef22005-01-02 09:53:13 +000035863#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035864 int mem_base;
35865 int ret_val;
35866 int code; /* UCS code point */
35867 int n_code;
35868
35869 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35870 mem_base = xmlMemBlocks();
35871 code = gen_int(n_code, 0);
35872
35873 ret_val = xmlUCSIsCatPo(code);
35874 desret_int(ret_val);
35875 call_tests++;
35876 des_int(n_code, code, 0);
35877 xmlResetLastError();
35878 if (mem_base != xmlMemBlocks()) {
35879 printf("Leak of %d blocks found in xmlUCSIsCatPo",
35880 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035881 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035882 printf(" %d", n_code);
35883 printf("\n");
35884 }
35885 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035886 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035887#endif
35888
Daniel Veillard42595322004-11-08 10:52:06 +000035889 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035890}
35891
35892
35893static int
35894test_xmlUCSIsCatPs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035895 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035896
William M. Brack21e4ef22005-01-02 09:53:13 +000035897#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035898 int mem_base;
35899 int ret_val;
35900 int code; /* UCS code point */
35901 int n_code;
35902
35903 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35904 mem_base = xmlMemBlocks();
35905 code = gen_int(n_code, 0);
35906
35907 ret_val = xmlUCSIsCatPs(code);
35908 desret_int(ret_val);
35909 call_tests++;
35910 des_int(n_code, code, 0);
35911 xmlResetLastError();
35912 if (mem_base != xmlMemBlocks()) {
35913 printf("Leak of %d blocks found in xmlUCSIsCatPs",
35914 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035915 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035916 printf(" %d", n_code);
35917 printf("\n");
35918 }
35919 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035920 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035921#endif
35922
Daniel Veillard42595322004-11-08 10:52:06 +000035923 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035924}
35925
35926
35927static int
35928test_xmlUCSIsCatS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035929 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035930
William M. Brack21e4ef22005-01-02 09:53:13 +000035931#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035932 int mem_base;
35933 int ret_val;
35934 int code; /* UCS code point */
35935 int n_code;
35936
35937 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35938 mem_base = xmlMemBlocks();
35939 code = gen_int(n_code, 0);
35940
35941 ret_val = xmlUCSIsCatS(code);
35942 desret_int(ret_val);
35943 call_tests++;
35944 des_int(n_code, code, 0);
35945 xmlResetLastError();
35946 if (mem_base != xmlMemBlocks()) {
35947 printf("Leak of %d blocks found in xmlUCSIsCatS",
35948 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035949 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035950 printf(" %d", n_code);
35951 printf("\n");
35952 }
35953 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035954 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035955#endif
35956
Daniel Veillard42595322004-11-08 10:52:06 +000035957 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035958}
35959
35960
35961static int
35962test_xmlUCSIsCatSc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035963 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035964
William M. Brack21e4ef22005-01-02 09:53:13 +000035965#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035966 int mem_base;
35967 int ret_val;
35968 int code; /* UCS code point */
35969 int n_code;
35970
35971 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35972 mem_base = xmlMemBlocks();
35973 code = gen_int(n_code, 0);
35974
35975 ret_val = xmlUCSIsCatSc(code);
35976 desret_int(ret_val);
35977 call_tests++;
35978 des_int(n_code, code, 0);
35979 xmlResetLastError();
35980 if (mem_base != xmlMemBlocks()) {
35981 printf("Leak of %d blocks found in xmlUCSIsCatSc",
35982 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035983 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035984 printf(" %d", n_code);
35985 printf("\n");
35986 }
35987 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035988 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035989#endif
35990
Daniel Veillard42595322004-11-08 10:52:06 +000035991 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035992}
35993
35994
35995static int
35996test_xmlUCSIsCatSk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035997 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035998
William M. Brack21e4ef22005-01-02 09:53:13 +000035999#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036000 int mem_base;
36001 int ret_val;
36002 int code; /* UCS code point */
36003 int n_code;
36004
36005 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36006 mem_base = xmlMemBlocks();
36007 code = gen_int(n_code, 0);
36008
36009 ret_val = xmlUCSIsCatSk(code);
36010 desret_int(ret_val);
36011 call_tests++;
36012 des_int(n_code, code, 0);
36013 xmlResetLastError();
36014 if (mem_base != xmlMemBlocks()) {
36015 printf("Leak of %d blocks found in xmlUCSIsCatSk",
36016 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036017 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036018 printf(" %d", n_code);
36019 printf("\n");
36020 }
36021 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036022 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036023#endif
36024
Daniel Veillard42595322004-11-08 10:52:06 +000036025 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036026}
36027
36028
36029static int
36030test_xmlUCSIsCatSm(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036031 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036032
William M. Brack21e4ef22005-01-02 09:53:13 +000036033#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036034 int mem_base;
36035 int ret_val;
36036 int code; /* UCS code point */
36037 int n_code;
36038
36039 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36040 mem_base = xmlMemBlocks();
36041 code = gen_int(n_code, 0);
36042
36043 ret_val = xmlUCSIsCatSm(code);
36044 desret_int(ret_val);
36045 call_tests++;
36046 des_int(n_code, code, 0);
36047 xmlResetLastError();
36048 if (mem_base != xmlMemBlocks()) {
36049 printf("Leak of %d blocks found in xmlUCSIsCatSm",
36050 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036051 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036052 printf(" %d", n_code);
36053 printf("\n");
36054 }
36055 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036056 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036057#endif
36058
Daniel Veillard42595322004-11-08 10:52:06 +000036059 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036060}
36061
36062
36063static int
36064test_xmlUCSIsCatSo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036065 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036066
William M. Brack21e4ef22005-01-02 09:53:13 +000036067#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036068 int mem_base;
36069 int ret_val;
36070 int code; /* UCS code point */
36071 int n_code;
36072
36073 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36074 mem_base = xmlMemBlocks();
36075 code = gen_int(n_code, 0);
36076
36077 ret_val = xmlUCSIsCatSo(code);
36078 desret_int(ret_val);
36079 call_tests++;
36080 des_int(n_code, code, 0);
36081 xmlResetLastError();
36082 if (mem_base != xmlMemBlocks()) {
36083 printf("Leak of %d blocks found in xmlUCSIsCatSo",
36084 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036085 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036086 printf(" %d", n_code);
36087 printf("\n");
36088 }
36089 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036090 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036091#endif
36092
Daniel Veillard42595322004-11-08 10:52:06 +000036093 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036094}
36095
36096
36097static int
36098test_xmlUCSIsCatZ(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036099 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036100
William M. Brack21e4ef22005-01-02 09:53:13 +000036101#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036102 int mem_base;
36103 int ret_val;
36104 int code; /* UCS code point */
36105 int n_code;
36106
36107 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36108 mem_base = xmlMemBlocks();
36109 code = gen_int(n_code, 0);
36110
36111 ret_val = xmlUCSIsCatZ(code);
36112 desret_int(ret_val);
36113 call_tests++;
36114 des_int(n_code, code, 0);
36115 xmlResetLastError();
36116 if (mem_base != xmlMemBlocks()) {
36117 printf("Leak of %d blocks found in xmlUCSIsCatZ",
36118 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036119 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036120 printf(" %d", n_code);
36121 printf("\n");
36122 }
36123 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036124 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036125#endif
36126
Daniel Veillard42595322004-11-08 10:52:06 +000036127 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036128}
36129
36130
36131static int
36132test_xmlUCSIsCatZl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036133 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036134
William M. Brack21e4ef22005-01-02 09:53:13 +000036135#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036136 int mem_base;
36137 int ret_val;
36138 int code; /* UCS code point */
36139 int n_code;
36140
36141 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36142 mem_base = xmlMemBlocks();
36143 code = gen_int(n_code, 0);
36144
36145 ret_val = xmlUCSIsCatZl(code);
36146 desret_int(ret_val);
36147 call_tests++;
36148 des_int(n_code, code, 0);
36149 xmlResetLastError();
36150 if (mem_base != xmlMemBlocks()) {
36151 printf("Leak of %d blocks found in xmlUCSIsCatZl",
36152 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036153 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036154 printf(" %d", n_code);
36155 printf("\n");
36156 }
36157 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036158 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036159#endif
36160
Daniel Veillard42595322004-11-08 10:52:06 +000036161 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036162}
36163
36164
36165static int
36166test_xmlUCSIsCatZp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036167 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036168
William M. Brack21e4ef22005-01-02 09:53:13 +000036169#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036170 int mem_base;
36171 int ret_val;
36172 int code; /* UCS code point */
36173 int n_code;
36174
36175 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36176 mem_base = xmlMemBlocks();
36177 code = gen_int(n_code, 0);
36178
36179 ret_val = xmlUCSIsCatZp(code);
36180 desret_int(ret_val);
36181 call_tests++;
36182 des_int(n_code, code, 0);
36183 xmlResetLastError();
36184 if (mem_base != xmlMemBlocks()) {
36185 printf("Leak of %d blocks found in xmlUCSIsCatZp",
36186 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036187 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036188 printf(" %d", n_code);
36189 printf("\n");
36190 }
36191 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036192 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036193#endif
36194
Daniel Veillard42595322004-11-08 10:52:06 +000036195 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036196}
36197
36198
36199static int
36200test_xmlUCSIsCatZs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036201 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036202
William M. Brack21e4ef22005-01-02 09:53:13 +000036203#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036204 int mem_base;
36205 int ret_val;
36206 int code; /* UCS code point */
36207 int n_code;
36208
36209 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36210 mem_base = xmlMemBlocks();
36211 code = gen_int(n_code, 0);
36212
36213 ret_val = xmlUCSIsCatZs(code);
36214 desret_int(ret_val);
36215 call_tests++;
36216 des_int(n_code, code, 0);
36217 xmlResetLastError();
36218 if (mem_base != xmlMemBlocks()) {
36219 printf("Leak of %d blocks found in xmlUCSIsCatZs",
36220 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036221 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036222 printf(" %d", n_code);
36223 printf("\n");
36224 }
36225 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036226 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036227#endif
36228
Daniel Veillard42595322004-11-08 10:52:06 +000036229 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036230}
36231
36232
36233static int
36234test_xmlUCSIsCherokee(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036235 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036236
William M. Brack21e4ef22005-01-02 09:53:13 +000036237#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036238 int mem_base;
36239 int ret_val;
36240 int code; /* UCS code point */
36241 int n_code;
36242
36243 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36244 mem_base = xmlMemBlocks();
36245 code = gen_int(n_code, 0);
36246
36247 ret_val = xmlUCSIsCherokee(code);
36248 desret_int(ret_val);
36249 call_tests++;
36250 des_int(n_code, code, 0);
36251 xmlResetLastError();
36252 if (mem_base != xmlMemBlocks()) {
36253 printf("Leak of %d blocks found in xmlUCSIsCherokee",
36254 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036255 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036256 printf(" %d", n_code);
36257 printf("\n");
36258 }
36259 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036260 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036261#endif
36262
Daniel Veillard42595322004-11-08 10:52:06 +000036263 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036264}
36265
36266
36267static int
36268test_xmlUCSIsCombiningDiacriticalMarks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036269 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036270
William M. Brack21e4ef22005-01-02 09:53:13 +000036271#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036272 int mem_base;
36273 int ret_val;
36274 int code; /* UCS code point */
36275 int n_code;
36276
36277 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36278 mem_base = xmlMemBlocks();
36279 code = gen_int(n_code, 0);
36280
36281 ret_val = xmlUCSIsCombiningDiacriticalMarks(code);
36282 desret_int(ret_val);
36283 call_tests++;
36284 des_int(n_code, code, 0);
36285 xmlResetLastError();
36286 if (mem_base != xmlMemBlocks()) {
36287 printf("Leak of %d blocks found in xmlUCSIsCombiningDiacriticalMarks",
36288 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036289 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036290 printf(" %d", n_code);
36291 printf("\n");
36292 }
36293 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036294 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036295#endif
36296
Daniel Veillard42595322004-11-08 10:52:06 +000036297 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036298}
36299
36300
36301static int
36302test_xmlUCSIsCombiningDiacriticalMarksforSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036303 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036304
William M. Brack21e4ef22005-01-02 09:53:13 +000036305#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036306 int mem_base;
36307 int ret_val;
36308 int code; /* UCS code point */
36309 int n_code;
36310
36311 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36312 mem_base = xmlMemBlocks();
36313 code = gen_int(n_code, 0);
36314
36315 ret_val = xmlUCSIsCombiningDiacriticalMarksforSymbols(code);
36316 desret_int(ret_val);
36317 call_tests++;
36318 des_int(n_code, code, 0);
36319 xmlResetLastError();
36320 if (mem_base != xmlMemBlocks()) {
36321 printf("Leak of %d blocks found in xmlUCSIsCombiningDiacriticalMarksforSymbols",
36322 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036323 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036324 printf(" %d", n_code);
36325 printf("\n");
36326 }
36327 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036328 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036329#endif
36330
Daniel Veillard42595322004-11-08 10:52:06 +000036331 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036332}
36333
36334
36335static int
36336test_xmlUCSIsCombiningHalfMarks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036337 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036338
William M. Brack21e4ef22005-01-02 09:53:13 +000036339#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036340 int mem_base;
36341 int ret_val;
36342 int code; /* UCS code point */
36343 int n_code;
36344
36345 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36346 mem_base = xmlMemBlocks();
36347 code = gen_int(n_code, 0);
36348
36349 ret_val = xmlUCSIsCombiningHalfMarks(code);
36350 desret_int(ret_val);
36351 call_tests++;
36352 des_int(n_code, code, 0);
36353 xmlResetLastError();
36354 if (mem_base != xmlMemBlocks()) {
36355 printf("Leak of %d blocks found in xmlUCSIsCombiningHalfMarks",
36356 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036357 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036358 printf(" %d", n_code);
36359 printf("\n");
36360 }
36361 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036362 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036363#endif
36364
Daniel Veillard42595322004-11-08 10:52:06 +000036365 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036366}
36367
36368
36369static int
36370test_xmlUCSIsCombiningMarksforSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036371 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036372
William M. Brack21e4ef22005-01-02 09:53:13 +000036373#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036374 int mem_base;
36375 int ret_val;
36376 int code; /* UCS code point */
36377 int n_code;
36378
36379 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36380 mem_base = xmlMemBlocks();
36381 code = gen_int(n_code, 0);
36382
36383 ret_val = xmlUCSIsCombiningMarksforSymbols(code);
36384 desret_int(ret_val);
36385 call_tests++;
36386 des_int(n_code, code, 0);
36387 xmlResetLastError();
36388 if (mem_base != xmlMemBlocks()) {
36389 printf("Leak of %d blocks found in xmlUCSIsCombiningMarksforSymbols",
36390 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036391 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036392 printf(" %d", n_code);
36393 printf("\n");
36394 }
36395 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036396 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036397#endif
36398
Daniel Veillard42595322004-11-08 10:52:06 +000036399 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036400}
36401
36402
36403static int
36404test_xmlUCSIsControlPictures(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036405 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036406
William M. Brack21e4ef22005-01-02 09:53:13 +000036407#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036408 int mem_base;
36409 int ret_val;
36410 int code; /* UCS code point */
36411 int n_code;
36412
36413 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36414 mem_base = xmlMemBlocks();
36415 code = gen_int(n_code, 0);
36416
36417 ret_val = xmlUCSIsControlPictures(code);
36418 desret_int(ret_val);
36419 call_tests++;
36420 des_int(n_code, code, 0);
36421 xmlResetLastError();
36422 if (mem_base != xmlMemBlocks()) {
36423 printf("Leak of %d blocks found in xmlUCSIsControlPictures",
36424 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036425 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036426 printf(" %d", n_code);
36427 printf("\n");
36428 }
36429 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036430 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036431#endif
36432
Daniel Veillard42595322004-11-08 10:52:06 +000036433 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036434}
36435
36436
36437static int
36438test_xmlUCSIsCurrencySymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036439 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036440
William M. Brack21e4ef22005-01-02 09:53:13 +000036441#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036442 int mem_base;
36443 int ret_val;
36444 int code; /* UCS code point */
36445 int n_code;
36446
36447 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36448 mem_base = xmlMemBlocks();
36449 code = gen_int(n_code, 0);
36450
36451 ret_val = xmlUCSIsCurrencySymbols(code);
36452 desret_int(ret_val);
36453 call_tests++;
36454 des_int(n_code, code, 0);
36455 xmlResetLastError();
36456 if (mem_base != xmlMemBlocks()) {
36457 printf("Leak of %d blocks found in xmlUCSIsCurrencySymbols",
36458 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036459 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036460 printf(" %d", n_code);
36461 printf("\n");
36462 }
36463 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036464 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036465#endif
36466
Daniel Veillard42595322004-11-08 10:52:06 +000036467 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036468}
36469
36470
36471static int
36472test_xmlUCSIsCypriotSyllabary(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036473 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036474
William M. Brack21e4ef22005-01-02 09:53:13 +000036475#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036476 int mem_base;
36477 int ret_val;
36478 int code; /* UCS code point */
36479 int n_code;
36480
36481 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36482 mem_base = xmlMemBlocks();
36483 code = gen_int(n_code, 0);
36484
36485 ret_val = xmlUCSIsCypriotSyllabary(code);
36486 desret_int(ret_val);
36487 call_tests++;
36488 des_int(n_code, code, 0);
36489 xmlResetLastError();
36490 if (mem_base != xmlMemBlocks()) {
36491 printf("Leak of %d blocks found in xmlUCSIsCypriotSyllabary",
36492 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036493 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036494 printf(" %d", n_code);
36495 printf("\n");
36496 }
36497 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036498 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036499#endif
36500
Daniel Veillard42595322004-11-08 10:52:06 +000036501 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036502}
36503
36504
36505static int
36506test_xmlUCSIsCyrillic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036507 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036508
William M. Brack21e4ef22005-01-02 09:53:13 +000036509#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036510 int mem_base;
36511 int ret_val;
36512 int code; /* UCS code point */
36513 int n_code;
36514
36515 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36516 mem_base = xmlMemBlocks();
36517 code = gen_int(n_code, 0);
36518
36519 ret_val = xmlUCSIsCyrillic(code);
36520 desret_int(ret_val);
36521 call_tests++;
36522 des_int(n_code, code, 0);
36523 xmlResetLastError();
36524 if (mem_base != xmlMemBlocks()) {
36525 printf("Leak of %d blocks found in xmlUCSIsCyrillic",
36526 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036527 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036528 printf(" %d", n_code);
36529 printf("\n");
36530 }
36531 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036532 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036533#endif
36534
Daniel Veillard42595322004-11-08 10:52:06 +000036535 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036536}
36537
36538
36539static int
36540test_xmlUCSIsCyrillicSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036541 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036542
William M. Brack21e4ef22005-01-02 09:53:13 +000036543#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036544 int mem_base;
36545 int ret_val;
36546 int code; /* UCS code point */
36547 int n_code;
36548
36549 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36550 mem_base = xmlMemBlocks();
36551 code = gen_int(n_code, 0);
36552
36553 ret_val = xmlUCSIsCyrillicSupplement(code);
36554 desret_int(ret_val);
36555 call_tests++;
36556 des_int(n_code, code, 0);
36557 xmlResetLastError();
36558 if (mem_base != xmlMemBlocks()) {
36559 printf("Leak of %d blocks found in xmlUCSIsCyrillicSupplement",
36560 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036561 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036562 printf(" %d", n_code);
36563 printf("\n");
36564 }
36565 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036566 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036567#endif
36568
Daniel Veillard42595322004-11-08 10:52:06 +000036569 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036570}
36571
36572
36573static int
36574test_xmlUCSIsDeseret(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036575 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036576
William M. Brack21e4ef22005-01-02 09:53:13 +000036577#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036578 int mem_base;
36579 int ret_val;
36580 int code; /* UCS code point */
36581 int n_code;
36582
36583 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36584 mem_base = xmlMemBlocks();
36585 code = gen_int(n_code, 0);
36586
36587 ret_val = xmlUCSIsDeseret(code);
36588 desret_int(ret_val);
36589 call_tests++;
36590 des_int(n_code, code, 0);
36591 xmlResetLastError();
36592 if (mem_base != xmlMemBlocks()) {
36593 printf("Leak of %d blocks found in xmlUCSIsDeseret",
36594 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036595 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036596 printf(" %d", n_code);
36597 printf("\n");
36598 }
36599 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036600 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036601#endif
36602
Daniel Veillard42595322004-11-08 10:52:06 +000036603 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036604}
36605
36606
36607static int
36608test_xmlUCSIsDevanagari(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036609 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036610
William M. Brack21e4ef22005-01-02 09:53:13 +000036611#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036612 int mem_base;
36613 int ret_val;
36614 int code; /* UCS code point */
36615 int n_code;
36616
36617 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36618 mem_base = xmlMemBlocks();
36619 code = gen_int(n_code, 0);
36620
36621 ret_val = xmlUCSIsDevanagari(code);
36622 desret_int(ret_val);
36623 call_tests++;
36624 des_int(n_code, code, 0);
36625 xmlResetLastError();
36626 if (mem_base != xmlMemBlocks()) {
36627 printf("Leak of %d blocks found in xmlUCSIsDevanagari",
36628 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036629 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036630 printf(" %d", n_code);
36631 printf("\n");
36632 }
36633 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036634 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036635#endif
36636
Daniel Veillard42595322004-11-08 10:52:06 +000036637 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036638}
36639
36640
36641static int
36642test_xmlUCSIsDingbats(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036643 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036644
William M. Brack21e4ef22005-01-02 09:53:13 +000036645#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036646 int mem_base;
36647 int ret_val;
36648 int code; /* UCS code point */
36649 int n_code;
36650
36651 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36652 mem_base = xmlMemBlocks();
36653 code = gen_int(n_code, 0);
36654
36655 ret_val = xmlUCSIsDingbats(code);
36656 desret_int(ret_val);
36657 call_tests++;
36658 des_int(n_code, code, 0);
36659 xmlResetLastError();
36660 if (mem_base != xmlMemBlocks()) {
36661 printf("Leak of %d blocks found in xmlUCSIsDingbats",
36662 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036663 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036664 printf(" %d", n_code);
36665 printf("\n");
36666 }
36667 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036668 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036669#endif
36670
Daniel Veillard42595322004-11-08 10:52:06 +000036671 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036672}
36673
36674
36675static int
36676test_xmlUCSIsEnclosedAlphanumerics(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036677 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036678
William M. Brack21e4ef22005-01-02 09:53:13 +000036679#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036680 int mem_base;
36681 int ret_val;
36682 int code; /* UCS code point */
36683 int n_code;
36684
36685 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36686 mem_base = xmlMemBlocks();
36687 code = gen_int(n_code, 0);
36688
36689 ret_val = xmlUCSIsEnclosedAlphanumerics(code);
36690 desret_int(ret_val);
36691 call_tests++;
36692 des_int(n_code, code, 0);
36693 xmlResetLastError();
36694 if (mem_base != xmlMemBlocks()) {
36695 printf("Leak of %d blocks found in xmlUCSIsEnclosedAlphanumerics",
36696 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036697 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036698 printf(" %d", n_code);
36699 printf("\n");
36700 }
36701 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036702 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036703#endif
36704
Daniel Veillard42595322004-11-08 10:52:06 +000036705 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036706}
36707
36708
36709static int
36710test_xmlUCSIsEnclosedCJKLettersandMonths(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036711 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036712
William M. Brack21e4ef22005-01-02 09:53:13 +000036713#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036714 int mem_base;
36715 int ret_val;
36716 int code; /* UCS code point */
36717 int n_code;
36718
36719 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36720 mem_base = xmlMemBlocks();
36721 code = gen_int(n_code, 0);
36722
36723 ret_val = xmlUCSIsEnclosedCJKLettersandMonths(code);
36724 desret_int(ret_val);
36725 call_tests++;
36726 des_int(n_code, code, 0);
36727 xmlResetLastError();
36728 if (mem_base != xmlMemBlocks()) {
36729 printf("Leak of %d blocks found in xmlUCSIsEnclosedCJKLettersandMonths",
36730 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036731 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036732 printf(" %d", n_code);
36733 printf("\n");
36734 }
36735 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036736 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036737#endif
36738
Daniel Veillard42595322004-11-08 10:52:06 +000036739 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036740}
36741
36742
36743static int
36744test_xmlUCSIsEthiopic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036745 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036746
William M. Brack21e4ef22005-01-02 09:53:13 +000036747#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036748 int mem_base;
36749 int ret_val;
36750 int code; /* UCS code point */
36751 int n_code;
36752
36753 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36754 mem_base = xmlMemBlocks();
36755 code = gen_int(n_code, 0);
36756
36757 ret_val = xmlUCSIsEthiopic(code);
36758 desret_int(ret_val);
36759 call_tests++;
36760 des_int(n_code, code, 0);
36761 xmlResetLastError();
36762 if (mem_base != xmlMemBlocks()) {
36763 printf("Leak of %d blocks found in xmlUCSIsEthiopic",
36764 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036765 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036766 printf(" %d", n_code);
36767 printf("\n");
36768 }
36769 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036770 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036771#endif
36772
Daniel Veillard42595322004-11-08 10:52:06 +000036773 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036774}
36775
36776
36777static int
36778test_xmlUCSIsGeneralPunctuation(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036779 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036780
William M. Brack21e4ef22005-01-02 09:53:13 +000036781#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036782 int mem_base;
36783 int ret_val;
36784 int code; /* UCS code point */
36785 int n_code;
36786
36787 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36788 mem_base = xmlMemBlocks();
36789 code = gen_int(n_code, 0);
36790
36791 ret_val = xmlUCSIsGeneralPunctuation(code);
36792 desret_int(ret_val);
36793 call_tests++;
36794 des_int(n_code, code, 0);
36795 xmlResetLastError();
36796 if (mem_base != xmlMemBlocks()) {
36797 printf("Leak of %d blocks found in xmlUCSIsGeneralPunctuation",
36798 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036799 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036800 printf(" %d", n_code);
36801 printf("\n");
36802 }
36803 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036804 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036805#endif
36806
Daniel Veillard42595322004-11-08 10:52:06 +000036807 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036808}
36809
36810
36811static int
36812test_xmlUCSIsGeometricShapes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036813 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036814
William M. Brack21e4ef22005-01-02 09:53:13 +000036815#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036816 int mem_base;
36817 int ret_val;
36818 int code; /* UCS code point */
36819 int n_code;
36820
36821 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36822 mem_base = xmlMemBlocks();
36823 code = gen_int(n_code, 0);
36824
36825 ret_val = xmlUCSIsGeometricShapes(code);
36826 desret_int(ret_val);
36827 call_tests++;
36828 des_int(n_code, code, 0);
36829 xmlResetLastError();
36830 if (mem_base != xmlMemBlocks()) {
36831 printf("Leak of %d blocks found in xmlUCSIsGeometricShapes",
36832 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036833 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036834 printf(" %d", n_code);
36835 printf("\n");
36836 }
36837 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036838 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036839#endif
36840
Daniel Veillard42595322004-11-08 10:52:06 +000036841 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036842}
36843
36844
36845static int
36846test_xmlUCSIsGeorgian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036847 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036848
William M. Brack21e4ef22005-01-02 09:53:13 +000036849#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036850 int mem_base;
36851 int ret_val;
36852 int code; /* UCS code point */
36853 int n_code;
36854
36855 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36856 mem_base = xmlMemBlocks();
36857 code = gen_int(n_code, 0);
36858
36859 ret_val = xmlUCSIsGeorgian(code);
36860 desret_int(ret_val);
36861 call_tests++;
36862 des_int(n_code, code, 0);
36863 xmlResetLastError();
36864 if (mem_base != xmlMemBlocks()) {
36865 printf("Leak of %d blocks found in xmlUCSIsGeorgian",
36866 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036867 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036868 printf(" %d", n_code);
36869 printf("\n");
36870 }
36871 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036872 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036873#endif
36874
Daniel Veillard42595322004-11-08 10:52:06 +000036875 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036876}
36877
36878
36879static int
36880test_xmlUCSIsGothic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036881 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036882
William M. Brack21e4ef22005-01-02 09:53:13 +000036883#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036884 int mem_base;
36885 int ret_val;
36886 int code; /* UCS code point */
36887 int n_code;
36888
36889 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36890 mem_base = xmlMemBlocks();
36891 code = gen_int(n_code, 0);
36892
36893 ret_val = xmlUCSIsGothic(code);
36894 desret_int(ret_val);
36895 call_tests++;
36896 des_int(n_code, code, 0);
36897 xmlResetLastError();
36898 if (mem_base != xmlMemBlocks()) {
36899 printf("Leak of %d blocks found in xmlUCSIsGothic",
36900 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036901 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036902 printf(" %d", n_code);
36903 printf("\n");
36904 }
36905 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036906 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036907#endif
36908
Daniel Veillard42595322004-11-08 10:52:06 +000036909 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036910}
36911
36912
36913static int
36914test_xmlUCSIsGreek(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036915 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036916
William M. Brack21e4ef22005-01-02 09:53:13 +000036917#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036918 int mem_base;
36919 int ret_val;
36920 int code; /* UCS code point */
36921 int n_code;
36922
36923 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36924 mem_base = xmlMemBlocks();
36925 code = gen_int(n_code, 0);
36926
36927 ret_val = xmlUCSIsGreek(code);
36928 desret_int(ret_val);
36929 call_tests++;
36930 des_int(n_code, code, 0);
36931 xmlResetLastError();
36932 if (mem_base != xmlMemBlocks()) {
36933 printf("Leak of %d blocks found in xmlUCSIsGreek",
36934 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036935 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036936 printf(" %d", n_code);
36937 printf("\n");
36938 }
36939 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036940 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036941#endif
36942
Daniel Veillard42595322004-11-08 10:52:06 +000036943 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036944}
36945
36946
36947static int
36948test_xmlUCSIsGreekExtended(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036949 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036950
William M. Brack21e4ef22005-01-02 09:53:13 +000036951#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036952 int mem_base;
36953 int ret_val;
36954 int code; /* UCS code point */
36955 int n_code;
36956
36957 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36958 mem_base = xmlMemBlocks();
36959 code = gen_int(n_code, 0);
36960
36961 ret_val = xmlUCSIsGreekExtended(code);
36962 desret_int(ret_val);
36963 call_tests++;
36964 des_int(n_code, code, 0);
36965 xmlResetLastError();
36966 if (mem_base != xmlMemBlocks()) {
36967 printf("Leak of %d blocks found in xmlUCSIsGreekExtended",
36968 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036969 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036970 printf(" %d", n_code);
36971 printf("\n");
36972 }
36973 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036974 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036975#endif
36976
Daniel Veillard42595322004-11-08 10:52:06 +000036977 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036978}
36979
36980
36981static int
36982test_xmlUCSIsGreekandCoptic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036983 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036984
William M. Brack21e4ef22005-01-02 09:53:13 +000036985#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036986 int mem_base;
36987 int ret_val;
36988 int code; /* UCS code point */
36989 int n_code;
36990
36991 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36992 mem_base = xmlMemBlocks();
36993 code = gen_int(n_code, 0);
36994
36995 ret_val = xmlUCSIsGreekandCoptic(code);
36996 desret_int(ret_val);
36997 call_tests++;
36998 des_int(n_code, code, 0);
36999 xmlResetLastError();
37000 if (mem_base != xmlMemBlocks()) {
37001 printf("Leak of %d blocks found in xmlUCSIsGreekandCoptic",
37002 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037003 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037004 printf(" %d", n_code);
37005 printf("\n");
37006 }
37007 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037008 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037009#endif
37010
Daniel Veillard42595322004-11-08 10:52:06 +000037011 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037012}
37013
37014
37015static int
37016test_xmlUCSIsGujarati(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037017 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037018
William M. Brack21e4ef22005-01-02 09:53:13 +000037019#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037020 int mem_base;
37021 int ret_val;
37022 int code; /* UCS code point */
37023 int n_code;
37024
37025 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37026 mem_base = xmlMemBlocks();
37027 code = gen_int(n_code, 0);
37028
37029 ret_val = xmlUCSIsGujarati(code);
37030 desret_int(ret_val);
37031 call_tests++;
37032 des_int(n_code, code, 0);
37033 xmlResetLastError();
37034 if (mem_base != xmlMemBlocks()) {
37035 printf("Leak of %d blocks found in xmlUCSIsGujarati",
37036 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037037 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037038 printf(" %d", n_code);
37039 printf("\n");
37040 }
37041 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037042 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037043#endif
37044
Daniel Veillard42595322004-11-08 10:52:06 +000037045 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037046}
37047
37048
37049static int
37050test_xmlUCSIsGurmukhi(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037051 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037052
William M. Brack21e4ef22005-01-02 09:53:13 +000037053#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037054 int mem_base;
37055 int ret_val;
37056 int code; /* UCS code point */
37057 int n_code;
37058
37059 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37060 mem_base = xmlMemBlocks();
37061 code = gen_int(n_code, 0);
37062
37063 ret_val = xmlUCSIsGurmukhi(code);
37064 desret_int(ret_val);
37065 call_tests++;
37066 des_int(n_code, code, 0);
37067 xmlResetLastError();
37068 if (mem_base != xmlMemBlocks()) {
37069 printf("Leak of %d blocks found in xmlUCSIsGurmukhi",
37070 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037071 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037072 printf(" %d", n_code);
37073 printf("\n");
37074 }
37075 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037076 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037077#endif
37078
Daniel Veillard42595322004-11-08 10:52:06 +000037079 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037080}
37081
37082
37083static int
37084test_xmlUCSIsHalfwidthandFullwidthForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037085 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037086
William M. Brack21e4ef22005-01-02 09:53:13 +000037087#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037088 int mem_base;
37089 int ret_val;
37090 int code; /* UCS code point */
37091 int n_code;
37092
37093 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37094 mem_base = xmlMemBlocks();
37095 code = gen_int(n_code, 0);
37096
37097 ret_val = xmlUCSIsHalfwidthandFullwidthForms(code);
37098 desret_int(ret_val);
37099 call_tests++;
37100 des_int(n_code, code, 0);
37101 xmlResetLastError();
37102 if (mem_base != xmlMemBlocks()) {
37103 printf("Leak of %d blocks found in xmlUCSIsHalfwidthandFullwidthForms",
37104 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037105 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037106 printf(" %d", n_code);
37107 printf("\n");
37108 }
37109 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037110 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037111#endif
37112
Daniel Veillard42595322004-11-08 10:52:06 +000037113 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037114}
37115
37116
37117static int
37118test_xmlUCSIsHangulCompatibilityJamo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037119 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037120
William M. Brack21e4ef22005-01-02 09:53:13 +000037121#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037122 int mem_base;
37123 int ret_val;
37124 int code; /* UCS code point */
37125 int n_code;
37126
37127 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37128 mem_base = xmlMemBlocks();
37129 code = gen_int(n_code, 0);
37130
37131 ret_val = xmlUCSIsHangulCompatibilityJamo(code);
37132 desret_int(ret_val);
37133 call_tests++;
37134 des_int(n_code, code, 0);
37135 xmlResetLastError();
37136 if (mem_base != xmlMemBlocks()) {
37137 printf("Leak of %d blocks found in xmlUCSIsHangulCompatibilityJamo",
37138 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037139 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037140 printf(" %d", n_code);
37141 printf("\n");
37142 }
37143 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037144 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037145#endif
37146
Daniel Veillard42595322004-11-08 10:52:06 +000037147 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037148}
37149
37150
37151static int
37152test_xmlUCSIsHangulJamo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037153 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037154
William M. Brack21e4ef22005-01-02 09:53:13 +000037155#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037156 int mem_base;
37157 int ret_val;
37158 int code; /* UCS code point */
37159 int n_code;
37160
37161 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37162 mem_base = xmlMemBlocks();
37163 code = gen_int(n_code, 0);
37164
37165 ret_val = xmlUCSIsHangulJamo(code);
37166 desret_int(ret_val);
37167 call_tests++;
37168 des_int(n_code, code, 0);
37169 xmlResetLastError();
37170 if (mem_base != xmlMemBlocks()) {
37171 printf("Leak of %d blocks found in xmlUCSIsHangulJamo",
37172 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037173 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037174 printf(" %d", n_code);
37175 printf("\n");
37176 }
37177 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037178 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037179#endif
37180
Daniel Veillard42595322004-11-08 10:52:06 +000037181 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037182}
37183
37184
37185static int
37186test_xmlUCSIsHangulSyllables(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037187 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037188
William M. Brack21e4ef22005-01-02 09:53:13 +000037189#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037190 int mem_base;
37191 int ret_val;
37192 int code; /* UCS code point */
37193 int n_code;
37194
37195 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37196 mem_base = xmlMemBlocks();
37197 code = gen_int(n_code, 0);
37198
37199 ret_val = xmlUCSIsHangulSyllables(code);
37200 desret_int(ret_val);
37201 call_tests++;
37202 des_int(n_code, code, 0);
37203 xmlResetLastError();
37204 if (mem_base != xmlMemBlocks()) {
37205 printf("Leak of %d blocks found in xmlUCSIsHangulSyllables",
37206 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037207 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037208 printf(" %d", n_code);
37209 printf("\n");
37210 }
37211 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037212 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037213#endif
37214
Daniel Veillard42595322004-11-08 10:52:06 +000037215 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037216}
37217
37218
37219static int
37220test_xmlUCSIsHanunoo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037221 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037222
William M. Brack21e4ef22005-01-02 09:53:13 +000037223#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037224 int mem_base;
37225 int ret_val;
37226 int code; /* UCS code point */
37227 int n_code;
37228
37229 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37230 mem_base = xmlMemBlocks();
37231 code = gen_int(n_code, 0);
37232
37233 ret_val = xmlUCSIsHanunoo(code);
37234 desret_int(ret_val);
37235 call_tests++;
37236 des_int(n_code, code, 0);
37237 xmlResetLastError();
37238 if (mem_base != xmlMemBlocks()) {
37239 printf("Leak of %d blocks found in xmlUCSIsHanunoo",
37240 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037241 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037242 printf(" %d", n_code);
37243 printf("\n");
37244 }
37245 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037246 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037247#endif
37248
Daniel Veillard42595322004-11-08 10:52:06 +000037249 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037250}
37251
37252
37253static int
37254test_xmlUCSIsHebrew(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037255 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037256
William M. Brack21e4ef22005-01-02 09:53:13 +000037257#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037258 int mem_base;
37259 int ret_val;
37260 int code; /* UCS code point */
37261 int n_code;
37262
37263 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37264 mem_base = xmlMemBlocks();
37265 code = gen_int(n_code, 0);
37266
37267 ret_val = xmlUCSIsHebrew(code);
37268 desret_int(ret_val);
37269 call_tests++;
37270 des_int(n_code, code, 0);
37271 xmlResetLastError();
37272 if (mem_base != xmlMemBlocks()) {
37273 printf("Leak of %d blocks found in xmlUCSIsHebrew",
37274 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037275 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037276 printf(" %d", n_code);
37277 printf("\n");
37278 }
37279 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037280 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037281#endif
37282
Daniel Veillard42595322004-11-08 10:52:06 +000037283 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037284}
37285
37286
37287static int
37288test_xmlUCSIsHighPrivateUseSurrogates(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037289 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037290
William M. Brack21e4ef22005-01-02 09:53:13 +000037291#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037292 int mem_base;
37293 int ret_val;
37294 int code; /* UCS code point */
37295 int n_code;
37296
37297 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37298 mem_base = xmlMemBlocks();
37299 code = gen_int(n_code, 0);
37300
37301 ret_val = xmlUCSIsHighPrivateUseSurrogates(code);
37302 desret_int(ret_val);
37303 call_tests++;
37304 des_int(n_code, code, 0);
37305 xmlResetLastError();
37306 if (mem_base != xmlMemBlocks()) {
37307 printf("Leak of %d blocks found in xmlUCSIsHighPrivateUseSurrogates",
37308 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037309 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037310 printf(" %d", n_code);
37311 printf("\n");
37312 }
37313 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037314 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037315#endif
37316
Daniel Veillard42595322004-11-08 10:52:06 +000037317 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037318}
37319
37320
37321static int
37322test_xmlUCSIsHighSurrogates(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037323 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037324
William M. Brack21e4ef22005-01-02 09:53:13 +000037325#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037326 int mem_base;
37327 int ret_val;
37328 int code; /* UCS code point */
37329 int n_code;
37330
37331 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37332 mem_base = xmlMemBlocks();
37333 code = gen_int(n_code, 0);
37334
37335 ret_val = xmlUCSIsHighSurrogates(code);
37336 desret_int(ret_val);
37337 call_tests++;
37338 des_int(n_code, code, 0);
37339 xmlResetLastError();
37340 if (mem_base != xmlMemBlocks()) {
37341 printf("Leak of %d blocks found in xmlUCSIsHighSurrogates",
37342 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037343 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037344 printf(" %d", n_code);
37345 printf("\n");
37346 }
37347 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037348 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037349#endif
37350
Daniel Veillard42595322004-11-08 10:52:06 +000037351 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037352}
37353
37354
37355static int
37356test_xmlUCSIsHiragana(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037357 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037358
William M. Brack21e4ef22005-01-02 09:53:13 +000037359#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037360 int mem_base;
37361 int ret_val;
37362 int code; /* UCS code point */
37363 int n_code;
37364
37365 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37366 mem_base = xmlMemBlocks();
37367 code = gen_int(n_code, 0);
37368
37369 ret_val = xmlUCSIsHiragana(code);
37370 desret_int(ret_val);
37371 call_tests++;
37372 des_int(n_code, code, 0);
37373 xmlResetLastError();
37374 if (mem_base != xmlMemBlocks()) {
37375 printf("Leak of %d blocks found in xmlUCSIsHiragana",
37376 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037377 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037378 printf(" %d", n_code);
37379 printf("\n");
37380 }
37381 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037382 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037383#endif
37384
Daniel Veillard42595322004-11-08 10:52:06 +000037385 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037386}
37387
37388
37389static int
37390test_xmlUCSIsIPAExtensions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037391 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037392
William M. Brack21e4ef22005-01-02 09:53:13 +000037393#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037394 int mem_base;
37395 int ret_val;
37396 int code; /* UCS code point */
37397 int n_code;
37398
37399 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37400 mem_base = xmlMemBlocks();
37401 code = gen_int(n_code, 0);
37402
37403 ret_val = xmlUCSIsIPAExtensions(code);
37404 desret_int(ret_val);
37405 call_tests++;
37406 des_int(n_code, code, 0);
37407 xmlResetLastError();
37408 if (mem_base != xmlMemBlocks()) {
37409 printf("Leak of %d blocks found in xmlUCSIsIPAExtensions",
37410 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037411 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037412 printf(" %d", n_code);
37413 printf("\n");
37414 }
37415 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037416 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037417#endif
37418
Daniel Veillard42595322004-11-08 10:52:06 +000037419 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037420}
37421
37422
37423static int
37424test_xmlUCSIsIdeographicDescriptionCharacters(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037425 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037426
William M. Brack21e4ef22005-01-02 09:53:13 +000037427#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037428 int mem_base;
37429 int ret_val;
37430 int code; /* UCS code point */
37431 int n_code;
37432
37433 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37434 mem_base = xmlMemBlocks();
37435 code = gen_int(n_code, 0);
37436
37437 ret_val = xmlUCSIsIdeographicDescriptionCharacters(code);
37438 desret_int(ret_val);
37439 call_tests++;
37440 des_int(n_code, code, 0);
37441 xmlResetLastError();
37442 if (mem_base != xmlMemBlocks()) {
37443 printf("Leak of %d blocks found in xmlUCSIsIdeographicDescriptionCharacters",
37444 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037445 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037446 printf(" %d", n_code);
37447 printf("\n");
37448 }
37449 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037450 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037451#endif
37452
Daniel Veillard42595322004-11-08 10:52:06 +000037453 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037454}
37455
37456
37457static int
37458test_xmlUCSIsKanbun(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037459 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037460
William M. Brack21e4ef22005-01-02 09:53:13 +000037461#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037462 int mem_base;
37463 int ret_val;
37464 int code; /* UCS code point */
37465 int n_code;
37466
37467 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37468 mem_base = xmlMemBlocks();
37469 code = gen_int(n_code, 0);
37470
37471 ret_val = xmlUCSIsKanbun(code);
37472 desret_int(ret_val);
37473 call_tests++;
37474 des_int(n_code, code, 0);
37475 xmlResetLastError();
37476 if (mem_base != xmlMemBlocks()) {
37477 printf("Leak of %d blocks found in xmlUCSIsKanbun",
37478 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037479 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037480 printf(" %d", n_code);
37481 printf("\n");
37482 }
37483 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037484 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037485#endif
37486
Daniel Veillard42595322004-11-08 10:52:06 +000037487 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037488}
37489
37490
37491static int
37492test_xmlUCSIsKangxiRadicals(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037493 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037494
William M. Brack21e4ef22005-01-02 09:53:13 +000037495#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037496 int mem_base;
37497 int ret_val;
37498 int code; /* UCS code point */
37499 int n_code;
37500
37501 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37502 mem_base = xmlMemBlocks();
37503 code = gen_int(n_code, 0);
37504
37505 ret_val = xmlUCSIsKangxiRadicals(code);
37506 desret_int(ret_val);
37507 call_tests++;
37508 des_int(n_code, code, 0);
37509 xmlResetLastError();
37510 if (mem_base != xmlMemBlocks()) {
37511 printf("Leak of %d blocks found in xmlUCSIsKangxiRadicals",
37512 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037513 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037514 printf(" %d", n_code);
37515 printf("\n");
37516 }
37517 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037518 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037519#endif
37520
Daniel Veillard42595322004-11-08 10:52:06 +000037521 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037522}
37523
37524
37525static int
37526test_xmlUCSIsKannada(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037527 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037528
William M. Brack21e4ef22005-01-02 09:53:13 +000037529#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037530 int mem_base;
37531 int ret_val;
37532 int code; /* UCS code point */
37533 int n_code;
37534
37535 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37536 mem_base = xmlMemBlocks();
37537 code = gen_int(n_code, 0);
37538
37539 ret_val = xmlUCSIsKannada(code);
37540 desret_int(ret_val);
37541 call_tests++;
37542 des_int(n_code, code, 0);
37543 xmlResetLastError();
37544 if (mem_base != xmlMemBlocks()) {
37545 printf("Leak of %d blocks found in xmlUCSIsKannada",
37546 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037547 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037548 printf(" %d", n_code);
37549 printf("\n");
37550 }
37551 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037552 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037553#endif
37554
Daniel Veillard42595322004-11-08 10:52:06 +000037555 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037556}
37557
37558
37559static int
37560test_xmlUCSIsKatakana(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037561 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037562
William M. Brack21e4ef22005-01-02 09:53:13 +000037563#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037564 int mem_base;
37565 int ret_val;
37566 int code; /* UCS code point */
37567 int n_code;
37568
37569 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37570 mem_base = xmlMemBlocks();
37571 code = gen_int(n_code, 0);
37572
37573 ret_val = xmlUCSIsKatakana(code);
37574 desret_int(ret_val);
37575 call_tests++;
37576 des_int(n_code, code, 0);
37577 xmlResetLastError();
37578 if (mem_base != xmlMemBlocks()) {
37579 printf("Leak of %d blocks found in xmlUCSIsKatakana",
37580 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037581 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037582 printf(" %d", n_code);
37583 printf("\n");
37584 }
37585 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037586 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037587#endif
37588
Daniel Veillard42595322004-11-08 10:52:06 +000037589 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037590}
37591
37592
37593static int
37594test_xmlUCSIsKatakanaPhoneticExtensions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037595 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037596
William M. Brack21e4ef22005-01-02 09:53:13 +000037597#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037598 int mem_base;
37599 int ret_val;
37600 int code; /* UCS code point */
37601 int n_code;
37602
37603 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37604 mem_base = xmlMemBlocks();
37605 code = gen_int(n_code, 0);
37606
37607 ret_val = xmlUCSIsKatakanaPhoneticExtensions(code);
37608 desret_int(ret_val);
37609 call_tests++;
37610 des_int(n_code, code, 0);
37611 xmlResetLastError();
37612 if (mem_base != xmlMemBlocks()) {
37613 printf("Leak of %d blocks found in xmlUCSIsKatakanaPhoneticExtensions",
37614 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037615 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037616 printf(" %d", n_code);
37617 printf("\n");
37618 }
37619 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037620 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037621#endif
37622
Daniel Veillard42595322004-11-08 10:52:06 +000037623 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037624}
37625
37626
37627static int
37628test_xmlUCSIsKhmer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037629 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037630
William M. Brack21e4ef22005-01-02 09:53:13 +000037631#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037632 int mem_base;
37633 int ret_val;
37634 int code; /* UCS code point */
37635 int n_code;
37636
37637 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37638 mem_base = xmlMemBlocks();
37639 code = gen_int(n_code, 0);
37640
37641 ret_val = xmlUCSIsKhmer(code);
37642 desret_int(ret_val);
37643 call_tests++;
37644 des_int(n_code, code, 0);
37645 xmlResetLastError();
37646 if (mem_base != xmlMemBlocks()) {
37647 printf("Leak of %d blocks found in xmlUCSIsKhmer",
37648 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037649 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037650 printf(" %d", n_code);
37651 printf("\n");
37652 }
37653 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037654 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037655#endif
37656
Daniel Veillard42595322004-11-08 10:52:06 +000037657 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037658}
37659
37660
37661static int
37662test_xmlUCSIsKhmerSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037663 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037664
William M. Brack21e4ef22005-01-02 09:53:13 +000037665#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037666 int mem_base;
37667 int ret_val;
37668 int code; /* UCS code point */
37669 int n_code;
37670
37671 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37672 mem_base = xmlMemBlocks();
37673 code = gen_int(n_code, 0);
37674
37675 ret_val = xmlUCSIsKhmerSymbols(code);
37676 desret_int(ret_val);
37677 call_tests++;
37678 des_int(n_code, code, 0);
37679 xmlResetLastError();
37680 if (mem_base != xmlMemBlocks()) {
37681 printf("Leak of %d blocks found in xmlUCSIsKhmerSymbols",
37682 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037683 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037684 printf(" %d", n_code);
37685 printf("\n");
37686 }
37687 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037688 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037689#endif
37690
Daniel Veillard42595322004-11-08 10:52:06 +000037691 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037692}
37693
37694
37695static int
37696test_xmlUCSIsLao(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037697 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037698
William M. Brack21e4ef22005-01-02 09:53:13 +000037699#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037700 int mem_base;
37701 int ret_val;
37702 int code; /* UCS code point */
37703 int n_code;
37704
37705 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37706 mem_base = xmlMemBlocks();
37707 code = gen_int(n_code, 0);
37708
37709 ret_val = xmlUCSIsLao(code);
37710 desret_int(ret_val);
37711 call_tests++;
37712 des_int(n_code, code, 0);
37713 xmlResetLastError();
37714 if (mem_base != xmlMemBlocks()) {
37715 printf("Leak of %d blocks found in xmlUCSIsLao",
37716 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037717 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037718 printf(" %d", n_code);
37719 printf("\n");
37720 }
37721 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037722 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037723#endif
37724
Daniel Veillard42595322004-11-08 10:52:06 +000037725 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037726}
37727
37728
37729static int
37730test_xmlUCSIsLatin1Supplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037731 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037732
William M. Brack21e4ef22005-01-02 09:53:13 +000037733#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037734 int mem_base;
37735 int ret_val;
37736 int code; /* UCS code point */
37737 int n_code;
37738
37739 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37740 mem_base = xmlMemBlocks();
37741 code = gen_int(n_code, 0);
37742
37743 ret_val = xmlUCSIsLatin1Supplement(code);
37744 desret_int(ret_val);
37745 call_tests++;
37746 des_int(n_code, code, 0);
37747 xmlResetLastError();
37748 if (mem_base != xmlMemBlocks()) {
37749 printf("Leak of %d blocks found in xmlUCSIsLatin1Supplement",
37750 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037751 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037752 printf(" %d", n_code);
37753 printf("\n");
37754 }
37755 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037756 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037757#endif
37758
Daniel Veillard42595322004-11-08 10:52:06 +000037759 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037760}
37761
37762
37763static int
37764test_xmlUCSIsLatinExtendedA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037765 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037766
William M. Brack21e4ef22005-01-02 09:53:13 +000037767#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037768 int mem_base;
37769 int ret_val;
37770 int code; /* UCS code point */
37771 int n_code;
37772
37773 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37774 mem_base = xmlMemBlocks();
37775 code = gen_int(n_code, 0);
37776
37777 ret_val = xmlUCSIsLatinExtendedA(code);
37778 desret_int(ret_val);
37779 call_tests++;
37780 des_int(n_code, code, 0);
37781 xmlResetLastError();
37782 if (mem_base != xmlMemBlocks()) {
37783 printf("Leak of %d blocks found in xmlUCSIsLatinExtendedA",
37784 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037785 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037786 printf(" %d", n_code);
37787 printf("\n");
37788 }
37789 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037790 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037791#endif
37792
Daniel Veillard42595322004-11-08 10:52:06 +000037793 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037794}
37795
37796
37797static int
37798test_xmlUCSIsLatinExtendedAdditional(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037799 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037800
William M. Brack21e4ef22005-01-02 09:53:13 +000037801#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037802 int mem_base;
37803 int ret_val;
37804 int code; /* UCS code point */
37805 int n_code;
37806
37807 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37808 mem_base = xmlMemBlocks();
37809 code = gen_int(n_code, 0);
37810
37811 ret_val = xmlUCSIsLatinExtendedAdditional(code);
37812 desret_int(ret_val);
37813 call_tests++;
37814 des_int(n_code, code, 0);
37815 xmlResetLastError();
37816 if (mem_base != xmlMemBlocks()) {
37817 printf("Leak of %d blocks found in xmlUCSIsLatinExtendedAdditional",
37818 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037819 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037820 printf(" %d", n_code);
37821 printf("\n");
37822 }
37823 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037824 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037825#endif
37826
Daniel Veillard42595322004-11-08 10:52:06 +000037827 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037828}
37829
37830
37831static int
37832test_xmlUCSIsLatinExtendedB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037833 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037834
William M. Brack21e4ef22005-01-02 09:53:13 +000037835#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037836 int mem_base;
37837 int ret_val;
37838 int code; /* UCS code point */
37839 int n_code;
37840
37841 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37842 mem_base = xmlMemBlocks();
37843 code = gen_int(n_code, 0);
37844
37845 ret_val = xmlUCSIsLatinExtendedB(code);
37846 desret_int(ret_val);
37847 call_tests++;
37848 des_int(n_code, code, 0);
37849 xmlResetLastError();
37850 if (mem_base != xmlMemBlocks()) {
37851 printf("Leak of %d blocks found in xmlUCSIsLatinExtendedB",
37852 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037853 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037854 printf(" %d", n_code);
37855 printf("\n");
37856 }
37857 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037858 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037859#endif
37860
Daniel Veillard42595322004-11-08 10:52:06 +000037861 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037862}
37863
37864
37865static int
37866test_xmlUCSIsLetterlikeSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037867 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037868
William M. Brack21e4ef22005-01-02 09:53:13 +000037869#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037870 int mem_base;
37871 int ret_val;
37872 int code; /* UCS code point */
37873 int n_code;
37874
37875 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37876 mem_base = xmlMemBlocks();
37877 code = gen_int(n_code, 0);
37878
37879 ret_val = xmlUCSIsLetterlikeSymbols(code);
37880 desret_int(ret_val);
37881 call_tests++;
37882 des_int(n_code, code, 0);
37883 xmlResetLastError();
37884 if (mem_base != xmlMemBlocks()) {
37885 printf("Leak of %d blocks found in xmlUCSIsLetterlikeSymbols",
37886 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037887 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037888 printf(" %d", n_code);
37889 printf("\n");
37890 }
37891 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037892 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037893#endif
37894
Daniel Veillard42595322004-11-08 10:52:06 +000037895 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037896}
37897
37898
37899static int
37900test_xmlUCSIsLimbu(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037901 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037902
William M. Brack21e4ef22005-01-02 09:53:13 +000037903#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037904 int mem_base;
37905 int ret_val;
37906 int code; /* UCS code point */
37907 int n_code;
37908
37909 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37910 mem_base = xmlMemBlocks();
37911 code = gen_int(n_code, 0);
37912
37913 ret_val = xmlUCSIsLimbu(code);
37914 desret_int(ret_val);
37915 call_tests++;
37916 des_int(n_code, code, 0);
37917 xmlResetLastError();
37918 if (mem_base != xmlMemBlocks()) {
37919 printf("Leak of %d blocks found in xmlUCSIsLimbu",
37920 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037921 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037922 printf(" %d", n_code);
37923 printf("\n");
37924 }
37925 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037926 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037927#endif
37928
Daniel Veillard42595322004-11-08 10:52:06 +000037929 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037930}
37931
37932
37933static int
37934test_xmlUCSIsLinearBIdeograms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037935 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037936
William M. Brack21e4ef22005-01-02 09:53:13 +000037937#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037938 int mem_base;
37939 int ret_val;
37940 int code; /* UCS code point */
37941 int n_code;
37942
37943 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37944 mem_base = xmlMemBlocks();
37945 code = gen_int(n_code, 0);
37946
37947 ret_val = xmlUCSIsLinearBIdeograms(code);
37948 desret_int(ret_val);
37949 call_tests++;
37950 des_int(n_code, code, 0);
37951 xmlResetLastError();
37952 if (mem_base != xmlMemBlocks()) {
37953 printf("Leak of %d blocks found in xmlUCSIsLinearBIdeograms",
37954 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037955 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037956 printf(" %d", n_code);
37957 printf("\n");
37958 }
37959 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037960 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037961#endif
37962
Daniel Veillard42595322004-11-08 10:52:06 +000037963 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037964}
37965
37966
37967static int
37968test_xmlUCSIsLinearBSyllabary(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037969 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037970
William M. Brack21e4ef22005-01-02 09:53:13 +000037971#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037972 int mem_base;
37973 int ret_val;
37974 int code; /* UCS code point */
37975 int n_code;
37976
37977 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37978 mem_base = xmlMemBlocks();
37979 code = gen_int(n_code, 0);
37980
37981 ret_val = xmlUCSIsLinearBSyllabary(code);
37982 desret_int(ret_val);
37983 call_tests++;
37984 des_int(n_code, code, 0);
37985 xmlResetLastError();
37986 if (mem_base != xmlMemBlocks()) {
37987 printf("Leak of %d blocks found in xmlUCSIsLinearBSyllabary",
37988 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037989 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037990 printf(" %d", n_code);
37991 printf("\n");
37992 }
37993 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037994 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037995#endif
37996
Daniel Veillard42595322004-11-08 10:52:06 +000037997 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037998}
37999
38000
38001static int
38002test_xmlUCSIsLowSurrogates(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038003 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038004
William M. Brack21e4ef22005-01-02 09:53:13 +000038005#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038006 int mem_base;
38007 int ret_val;
38008 int code; /* UCS code point */
38009 int n_code;
38010
38011 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38012 mem_base = xmlMemBlocks();
38013 code = gen_int(n_code, 0);
38014
38015 ret_val = xmlUCSIsLowSurrogates(code);
38016 desret_int(ret_val);
38017 call_tests++;
38018 des_int(n_code, code, 0);
38019 xmlResetLastError();
38020 if (mem_base != xmlMemBlocks()) {
38021 printf("Leak of %d blocks found in xmlUCSIsLowSurrogates",
38022 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038023 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038024 printf(" %d", n_code);
38025 printf("\n");
38026 }
38027 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038028 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038029#endif
38030
Daniel Veillard42595322004-11-08 10:52:06 +000038031 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038032}
38033
38034
38035static int
38036test_xmlUCSIsMalayalam(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038037 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038038
William M. Brack21e4ef22005-01-02 09:53:13 +000038039#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038040 int mem_base;
38041 int ret_val;
38042 int code; /* UCS code point */
38043 int n_code;
38044
38045 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38046 mem_base = xmlMemBlocks();
38047 code = gen_int(n_code, 0);
38048
38049 ret_val = xmlUCSIsMalayalam(code);
38050 desret_int(ret_val);
38051 call_tests++;
38052 des_int(n_code, code, 0);
38053 xmlResetLastError();
38054 if (mem_base != xmlMemBlocks()) {
38055 printf("Leak of %d blocks found in xmlUCSIsMalayalam",
38056 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038057 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038058 printf(" %d", n_code);
38059 printf("\n");
38060 }
38061 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038062 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038063#endif
38064
Daniel Veillard42595322004-11-08 10:52:06 +000038065 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038066}
38067
38068
38069static int
38070test_xmlUCSIsMathematicalAlphanumericSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038071 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038072
William M. Brack21e4ef22005-01-02 09:53:13 +000038073#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038074 int mem_base;
38075 int ret_val;
38076 int code; /* UCS code point */
38077 int n_code;
38078
38079 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38080 mem_base = xmlMemBlocks();
38081 code = gen_int(n_code, 0);
38082
38083 ret_val = xmlUCSIsMathematicalAlphanumericSymbols(code);
38084 desret_int(ret_val);
38085 call_tests++;
38086 des_int(n_code, code, 0);
38087 xmlResetLastError();
38088 if (mem_base != xmlMemBlocks()) {
38089 printf("Leak of %d blocks found in xmlUCSIsMathematicalAlphanumericSymbols",
38090 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038091 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038092 printf(" %d", n_code);
38093 printf("\n");
38094 }
38095 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038096 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038097#endif
38098
Daniel Veillard42595322004-11-08 10:52:06 +000038099 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038100}
38101
38102
38103static int
38104test_xmlUCSIsMathematicalOperators(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038105 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038106
William M. Brack21e4ef22005-01-02 09:53:13 +000038107#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038108 int mem_base;
38109 int ret_val;
38110 int code; /* UCS code point */
38111 int n_code;
38112
38113 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38114 mem_base = xmlMemBlocks();
38115 code = gen_int(n_code, 0);
38116
38117 ret_val = xmlUCSIsMathematicalOperators(code);
38118 desret_int(ret_val);
38119 call_tests++;
38120 des_int(n_code, code, 0);
38121 xmlResetLastError();
38122 if (mem_base != xmlMemBlocks()) {
38123 printf("Leak of %d blocks found in xmlUCSIsMathematicalOperators",
38124 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038125 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038126 printf(" %d", n_code);
38127 printf("\n");
38128 }
38129 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038130 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038131#endif
38132
Daniel Veillard42595322004-11-08 10:52:06 +000038133 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038134}
38135
38136
38137static int
38138test_xmlUCSIsMiscellaneousMathematicalSymbolsA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038139 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038140
William M. Brack21e4ef22005-01-02 09:53:13 +000038141#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038142 int mem_base;
38143 int ret_val;
38144 int code; /* UCS code point */
38145 int n_code;
38146
38147 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38148 mem_base = xmlMemBlocks();
38149 code = gen_int(n_code, 0);
38150
38151 ret_val = xmlUCSIsMiscellaneousMathematicalSymbolsA(code);
38152 desret_int(ret_val);
38153 call_tests++;
38154 des_int(n_code, code, 0);
38155 xmlResetLastError();
38156 if (mem_base != xmlMemBlocks()) {
38157 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousMathematicalSymbolsA",
38158 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038159 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038160 printf(" %d", n_code);
38161 printf("\n");
38162 }
38163 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038164 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038165#endif
38166
Daniel Veillard42595322004-11-08 10:52:06 +000038167 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038168}
38169
38170
38171static int
38172test_xmlUCSIsMiscellaneousMathematicalSymbolsB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038173 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038174
William M. Brack21e4ef22005-01-02 09:53:13 +000038175#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038176 int mem_base;
38177 int ret_val;
38178 int code; /* UCS code point */
38179 int n_code;
38180
38181 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38182 mem_base = xmlMemBlocks();
38183 code = gen_int(n_code, 0);
38184
38185 ret_val = xmlUCSIsMiscellaneousMathematicalSymbolsB(code);
38186 desret_int(ret_val);
38187 call_tests++;
38188 des_int(n_code, code, 0);
38189 xmlResetLastError();
38190 if (mem_base != xmlMemBlocks()) {
38191 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousMathematicalSymbolsB",
38192 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038193 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038194 printf(" %d", n_code);
38195 printf("\n");
38196 }
38197 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038198 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038199#endif
38200
Daniel Veillard42595322004-11-08 10:52:06 +000038201 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038202}
38203
38204
38205static int
38206test_xmlUCSIsMiscellaneousSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038207 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038208
William M. Brack21e4ef22005-01-02 09:53:13 +000038209#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038210 int mem_base;
38211 int ret_val;
38212 int code; /* UCS code point */
38213 int n_code;
38214
38215 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38216 mem_base = xmlMemBlocks();
38217 code = gen_int(n_code, 0);
38218
38219 ret_val = xmlUCSIsMiscellaneousSymbols(code);
38220 desret_int(ret_val);
38221 call_tests++;
38222 des_int(n_code, code, 0);
38223 xmlResetLastError();
38224 if (mem_base != xmlMemBlocks()) {
38225 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousSymbols",
38226 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038227 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038228 printf(" %d", n_code);
38229 printf("\n");
38230 }
38231 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038232 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038233#endif
38234
Daniel Veillard42595322004-11-08 10:52:06 +000038235 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038236}
38237
38238
38239static int
38240test_xmlUCSIsMiscellaneousSymbolsandArrows(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038241 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038242
William M. Brack21e4ef22005-01-02 09:53:13 +000038243#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038244 int mem_base;
38245 int ret_val;
38246 int code; /* UCS code point */
38247 int n_code;
38248
38249 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38250 mem_base = xmlMemBlocks();
38251 code = gen_int(n_code, 0);
38252
38253 ret_val = xmlUCSIsMiscellaneousSymbolsandArrows(code);
38254 desret_int(ret_val);
38255 call_tests++;
38256 des_int(n_code, code, 0);
38257 xmlResetLastError();
38258 if (mem_base != xmlMemBlocks()) {
38259 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousSymbolsandArrows",
38260 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038261 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038262 printf(" %d", n_code);
38263 printf("\n");
38264 }
38265 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038266 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038267#endif
38268
Daniel Veillard42595322004-11-08 10:52:06 +000038269 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038270}
38271
38272
38273static int
38274test_xmlUCSIsMiscellaneousTechnical(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038275 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038276
William M. Brack21e4ef22005-01-02 09:53:13 +000038277#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038278 int mem_base;
38279 int ret_val;
38280 int code; /* UCS code point */
38281 int n_code;
38282
38283 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38284 mem_base = xmlMemBlocks();
38285 code = gen_int(n_code, 0);
38286
38287 ret_val = xmlUCSIsMiscellaneousTechnical(code);
38288 desret_int(ret_val);
38289 call_tests++;
38290 des_int(n_code, code, 0);
38291 xmlResetLastError();
38292 if (mem_base != xmlMemBlocks()) {
38293 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousTechnical",
38294 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038295 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038296 printf(" %d", n_code);
38297 printf("\n");
38298 }
38299 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038300 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038301#endif
38302
Daniel Veillard42595322004-11-08 10:52:06 +000038303 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038304}
38305
38306
38307static int
38308test_xmlUCSIsMongolian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038309 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038310
William M. Brack21e4ef22005-01-02 09:53:13 +000038311#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038312 int mem_base;
38313 int ret_val;
38314 int code; /* UCS code point */
38315 int n_code;
38316
38317 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38318 mem_base = xmlMemBlocks();
38319 code = gen_int(n_code, 0);
38320
38321 ret_val = xmlUCSIsMongolian(code);
38322 desret_int(ret_val);
38323 call_tests++;
38324 des_int(n_code, code, 0);
38325 xmlResetLastError();
38326 if (mem_base != xmlMemBlocks()) {
38327 printf("Leak of %d blocks found in xmlUCSIsMongolian",
38328 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038329 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038330 printf(" %d", n_code);
38331 printf("\n");
38332 }
38333 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038334 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038335#endif
38336
Daniel Veillard42595322004-11-08 10:52:06 +000038337 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038338}
38339
38340
38341static int
38342test_xmlUCSIsMusicalSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038343 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038344
William M. Brack21e4ef22005-01-02 09:53:13 +000038345#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038346 int mem_base;
38347 int ret_val;
38348 int code; /* UCS code point */
38349 int n_code;
38350
38351 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38352 mem_base = xmlMemBlocks();
38353 code = gen_int(n_code, 0);
38354
38355 ret_val = xmlUCSIsMusicalSymbols(code);
38356 desret_int(ret_val);
38357 call_tests++;
38358 des_int(n_code, code, 0);
38359 xmlResetLastError();
38360 if (mem_base != xmlMemBlocks()) {
38361 printf("Leak of %d blocks found in xmlUCSIsMusicalSymbols",
38362 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038363 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038364 printf(" %d", n_code);
38365 printf("\n");
38366 }
38367 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038368 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038369#endif
38370
Daniel Veillard42595322004-11-08 10:52:06 +000038371 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038372}
38373
38374
38375static int
38376test_xmlUCSIsMyanmar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038377 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038378
William M. Brack21e4ef22005-01-02 09:53:13 +000038379#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038380 int mem_base;
38381 int ret_val;
38382 int code; /* UCS code point */
38383 int n_code;
38384
38385 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38386 mem_base = xmlMemBlocks();
38387 code = gen_int(n_code, 0);
38388
38389 ret_val = xmlUCSIsMyanmar(code);
38390 desret_int(ret_val);
38391 call_tests++;
38392 des_int(n_code, code, 0);
38393 xmlResetLastError();
38394 if (mem_base != xmlMemBlocks()) {
38395 printf("Leak of %d blocks found in xmlUCSIsMyanmar",
38396 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038397 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038398 printf(" %d", n_code);
38399 printf("\n");
38400 }
38401 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038402 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038403#endif
38404
Daniel Veillard42595322004-11-08 10:52:06 +000038405 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038406}
38407
38408
38409static int
38410test_xmlUCSIsNumberForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038411 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038412
William M. Brack21e4ef22005-01-02 09:53:13 +000038413#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038414 int mem_base;
38415 int ret_val;
38416 int code; /* UCS code point */
38417 int n_code;
38418
38419 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38420 mem_base = xmlMemBlocks();
38421 code = gen_int(n_code, 0);
38422
38423 ret_val = xmlUCSIsNumberForms(code);
38424 desret_int(ret_val);
38425 call_tests++;
38426 des_int(n_code, code, 0);
38427 xmlResetLastError();
38428 if (mem_base != xmlMemBlocks()) {
38429 printf("Leak of %d blocks found in xmlUCSIsNumberForms",
38430 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038431 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038432 printf(" %d", n_code);
38433 printf("\n");
38434 }
38435 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038436 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038437#endif
38438
Daniel Veillard42595322004-11-08 10:52:06 +000038439 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038440}
38441
38442
38443static int
38444test_xmlUCSIsOgham(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038445 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038446
William M. Brack21e4ef22005-01-02 09:53:13 +000038447#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038448 int mem_base;
38449 int ret_val;
38450 int code; /* UCS code point */
38451 int n_code;
38452
38453 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38454 mem_base = xmlMemBlocks();
38455 code = gen_int(n_code, 0);
38456
38457 ret_val = xmlUCSIsOgham(code);
38458 desret_int(ret_val);
38459 call_tests++;
38460 des_int(n_code, code, 0);
38461 xmlResetLastError();
38462 if (mem_base != xmlMemBlocks()) {
38463 printf("Leak of %d blocks found in xmlUCSIsOgham",
38464 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038465 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038466 printf(" %d", n_code);
38467 printf("\n");
38468 }
38469 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038470 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038471#endif
38472
Daniel Veillard42595322004-11-08 10:52:06 +000038473 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038474}
38475
38476
38477static int
38478test_xmlUCSIsOldItalic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038479 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038480
William M. Brack21e4ef22005-01-02 09:53:13 +000038481#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038482 int mem_base;
38483 int ret_val;
38484 int code; /* UCS code point */
38485 int n_code;
38486
38487 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38488 mem_base = xmlMemBlocks();
38489 code = gen_int(n_code, 0);
38490
38491 ret_val = xmlUCSIsOldItalic(code);
38492 desret_int(ret_val);
38493 call_tests++;
38494 des_int(n_code, code, 0);
38495 xmlResetLastError();
38496 if (mem_base != xmlMemBlocks()) {
38497 printf("Leak of %d blocks found in xmlUCSIsOldItalic",
38498 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038499 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038500 printf(" %d", n_code);
38501 printf("\n");
38502 }
38503 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038504 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038505#endif
38506
Daniel Veillard42595322004-11-08 10:52:06 +000038507 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038508}
38509
38510
38511static int
38512test_xmlUCSIsOpticalCharacterRecognition(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038513 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038514
William M. Brack21e4ef22005-01-02 09:53:13 +000038515#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038516 int mem_base;
38517 int ret_val;
38518 int code; /* UCS code point */
38519 int n_code;
38520
38521 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38522 mem_base = xmlMemBlocks();
38523 code = gen_int(n_code, 0);
38524
38525 ret_val = xmlUCSIsOpticalCharacterRecognition(code);
38526 desret_int(ret_val);
38527 call_tests++;
38528 des_int(n_code, code, 0);
38529 xmlResetLastError();
38530 if (mem_base != xmlMemBlocks()) {
38531 printf("Leak of %d blocks found in xmlUCSIsOpticalCharacterRecognition",
38532 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038533 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038534 printf(" %d", n_code);
38535 printf("\n");
38536 }
38537 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038538 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038539#endif
38540
Daniel Veillard42595322004-11-08 10:52:06 +000038541 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038542}
38543
38544
38545static int
38546test_xmlUCSIsOriya(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038547 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038548
William M. Brack21e4ef22005-01-02 09:53:13 +000038549#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038550 int mem_base;
38551 int ret_val;
38552 int code; /* UCS code point */
38553 int n_code;
38554
38555 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38556 mem_base = xmlMemBlocks();
38557 code = gen_int(n_code, 0);
38558
38559 ret_val = xmlUCSIsOriya(code);
38560 desret_int(ret_val);
38561 call_tests++;
38562 des_int(n_code, code, 0);
38563 xmlResetLastError();
38564 if (mem_base != xmlMemBlocks()) {
38565 printf("Leak of %d blocks found in xmlUCSIsOriya",
38566 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038567 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038568 printf(" %d", n_code);
38569 printf("\n");
38570 }
38571 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038572 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038573#endif
38574
Daniel Veillard42595322004-11-08 10:52:06 +000038575 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038576}
38577
38578
38579static int
38580test_xmlUCSIsOsmanya(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038581 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038582
William M. Brack21e4ef22005-01-02 09:53:13 +000038583#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038584 int mem_base;
38585 int ret_val;
38586 int code; /* UCS code point */
38587 int n_code;
38588
38589 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38590 mem_base = xmlMemBlocks();
38591 code = gen_int(n_code, 0);
38592
38593 ret_val = xmlUCSIsOsmanya(code);
38594 desret_int(ret_val);
38595 call_tests++;
38596 des_int(n_code, code, 0);
38597 xmlResetLastError();
38598 if (mem_base != xmlMemBlocks()) {
38599 printf("Leak of %d blocks found in xmlUCSIsOsmanya",
38600 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038601 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038602 printf(" %d", n_code);
38603 printf("\n");
38604 }
38605 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038606 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038607#endif
38608
Daniel Veillard42595322004-11-08 10:52:06 +000038609 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038610}
38611
38612
38613static int
38614test_xmlUCSIsPhoneticExtensions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038615 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038616
William M. Brack21e4ef22005-01-02 09:53:13 +000038617#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038618 int mem_base;
38619 int ret_val;
38620 int code; /* UCS code point */
38621 int n_code;
38622
38623 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38624 mem_base = xmlMemBlocks();
38625 code = gen_int(n_code, 0);
38626
38627 ret_val = xmlUCSIsPhoneticExtensions(code);
38628 desret_int(ret_val);
38629 call_tests++;
38630 des_int(n_code, code, 0);
38631 xmlResetLastError();
38632 if (mem_base != xmlMemBlocks()) {
38633 printf("Leak of %d blocks found in xmlUCSIsPhoneticExtensions",
38634 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038635 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038636 printf(" %d", n_code);
38637 printf("\n");
38638 }
38639 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038640 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038641#endif
38642
Daniel Veillard42595322004-11-08 10:52:06 +000038643 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038644}
38645
38646
38647static int
38648test_xmlUCSIsPrivateUse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038649 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038650
William M. Brack21e4ef22005-01-02 09:53:13 +000038651#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038652 int mem_base;
38653 int ret_val;
38654 int code; /* UCS code point */
38655 int n_code;
38656
38657 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38658 mem_base = xmlMemBlocks();
38659 code = gen_int(n_code, 0);
38660
38661 ret_val = xmlUCSIsPrivateUse(code);
38662 desret_int(ret_val);
38663 call_tests++;
38664 des_int(n_code, code, 0);
38665 xmlResetLastError();
38666 if (mem_base != xmlMemBlocks()) {
38667 printf("Leak of %d blocks found in xmlUCSIsPrivateUse",
38668 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038669 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038670 printf(" %d", n_code);
38671 printf("\n");
38672 }
38673 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038674 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038675#endif
38676
Daniel Veillard42595322004-11-08 10:52:06 +000038677 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038678}
38679
38680
38681static int
38682test_xmlUCSIsPrivateUseArea(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038683 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038684
William M. Brack21e4ef22005-01-02 09:53:13 +000038685#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038686 int mem_base;
38687 int ret_val;
38688 int code; /* UCS code point */
38689 int n_code;
38690
38691 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38692 mem_base = xmlMemBlocks();
38693 code = gen_int(n_code, 0);
38694
38695 ret_val = xmlUCSIsPrivateUseArea(code);
38696 desret_int(ret_val);
38697 call_tests++;
38698 des_int(n_code, code, 0);
38699 xmlResetLastError();
38700 if (mem_base != xmlMemBlocks()) {
38701 printf("Leak of %d blocks found in xmlUCSIsPrivateUseArea",
38702 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038703 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038704 printf(" %d", n_code);
38705 printf("\n");
38706 }
38707 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038708 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038709#endif
38710
Daniel Veillard42595322004-11-08 10:52:06 +000038711 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038712}
38713
38714
38715static int
38716test_xmlUCSIsRunic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038717 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038718
William M. Brack21e4ef22005-01-02 09:53:13 +000038719#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038720 int mem_base;
38721 int ret_val;
38722 int code; /* UCS code point */
38723 int n_code;
38724
38725 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38726 mem_base = xmlMemBlocks();
38727 code = gen_int(n_code, 0);
38728
38729 ret_val = xmlUCSIsRunic(code);
38730 desret_int(ret_val);
38731 call_tests++;
38732 des_int(n_code, code, 0);
38733 xmlResetLastError();
38734 if (mem_base != xmlMemBlocks()) {
38735 printf("Leak of %d blocks found in xmlUCSIsRunic",
38736 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038737 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038738 printf(" %d", n_code);
38739 printf("\n");
38740 }
38741 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038742 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038743#endif
38744
Daniel Veillard42595322004-11-08 10:52:06 +000038745 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038746}
38747
38748
38749static int
38750test_xmlUCSIsShavian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038751 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038752
William M. Brack21e4ef22005-01-02 09:53:13 +000038753#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038754 int mem_base;
38755 int ret_val;
38756 int code; /* UCS code point */
38757 int n_code;
38758
38759 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38760 mem_base = xmlMemBlocks();
38761 code = gen_int(n_code, 0);
38762
38763 ret_val = xmlUCSIsShavian(code);
38764 desret_int(ret_val);
38765 call_tests++;
38766 des_int(n_code, code, 0);
38767 xmlResetLastError();
38768 if (mem_base != xmlMemBlocks()) {
38769 printf("Leak of %d blocks found in xmlUCSIsShavian",
38770 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038771 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038772 printf(" %d", n_code);
38773 printf("\n");
38774 }
38775 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038776 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038777#endif
38778
Daniel Veillard42595322004-11-08 10:52:06 +000038779 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038780}
38781
38782
38783static int
38784test_xmlUCSIsSinhala(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038785 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038786
William M. Brack21e4ef22005-01-02 09:53:13 +000038787#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038788 int mem_base;
38789 int ret_val;
38790 int code; /* UCS code point */
38791 int n_code;
38792
38793 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38794 mem_base = xmlMemBlocks();
38795 code = gen_int(n_code, 0);
38796
38797 ret_val = xmlUCSIsSinhala(code);
38798 desret_int(ret_val);
38799 call_tests++;
38800 des_int(n_code, code, 0);
38801 xmlResetLastError();
38802 if (mem_base != xmlMemBlocks()) {
38803 printf("Leak of %d blocks found in xmlUCSIsSinhala",
38804 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038805 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038806 printf(" %d", n_code);
38807 printf("\n");
38808 }
38809 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038810 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038811#endif
38812
Daniel Veillard42595322004-11-08 10:52:06 +000038813 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038814}
38815
38816
38817static int
38818test_xmlUCSIsSmallFormVariants(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038819 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038820
William M. Brack21e4ef22005-01-02 09:53:13 +000038821#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038822 int mem_base;
38823 int ret_val;
38824 int code; /* UCS code point */
38825 int n_code;
38826
38827 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38828 mem_base = xmlMemBlocks();
38829 code = gen_int(n_code, 0);
38830
38831 ret_val = xmlUCSIsSmallFormVariants(code);
38832 desret_int(ret_val);
38833 call_tests++;
38834 des_int(n_code, code, 0);
38835 xmlResetLastError();
38836 if (mem_base != xmlMemBlocks()) {
38837 printf("Leak of %d blocks found in xmlUCSIsSmallFormVariants",
38838 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038839 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038840 printf(" %d", n_code);
38841 printf("\n");
38842 }
38843 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038844 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038845#endif
38846
Daniel Veillard42595322004-11-08 10:52:06 +000038847 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038848}
38849
38850
38851static int
38852test_xmlUCSIsSpacingModifierLetters(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038853 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038854
William M. Brack21e4ef22005-01-02 09:53:13 +000038855#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038856 int mem_base;
38857 int ret_val;
38858 int code; /* UCS code point */
38859 int n_code;
38860
38861 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38862 mem_base = xmlMemBlocks();
38863 code = gen_int(n_code, 0);
38864
38865 ret_val = xmlUCSIsSpacingModifierLetters(code);
38866 desret_int(ret_val);
38867 call_tests++;
38868 des_int(n_code, code, 0);
38869 xmlResetLastError();
38870 if (mem_base != xmlMemBlocks()) {
38871 printf("Leak of %d blocks found in xmlUCSIsSpacingModifierLetters",
38872 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038873 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038874 printf(" %d", n_code);
38875 printf("\n");
38876 }
38877 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038878 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038879#endif
38880
Daniel Veillard42595322004-11-08 10:52:06 +000038881 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038882}
38883
38884
38885static int
38886test_xmlUCSIsSpecials(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038887 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038888
William M. Brack21e4ef22005-01-02 09:53:13 +000038889#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038890 int mem_base;
38891 int ret_val;
38892 int code; /* UCS code point */
38893 int n_code;
38894
38895 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38896 mem_base = xmlMemBlocks();
38897 code = gen_int(n_code, 0);
38898
38899 ret_val = xmlUCSIsSpecials(code);
38900 desret_int(ret_val);
38901 call_tests++;
38902 des_int(n_code, code, 0);
38903 xmlResetLastError();
38904 if (mem_base != xmlMemBlocks()) {
38905 printf("Leak of %d blocks found in xmlUCSIsSpecials",
38906 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038907 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038908 printf(" %d", n_code);
38909 printf("\n");
38910 }
38911 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038912 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038913#endif
38914
Daniel Veillard42595322004-11-08 10:52:06 +000038915 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038916}
38917
38918
38919static int
38920test_xmlUCSIsSuperscriptsandSubscripts(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038921 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038922
William M. Brack21e4ef22005-01-02 09:53:13 +000038923#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038924 int mem_base;
38925 int ret_val;
38926 int code; /* UCS code point */
38927 int n_code;
38928
38929 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38930 mem_base = xmlMemBlocks();
38931 code = gen_int(n_code, 0);
38932
38933 ret_val = xmlUCSIsSuperscriptsandSubscripts(code);
38934 desret_int(ret_val);
38935 call_tests++;
38936 des_int(n_code, code, 0);
38937 xmlResetLastError();
38938 if (mem_base != xmlMemBlocks()) {
38939 printf("Leak of %d blocks found in xmlUCSIsSuperscriptsandSubscripts",
38940 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038941 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038942 printf(" %d", n_code);
38943 printf("\n");
38944 }
38945 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038946 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038947#endif
38948
Daniel Veillard42595322004-11-08 10:52:06 +000038949 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038950}
38951
38952
38953static int
38954test_xmlUCSIsSupplementalArrowsA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038955 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038956
William M. Brack21e4ef22005-01-02 09:53:13 +000038957#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038958 int mem_base;
38959 int ret_val;
38960 int code; /* UCS code point */
38961 int n_code;
38962
38963 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38964 mem_base = xmlMemBlocks();
38965 code = gen_int(n_code, 0);
38966
38967 ret_val = xmlUCSIsSupplementalArrowsA(code);
38968 desret_int(ret_val);
38969 call_tests++;
38970 des_int(n_code, code, 0);
38971 xmlResetLastError();
38972 if (mem_base != xmlMemBlocks()) {
38973 printf("Leak of %d blocks found in xmlUCSIsSupplementalArrowsA",
38974 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038975 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038976 printf(" %d", n_code);
38977 printf("\n");
38978 }
38979 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038980 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038981#endif
38982
Daniel Veillard42595322004-11-08 10:52:06 +000038983 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038984}
38985
38986
38987static int
38988test_xmlUCSIsSupplementalArrowsB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038989 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038990
William M. Brack21e4ef22005-01-02 09:53:13 +000038991#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038992 int mem_base;
38993 int ret_val;
38994 int code; /* UCS code point */
38995 int n_code;
38996
38997 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38998 mem_base = xmlMemBlocks();
38999 code = gen_int(n_code, 0);
39000
39001 ret_val = xmlUCSIsSupplementalArrowsB(code);
39002 desret_int(ret_val);
39003 call_tests++;
39004 des_int(n_code, code, 0);
39005 xmlResetLastError();
39006 if (mem_base != xmlMemBlocks()) {
39007 printf("Leak of %d blocks found in xmlUCSIsSupplementalArrowsB",
39008 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039009 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039010 printf(" %d", n_code);
39011 printf("\n");
39012 }
39013 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039014 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039015#endif
39016
Daniel Veillard42595322004-11-08 10:52:06 +000039017 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039018}
39019
39020
39021static int
39022test_xmlUCSIsSupplementalMathematicalOperators(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039023 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039024
William M. Brack21e4ef22005-01-02 09:53:13 +000039025#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039026 int mem_base;
39027 int ret_val;
39028 int code; /* UCS code point */
39029 int n_code;
39030
39031 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39032 mem_base = xmlMemBlocks();
39033 code = gen_int(n_code, 0);
39034
39035 ret_val = xmlUCSIsSupplementalMathematicalOperators(code);
39036 desret_int(ret_val);
39037 call_tests++;
39038 des_int(n_code, code, 0);
39039 xmlResetLastError();
39040 if (mem_base != xmlMemBlocks()) {
39041 printf("Leak of %d blocks found in xmlUCSIsSupplementalMathematicalOperators",
39042 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039043 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039044 printf(" %d", n_code);
39045 printf("\n");
39046 }
39047 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039048 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039049#endif
39050
Daniel Veillard42595322004-11-08 10:52:06 +000039051 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039052}
39053
39054
39055static int
39056test_xmlUCSIsSupplementaryPrivateUseAreaA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039057 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039058
William M. Brack21e4ef22005-01-02 09:53:13 +000039059#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039060 int mem_base;
39061 int ret_val;
39062 int code; /* UCS code point */
39063 int n_code;
39064
39065 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39066 mem_base = xmlMemBlocks();
39067 code = gen_int(n_code, 0);
39068
39069 ret_val = xmlUCSIsSupplementaryPrivateUseAreaA(code);
39070 desret_int(ret_val);
39071 call_tests++;
39072 des_int(n_code, code, 0);
39073 xmlResetLastError();
39074 if (mem_base != xmlMemBlocks()) {
39075 printf("Leak of %d blocks found in xmlUCSIsSupplementaryPrivateUseAreaA",
39076 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039077 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039078 printf(" %d", n_code);
39079 printf("\n");
39080 }
39081 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039082 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039083#endif
39084
Daniel Veillard42595322004-11-08 10:52:06 +000039085 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039086}
39087
39088
39089static int
39090test_xmlUCSIsSupplementaryPrivateUseAreaB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039091 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039092
William M. Brack21e4ef22005-01-02 09:53:13 +000039093#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039094 int mem_base;
39095 int ret_val;
39096 int code; /* UCS code point */
39097 int n_code;
39098
39099 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39100 mem_base = xmlMemBlocks();
39101 code = gen_int(n_code, 0);
39102
39103 ret_val = xmlUCSIsSupplementaryPrivateUseAreaB(code);
39104 desret_int(ret_val);
39105 call_tests++;
39106 des_int(n_code, code, 0);
39107 xmlResetLastError();
39108 if (mem_base != xmlMemBlocks()) {
39109 printf("Leak of %d blocks found in xmlUCSIsSupplementaryPrivateUseAreaB",
39110 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039111 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039112 printf(" %d", n_code);
39113 printf("\n");
39114 }
39115 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039116 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039117#endif
39118
Daniel Veillard42595322004-11-08 10:52:06 +000039119 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039120}
39121
39122
39123static int
39124test_xmlUCSIsSyriac(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039125 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039126
William M. Brack21e4ef22005-01-02 09:53:13 +000039127#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039128 int mem_base;
39129 int ret_val;
39130 int code; /* UCS code point */
39131 int n_code;
39132
39133 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39134 mem_base = xmlMemBlocks();
39135 code = gen_int(n_code, 0);
39136
39137 ret_val = xmlUCSIsSyriac(code);
39138 desret_int(ret_val);
39139 call_tests++;
39140 des_int(n_code, code, 0);
39141 xmlResetLastError();
39142 if (mem_base != xmlMemBlocks()) {
39143 printf("Leak of %d blocks found in xmlUCSIsSyriac",
39144 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039145 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039146 printf(" %d", n_code);
39147 printf("\n");
39148 }
39149 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039150 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039151#endif
39152
Daniel Veillard42595322004-11-08 10:52:06 +000039153 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039154}
39155
39156
39157static int
39158test_xmlUCSIsTagalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039159 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039160
William M. Brack21e4ef22005-01-02 09:53:13 +000039161#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039162 int mem_base;
39163 int ret_val;
39164 int code; /* UCS code point */
39165 int n_code;
39166
39167 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39168 mem_base = xmlMemBlocks();
39169 code = gen_int(n_code, 0);
39170
39171 ret_val = xmlUCSIsTagalog(code);
39172 desret_int(ret_val);
39173 call_tests++;
39174 des_int(n_code, code, 0);
39175 xmlResetLastError();
39176 if (mem_base != xmlMemBlocks()) {
39177 printf("Leak of %d blocks found in xmlUCSIsTagalog",
39178 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039179 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039180 printf(" %d", n_code);
39181 printf("\n");
39182 }
39183 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039184 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039185#endif
39186
Daniel Veillard42595322004-11-08 10:52:06 +000039187 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039188}
39189
39190
39191static int
39192test_xmlUCSIsTagbanwa(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039193 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039194
William M. Brack21e4ef22005-01-02 09:53:13 +000039195#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039196 int mem_base;
39197 int ret_val;
39198 int code; /* UCS code point */
39199 int n_code;
39200
39201 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39202 mem_base = xmlMemBlocks();
39203 code = gen_int(n_code, 0);
39204
39205 ret_val = xmlUCSIsTagbanwa(code);
39206 desret_int(ret_val);
39207 call_tests++;
39208 des_int(n_code, code, 0);
39209 xmlResetLastError();
39210 if (mem_base != xmlMemBlocks()) {
39211 printf("Leak of %d blocks found in xmlUCSIsTagbanwa",
39212 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039213 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039214 printf(" %d", n_code);
39215 printf("\n");
39216 }
39217 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039218 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039219#endif
39220
Daniel Veillard42595322004-11-08 10:52:06 +000039221 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039222}
39223
39224
39225static int
39226test_xmlUCSIsTags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039227 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039228
William M. Brack21e4ef22005-01-02 09:53:13 +000039229#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039230 int mem_base;
39231 int ret_val;
39232 int code; /* UCS code point */
39233 int n_code;
39234
39235 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39236 mem_base = xmlMemBlocks();
39237 code = gen_int(n_code, 0);
39238
39239 ret_val = xmlUCSIsTags(code);
39240 desret_int(ret_val);
39241 call_tests++;
39242 des_int(n_code, code, 0);
39243 xmlResetLastError();
39244 if (mem_base != xmlMemBlocks()) {
39245 printf("Leak of %d blocks found in xmlUCSIsTags",
39246 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039247 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039248 printf(" %d", n_code);
39249 printf("\n");
39250 }
39251 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039252 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039253#endif
39254
Daniel Veillard42595322004-11-08 10:52:06 +000039255 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039256}
39257
39258
39259static int
39260test_xmlUCSIsTaiLe(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039261 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039262
William M. Brack21e4ef22005-01-02 09:53:13 +000039263#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039264 int mem_base;
39265 int ret_val;
39266 int code; /* UCS code point */
39267 int n_code;
39268
39269 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39270 mem_base = xmlMemBlocks();
39271 code = gen_int(n_code, 0);
39272
39273 ret_val = xmlUCSIsTaiLe(code);
39274 desret_int(ret_val);
39275 call_tests++;
39276 des_int(n_code, code, 0);
39277 xmlResetLastError();
39278 if (mem_base != xmlMemBlocks()) {
39279 printf("Leak of %d blocks found in xmlUCSIsTaiLe",
39280 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039281 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039282 printf(" %d", n_code);
39283 printf("\n");
39284 }
39285 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039286 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039287#endif
39288
Daniel Veillard42595322004-11-08 10:52:06 +000039289 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039290}
39291
39292
39293static int
39294test_xmlUCSIsTaiXuanJingSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039295 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039296
William M. Brack21e4ef22005-01-02 09:53:13 +000039297#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039298 int mem_base;
39299 int ret_val;
39300 int code; /* UCS code point */
39301 int n_code;
39302
39303 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39304 mem_base = xmlMemBlocks();
39305 code = gen_int(n_code, 0);
39306
39307 ret_val = xmlUCSIsTaiXuanJingSymbols(code);
39308 desret_int(ret_val);
39309 call_tests++;
39310 des_int(n_code, code, 0);
39311 xmlResetLastError();
39312 if (mem_base != xmlMemBlocks()) {
39313 printf("Leak of %d blocks found in xmlUCSIsTaiXuanJingSymbols",
39314 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039315 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039316 printf(" %d", n_code);
39317 printf("\n");
39318 }
39319 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039320 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039321#endif
39322
Daniel Veillard42595322004-11-08 10:52:06 +000039323 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039324}
39325
39326
39327static int
39328test_xmlUCSIsTamil(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039329 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039330
William M. Brack21e4ef22005-01-02 09:53:13 +000039331#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039332 int mem_base;
39333 int ret_val;
39334 int code; /* UCS code point */
39335 int n_code;
39336
39337 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39338 mem_base = xmlMemBlocks();
39339 code = gen_int(n_code, 0);
39340
39341 ret_val = xmlUCSIsTamil(code);
39342 desret_int(ret_val);
39343 call_tests++;
39344 des_int(n_code, code, 0);
39345 xmlResetLastError();
39346 if (mem_base != xmlMemBlocks()) {
39347 printf("Leak of %d blocks found in xmlUCSIsTamil",
39348 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039349 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039350 printf(" %d", n_code);
39351 printf("\n");
39352 }
39353 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039354 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039355#endif
39356
Daniel Veillard42595322004-11-08 10:52:06 +000039357 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039358}
39359
39360
39361static int
39362test_xmlUCSIsTelugu(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039363 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039364
William M. Brack21e4ef22005-01-02 09:53:13 +000039365#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039366 int mem_base;
39367 int ret_val;
39368 int code; /* UCS code point */
39369 int n_code;
39370
39371 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39372 mem_base = xmlMemBlocks();
39373 code = gen_int(n_code, 0);
39374
39375 ret_val = xmlUCSIsTelugu(code);
39376 desret_int(ret_val);
39377 call_tests++;
39378 des_int(n_code, code, 0);
39379 xmlResetLastError();
39380 if (mem_base != xmlMemBlocks()) {
39381 printf("Leak of %d blocks found in xmlUCSIsTelugu",
39382 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039383 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039384 printf(" %d", n_code);
39385 printf("\n");
39386 }
39387 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039388 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039389#endif
39390
Daniel Veillard42595322004-11-08 10:52:06 +000039391 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039392}
39393
39394
39395static int
39396test_xmlUCSIsThaana(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039397 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039398
William M. Brack21e4ef22005-01-02 09:53:13 +000039399#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039400 int mem_base;
39401 int ret_val;
39402 int code; /* UCS code point */
39403 int n_code;
39404
39405 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39406 mem_base = xmlMemBlocks();
39407 code = gen_int(n_code, 0);
39408
39409 ret_val = xmlUCSIsThaana(code);
39410 desret_int(ret_val);
39411 call_tests++;
39412 des_int(n_code, code, 0);
39413 xmlResetLastError();
39414 if (mem_base != xmlMemBlocks()) {
39415 printf("Leak of %d blocks found in xmlUCSIsThaana",
39416 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039417 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039418 printf(" %d", n_code);
39419 printf("\n");
39420 }
39421 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039422 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039423#endif
39424
Daniel Veillard42595322004-11-08 10:52:06 +000039425 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039426}
39427
39428
39429static int
39430test_xmlUCSIsThai(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039431 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039432
William M. Brack21e4ef22005-01-02 09:53:13 +000039433#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039434 int mem_base;
39435 int ret_val;
39436 int code; /* UCS code point */
39437 int n_code;
39438
39439 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39440 mem_base = xmlMemBlocks();
39441 code = gen_int(n_code, 0);
39442
39443 ret_val = xmlUCSIsThai(code);
39444 desret_int(ret_val);
39445 call_tests++;
39446 des_int(n_code, code, 0);
39447 xmlResetLastError();
39448 if (mem_base != xmlMemBlocks()) {
39449 printf("Leak of %d blocks found in xmlUCSIsThai",
39450 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039451 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039452 printf(" %d", n_code);
39453 printf("\n");
39454 }
39455 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039456 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039457#endif
39458
Daniel Veillard42595322004-11-08 10:52:06 +000039459 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039460}
39461
39462
39463static int
39464test_xmlUCSIsTibetan(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039465 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039466
William M. Brack21e4ef22005-01-02 09:53:13 +000039467#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039468 int mem_base;
39469 int ret_val;
39470 int code; /* UCS code point */
39471 int n_code;
39472
39473 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39474 mem_base = xmlMemBlocks();
39475 code = gen_int(n_code, 0);
39476
39477 ret_val = xmlUCSIsTibetan(code);
39478 desret_int(ret_val);
39479 call_tests++;
39480 des_int(n_code, code, 0);
39481 xmlResetLastError();
39482 if (mem_base != xmlMemBlocks()) {
39483 printf("Leak of %d blocks found in xmlUCSIsTibetan",
39484 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039485 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039486 printf(" %d", n_code);
39487 printf("\n");
39488 }
39489 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039490 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039491#endif
39492
Daniel Veillard42595322004-11-08 10:52:06 +000039493 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039494}
39495
39496
39497static int
39498test_xmlUCSIsUgaritic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039499 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039500
William M. Brack21e4ef22005-01-02 09:53:13 +000039501#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039502 int mem_base;
39503 int ret_val;
39504 int code; /* UCS code point */
39505 int n_code;
39506
39507 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39508 mem_base = xmlMemBlocks();
39509 code = gen_int(n_code, 0);
39510
39511 ret_val = xmlUCSIsUgaritic(code);
39512 desret_int(ret_val);
39513 call_tests++;
39514 des_int(n_code, code, 0);
39515 xmlResetLastError();
39516 if (mem_base != xmlMemBlocks()) {
39517 printf("Leak of %d blocks found in xmlUCSIsUgaritic",
39518 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039519 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039520 printf(" %d", n_code);
39521 printf("\n");
39522 }
39523 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039524 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039525#endif
39526
Daniel Veillard42595322004-11-08 10:52:06 +000039527 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039528}
39529
39530
39531static int
39532test_xmlUCSIsUnifiedCanadianAboriginalSyllabics(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039533 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039534
William M. Brack21e4ef22005-01-02 09:53:13 +000039535#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039536 int mem_base;
39537 int ret_val;
39538 int code; /* UCS code point */
39539 int n_code;
39540
39541 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39542 mem_base = xmlMemBlocks();
39543 code = gen_int(n_code, 0);
39544
39545 ret_val = xmlUCSIsUnifiedCanadianAboriginalSyllabics(code);
39546 desret_int(ret_val);
39547 call_tests++;
39548 des_int(n_code, code, 0);
39549 xmlResetLastError();
39550 if (mem_base != xmlMemBlocks()) {
39551 printf("Leak of %d blocks found in xmlUCSIsUnifiedCanadianAboriginalSyllabics",
39552 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039553 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039554 printf(" %d", n_code);
39555 printf("\n");
39556 }
39557 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039558 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039559#endif
39560
Daniel Veillard42595322004-11-08 10:52:06 +000039561 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039562}
39563
39564
39565static int
39566test_xmlUCSIsVariationSelectors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039567 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039568
William M. Brack21e4ef22005-01-02 09:53:13 +000039569#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039570 int mem_base;
39571 int ret_val;
39572 int code; /* UCS code point */
39573 int n_code;
39574
39575 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39576 mem_base = xmlMemBlocks();
39577 code = gen_int(n_code, 0);
39578
39579 ret_val = xmlUCSIsVariationSelectors(code);
39580 desret_int(ret_val);
39581 call_tests++;
39582 des_int(n_code, code, 0);
39583 xmlResetLastError();
39584 if (mem_base != xmlMemBlocks()) {
39585 printf("Leak of %d blocks found in xmlUCSIsVariationSelectors",
39586 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039587 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039588 printf(" %d", n_code);
39589 printf("\n");
39590 }
39591 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039592 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039593#endif
39594
Daniel Veillard42595322004-11-08 10:52:06 +000039595 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039596}
39597
39598
39599static int
39600test_xmlUCSIsVariationSelectorsSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039601 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039602
William M. Brack21e4ef22005-01-02 09:53:13 +000039603#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039604 int mem_base;
39605 int ret_val;
39606 int code; /* UCS code point */
39607 int n_code;
39608
39609 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39610 mem_base = xmlMemBlocks();
39611 code = gen_int(n_code, 0);
39612
39613 ret_val = xmlUCSIsVariationSelectorsSupplement(code);
39614 desret_int(ret_val);
39615 call_tests++;
39616 des_int(n_code, code, 0);
39617 xmlResetLastError();
39618 if (mem_base != xmlMemBlocks()) {
39619 printf("Leak of %d blocks found in xmlUCSIsVariationSelectorsSupplement",
39620 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039621 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039622 printf(" %d", n_code);
39623 printf("\n");
39624 }
39625 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039626 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039627#endif
39628
Daniel Veillard42595322004-11-08 10:52:06 +000039629 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039630}
39631
39632
39633static int
39634test_xmlUCSIsYiRadicals(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039635 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039636
William M. Brack21e4ef22005-01-02 09:53:13 +000039637#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039638 int mem_base;
39639 int ret_val;
39640 int code; /* UCS code point */
39641 int n_code;
39642
39643 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39644 mem_base = xmlMemBlocks();
39645 code = gen_int(n_code, 0);
39646
39647 ret_val = xmlUCSIsYiRadicals(code);
39648 desret_int(ret_val);
39649 call_tests++;
39650 des_int(n_code, code, 0);
39651 xmlResetLastError();
39652 if (mem_base != xmlMemBlocks()) {
39653 printf("Leak of %d blocks found in xmlUCSIsYiRadicals",
39654 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039655 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039656 printf(" %d", n_code);
39657 printf("\n");
39658 }
39659 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039660 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039661#endif
39662
Daniel Veillard42595322004-11-08 10:52:06 +000039663 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039664}
39665
39666
39667static int
39668test_xmlUCSIsYiSyllables(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039669 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039670
William M. Brack21e4ef22005-01-02 09:53:13 +000039671#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039672 int mem_base;
39673 int ret_val;
39674 int code; /* UCS code point */
39675 int n_code;
39676
39677 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39678 mem_base = xmlMemBlocks();
39679 code = gen_int(n_code, 0);
39680
39681 ret_val = xmlUCSIsYiSyllables(code);
39682 desret_int(ret_val);
39683 call_tests++;
39684 des_int(n_code, code, 0);
39685 xmlResetLastError();
39686 if (mem_base != xmlMemBlocks()) {
39687 printf("Leak of %d blocks found in xmlUCSIsYiSyllables",
39688 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039689 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039690 printf(" %d", n_code);
39691 printf("\n");
39692 }
39693 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039694 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039695#endif
39696
Daniel Veillard42595322004-11-08 10:52:06 +000039697 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039698}
39699
39700
39701static int
39702test_xmlUCSIsYijingHexagramSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039703 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039704
William M. Brack21e4ef22005-01-02 09:53:13 +000039705#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039706 int mem_base;
39707 int ret_val;
39708 int code; /* UCS code point */
39709 int n_code;
39710
39711 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39712 mem_base = xmlMemBlocks();
39713 code = gen_int(n_code, 0);
39714
39715 ret_val = xmlUCSIsYijingHexagramSymbols(code);
39716 desret_int(ret_val);
39717 call_tests++;
39718 des_int(n_code, code, 0);
39719 xmlResetLastError();
39720 if (mem_base != xmlMemBlocks()) {
39721 printf("Leak of %d blocks found in xmlUCSIsYijingHexagramSymbols",
39722 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039723 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039724 printf(" %d", n_code);
39725 printf("\n");
39726 }
39727 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039728 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039729#endif
39730
Daniel Veillard42595322004-11-08 10:52:06 +000039731 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039732}
39733
39734static int
39735test_xmlunicode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039736 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039737
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039738 if (quiet == 0) printf("Testing xmlunicode : 166 of 166 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000039739 test_ret += test_xmlUCSIsAegeanNumbers();
39740 test_ret += test_xmlUCSIsAlphabeticPresentationForms();
39741 test_ret += test_xmlUCSIsArabic();
39742 test_ret += test_xmlUCSIsArabicPresentationFormsA();
39743 test_ret += test_xmlUCSIsArabicPresentationFormsB();
39744 test_ret += test_xmlUCSIsArmenian();
39745 test_ret += test_xmlUCSIsArrows();
39746 test_ret += test_xmlUCSIsBasicLatin();
39747 test_ret += test_xmlUCSIsBengali();
39748 test_ret += test_xmlUCSIsBlock();
39749 test_ret += test_xmlUCSIsBlockElements();
39750 test_ret += test_xmlUCSIsBopomofo();
39751 test_ret += test_xmlUCSIsBopomofoExtended();
39752 test_ret += test_xmlUCSIsBoxDrawing();
39753 test_ret += test_xmlUCSIsBraillePatterns();
39754 test_ret += test_xmlUCSIsBuhid();
39755 test_ret += test_xmlUCSIsByzantineMusicalSymbols();
39756 test_ret += test_xmlUCSIsCJKCompatibility();
39757 test_ret += test_xmlUCSIsCJKCompatibilityForms();
39758 test_ret += test_xmlUCSIsCJKCompatibilityIdeographs();
39759 test_ret += test_xmlUCSIsCJKCompatibilityIdeographsSupplement();
39760 test_ret += test_xmlUCSIsCJKRadicalsSupplement();
39761 test_ret += test_xmlUCSIsCJKSymbolsandPunctuation();
39762 test_ret += test_xmlUCSIsCJKUnifiedIdeographs();
39763 test_ret += test_xmlUCSIsCJKUnifiedIdeographsExtensionA();
39764 test_ret += test_xmlUCSIsCJKUnifiedIdeographsExtensionB();
39765 test_ret += test_xmlUCSIsCat();
39766 test_ret += test_xmlUCSIsCatC();
39767 test_ret += test_xmlUCSIsCatCc();
39768 test_ret += test_xmlUCSIsCatCf();
39769 test_ret += test_xmlUCSIsCatCo();
39770 test_ret += test_xmlUCSIsCatCs();
39771 test_ret += test_xmlUCSIsCatL();
39772 test_ret += test_xmlUCSIsCatLl();
39773 test_ret += test_xmlUCSIsCatLm();
39774 test_ret += test_xmlUCSIsCatLo();
39775 test_ret += test_xmlUCSIsCatLt();
39776 test_ret += test_xmlUCSIsCatLu();
39777 test_ret += test_xmlUCSIsCatM();
39778 test_ret += test_xmlUCSIsCatMc();
39779 test_ret += test_xmlUCSIsCatMe();
39780 test_ret += test_xmlUCSIsCatMn();
39781 test_ret += test_xmlUCSIsCatN();
39782 test_ret += test_xmlUCSIsCatNd();
39783 test_ret += test_xmlUCSIsCatNl();
39784 test_ret += test_xmlUCSIsCatNo();
39785 test_ret += test_xmlUCSIsCatP();
39786 test_ret += test_xmlUCSIsCatPc();
39787 test_ret += test_xmlUCSIsCatPd();
39788 test_ret += test_xmlUCSIsCatPe();
39789 test_ret += test_xmlUCSIsCatPf();
39790 test_ret += test_xmlUCSIsCatPi();
39791 test_ret += test_xmlUCSIsCatPo();
39792 test_ret += test_xmlUCSIsCatPs();
39793 test_ret += test_xmlUCSIsCatS();
39794 test_ret += test_xmlUCSIsCatSc();
39795 test_ret += test_xmlUCSIsCatSk();
39796 test_ret += test_xmlUCSIsCatSm();
39797 test_ret += test_xmlUCSIsCatSo();
39798 test_ret += test_xmlUCSIsCatZ();
39799 test_ret += test_xmlUCSIsCatZl();
39800 test_ret += test_xmlUCSIsCatZp();
39801 test_ret += test_xmlUCSIsCatZs();
39802 test_ret += test_xmlUCSIsCherokee();
39803 test_ret += test_xmlUCSIsCombiningDiacriticalMarks();
39804 test_ret += test_xmlUCSIsCombiningDiacriticalMarksforSymbols();
39805 test_ret += test_xmlUCSIsCombiningHalfMarks();
39806 test_ret += test_xmlUCSIsCombiningMarksforSymbols();
39807 test_ret += test_xmlUCSIsControlPictures();
39808 test_ret += test_xmlUCSIsCurrencySymbols();
39809 test_ret += test_xmlUCSIsCypriotSyllabary();
39810 test_ret += test_xmlUCSIsCyrillic();
39811 test_ret += test_xmlUCSIsCyrillicSupplement();
39812 test_ret += test_xmlUCSIsDeseret();
39813 test_ret += test_xmlUCSIsDevanagari();
39814 test_ret += test_xmlUCSIsDingbats();
39815 test_ret += test_xmlUCSIsEnclosedAlphanumerics();
39816 test_ret += test_xmlUCSIsEnclosedCJKLettersandMonths();
39817 test_ret += test_xmlUCSIsEthiopic();
39818 test_ret += test_xmlUCSIsGeneralPunctuation();
39819 test_ret += test_xmlUCSIsGeometricShapes();
39820 test_ret += test_xmlUCSIsGeorgian();
39821 test_ret += test_xmlUCSIsGothic();
39822 test_ret += test_xmlUCSIsGreek();
39823 test_ret += test_xmlUCSIsGreekExtended();
39824 test_ret += test_xmlUCSIsGreekandCoptic();
39825 test_ret += test_xmlUCSIsGujarati();
39826 test_ret += test_xmlUCSIsGurmukhi();
39827 test_ret += test_xmlUCSIsHalfwidthandFullwidthForms();
39828 test_ret += test_xmlUCSIsHangulCompatibilityJamo();
39829 test_ret += test_xmlUCSIsHangulJamo();
39830 test_ret += test_xmlUCSIsHangulSyllables();
39831 test_ret += test_xmlUCSIsHanunoo();
39832 test_ret += test_xmlUCSIsHebrew();
39833 test_ret += test_xmlUCSIsHighPrivateUseSurrogates();
39834 test_ret += test_xmlUCSIsHighSurrogates();
39835 test_ret += test_xmlUCSIsHiragana();
39836 test_ret += test_xmlUCSIsIPAExtensions();
39837 test_ret += test_xmlUCSIsIdeographicDescriptionCharacters();
39838 test_ret += test_xmlUCSIsKanbun();
39839 test_ret += test_xmlUCSIsKangxiRadicals();
39840 test_ret += test_xmlUCSIsKannada();
39841 test_ret += test_xmlUCSIsKatakana();
39842 test_ret += test_xmlUCSIsKatakanaPhoneticExtensions();
39843 test_ret += test_xmlUCSIsKhmer();
39844 test_ret += test_xmlUCSIsKhmerSymbols();
39845 test_ret += test_xmlUCSIsLao();
39846 test_ret += test_xmlUCSIsLatin1Supplement();
39847 test_ret += test_xmlUCSIsLatinExtendedA();
39848 test_ret += test_xmlUCSIsLatinExtendedAdditional();
39849 test_ret += test_xmlUCSIsLatinExtendedB();
39850 test_ret += test_xmlUCSIsLetterlikeSymbols();
39851 test_ret += test_xmlUCSIsLimbu();
39852 test_ret += test_xmlUCSIsLinearBIdeograms();
39853 test_ret += test_xmlUCSIsLinearBSyllabary();
39854 test_ret += test_xmlUCSIsLowSurrogates();
39855 test_ret += test_xmlUCSIsMalayalam();
39856 test_ret += test_xmlUCSIsMathematicalAlphanumericSymbols();
39857 test_ret += test_xmlUCSIsMathematicalOperators();
39858 test_ret += test_xmlUCSIsMiscellaneousMathematicalSymbolsA();
39859 test_ret += test_xmlUCSIsMiscellaneousMathematicalSymbolsB();
39860 test_ret += test_xmlUCSIsMiscellaneousSymbols();
39861 test_ret += test_xmlUCSIsMiscellaneousSymbolsandArrows();
39862 test_ret += test_xmlUCSIsMiscellaneousTechnical();
39863 test_ret += test_xmlUCSIsMongolian();
39864 test_ret += test_xmlUCSIsMusicalSymbols();
39865 test_ret += test_xmlUCSIsMyanmar();
39866 test_ret += test_xmlUCSIsNumberForms();
39867 test_ret += test_xmlUCSIsOgham();
39868 test_ret += test_xmlUCSIsOldItalic();
39869 test_ret += test_xmlUCSIsOpticalCharacterRecognition();
39870 test_ret += test_xmlUCSIsOriya();
39871 test_ret += test_xmlUCSIsOsmanya();
39872 test_ret += test_xmlUCSIsPhoneticExtensions();
39873 test_ret += test_xmlUCSIsPrivateUse();
39874 test_ret += test_xmlUCSIsPrivateUseArea();
39875 test_ret += test_xmlUCSIsRunic();
39876 test_ret += test_xmlUCSIsShavian();
39877 test_ret += test_xmlUCSIsSinhala();
39878 test_ret += test_xmlUCSIsSmallFormVariants();
39879 test_ret += test_xmlUCSIsSpacingModifierLetters();
39880 test_ret += test_xmlUCSIsSpecials();
39881 test_ret += test_xmlUCSIsSuperscriptsandSubscripts();
39882 test_ret += test_xmlUCSIsSupplementalArrowsA();
39883 test_ret += test_xmlUCSIsSupplementalArrowsB();
39884 test_ret += test_xmlUCSIsSupplementalMathematicalOperators();
39885 test_ret += test_xmlUCSIsSupplementaryPrivateUseAreaA();
39886 test_ret += test_xmlUCSIsSupplementaryPrivateUseAreaB();
39887 test_ret += test_xmlUCSIsSyriac();
39888 test_ret += test_xmlUCSIsTagalog();
39889 test_ret += test_xmlUCSIsTagbanwa();
39890 test_ret += test_xmlUCSIsTags();
39891 test_ret += test_xmlUCSIsTaiLe();
39892 test_ret += test_xmlUCSIsTaiXuanJingSymbols();
39893 test_ret += test_xmlUCSIsTamil();
39894 test_ret += test_xmlUCSIsTelugu();
39895 test_ret += test_xmlUCSIsThaana();
39896 test_ret += test_xmlUCSIsThai();
39897 test_ret += test_xmlUCSIsTibetan();
39898 test_ret += test_xmlUCSIsUgaritic();
39899 test_ret += test_xmlUCSIsUnifiedCanadianAboriginalSyllabics();
39900 test_ret += test_xmlUCSIsVariationSelectors();
39901 test_ret += test_xmlUCSIsVariationSelectorsSupplement();
39902 test_ret += test_xmlUCSIsYiRadicals();
39903 test_ret += test_xmlUCSIsYiSyllables();
39904 test_ret += test_xmlUCSIsYijingHexagramSymbols();
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039905
Daniel Veillard42595322004-11-08 10:52:06 +000039906 if (test_ret != 0)
39907 printf("Module xmlunicode: %d errors\n", test_ret);
39908 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039909}
39910
39911static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000039912test_xmlNewTextWriter(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039913 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039914
William M. Brack21e4ef22005-01-02 09:53:13 +000039915#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039916 int mem_base;
39917 xmlTextWriterPtr ret_val;
39918 xmlOutputBufferPtr out; /* an xmlOutputBufferPtr */
39919 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039920
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039921 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
39922 mem_base = xmlMemBlocks();
39923 out = gen_xmlOutputBufferPtr(n_out, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039924
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039925 ret_val = xmlNewTextWriter(out);
39926 if (ret_val != NULL) out = NULL;
39927 desret_xmlTextWriterPtr(ret_val);
39928 call_tests++;
39929 des_xmlOutputBufferPtr(n_out, out, 0);
39930 xmlResetLastError();
39931 if (mem_base != xmlMemBlocks()) {
39932 printf("Leak of %d blocks found in xmlNewTextWriter",
39933 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039934 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039935 printf(" %d", n_out);
39936 printf("\n");
39937 }
39938 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039939 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039940#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000039941
Daniel Veillard42595322004-11-08 10:52:06 +000039942 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039943}
39944
39945
39946static int
39947test_xmlNewTextWriterFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039948 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039949
William M. Brack21e4ef22005-01-02 09:53:13 +000039950#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039951 int mem_base;
39952 xmlTextWriterPtr ret_val;
39953 const char * uri; /* the URI of the resource for the output */
39954 int n_uri;
39955 int compression; /* compress the output? */
39956 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039957
Daniel Veillard42595322004-11-08 10:52:06 +000039958 for (n_uri = 0;n_uri < gen_nb_fileoutput;n_uri++) {
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039959 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
39960 mem_base = xmlMemBlocks();
Daniel Veillard42595322004-11-08 10:52:06 +000039961 uri = gen_fileoutput(n_uri, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039962 compression = gen_int(n_compression, 1);
39963
39964 ret_val = xmlNewTextWriterFilename(uri, compression);
39965 desret_xmlTextWriterPtr(ret_val);
39966 call_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039967 des_fileoutput(n_uri, uri, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039968 des_int(n_compression, compression, 1);
39969 xmlResetLastError();
39970 if (mem_base != xmlMemBlocks()) {
39971 printf("Leak of %d blocks found in xmlNewTextWriterFilename",
39972 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039973 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039974 printf(" %d", n_uri);
39975 printf(" %d", n_compression);
39976 printf("\n");
39977 }
39978 }
39979 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039980 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039981#endif
39982
Daniel Veillard42595322004-11-08 10:52:06 +000039983 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039984}
39985
39986
39987static int
39988test_xmlNewTextWriterMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039989 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039990
William M. Brack21e4ef22005-01-02 09:53:13 +000039991#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039992 int mem_base;
39993 xmlTextWriterPtr ret_val;
39994 xmlBufferPtr buf; /* xmlBufferPtr */
39995 int n_buf;
39996 int compression; /* compress the output? */
39997 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039998
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039999 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
40000 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
40001 mem_base = xmlMemBlocks();
40002 buf = gen_xmlBufferPtr(n_buf, 0);
40003 compression = gen_int(n_compression, 1);
40004
40005 ret_val = xmlNewTextWriterMemory(buf, compression);
40006 desret_xmlTextWriterPtr(ret_val);
40007 call_tests++;
40008 des_xmlBufferPtr(n_buf, buf, 0);
40009 des_int(n_compression, compression, 1);
40010 xmlResetLastError();
40011 if (mem_base != xmlMemBlocks()) {
40012 printf("Leak of %d blocks found in xmlNewTextWriterMemory",
40013 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040014 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040015 printf(" %d", n_buf);
40016 printf(" %d", n_compression);
40017 printf("\n");
40018 }
40019 }
40020 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040021 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040022#endif
40023
Daniel Veillard42595322004-11-08 10:52:06 +000040024 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040025}
40026
40027
40028static int
40029test_xmlNewTextWriterPushParser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040030 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040031
William M. Brack21e4ef22005-01-02 09:53:13 +000040032#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040033 int mem_base;
40034 xmlTextWriterPtr ret_val;
40035 xmlParserCtxtPtr ctxt; /* xmlParserCtxtPtr to hold the new XML document tree */
40036 int n_ctxt;
40037 int compression; /* compress the output? */
40038 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040039
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040040 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
40041 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
40042 mem_base = xmlMemBlocks();
40043 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
40044 compression = gen_int(n_compression, 1);
40045
40046 ret_val = xmlNewTextWriterPushParser(ctxt, compression);
Daniel Veillarda521d282004-11-09 14:59:59 +000040047 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;} if (ret_val != NULL) ctxt = NULL;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040048 desret_xmlTextWriterPtr(ret_val);
40049 call_tests++;
40050 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
40051 des_int(n_compression, compression, 1);
40052 xmlResetLastError();
40053 if (mem_base != xmlMemBlocks()) {
40054 printf("Leak of %d blocks found in xmlNewTextWriterPushParser",
40055 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040056 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040057 printf(" %d", n_ctxt);
40058 printf(" %d", n_compression);
40059 printf("\n");
40060 }
40061 }
40062 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040063 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040064#endif
40065
Daniel Veillard42595322004-11-08 10:52:06 +000040066 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040067}
40068
40069
40070static int
40071test_xmlNewTextWriterTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040072 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040073
William M. Brack21e4ef22005-01-02 09:53:13 +000040074#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040075 int mem_base;
40076 xmlTextWriterPtr ret_val;
40077 xmlDocPtr doc; /* xmlDocPtr */
40078 int n_doc;
40079 xmlNodePtr node; /* xmlNodePtr or NULL for doc->children */
40080 int n_node;
40081 int compression; /* compress the output? */
40082 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040083
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040084 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
40085 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
40086 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
40087 mem_base = xmlMemBlocks();
40088 doc = gen_xmlDocPtr(n_doc, 0);
40089 node = gen_xmlNodePtr(n_node, 1);
40090 compression = gen_int(n_compression, 2);
40091
40092 ret_val = xmlNewTextWriterTree(doc, node, compression);
40093 desret_xmlTextWriterPtr(ret_val);
40094 call_tests++;
40095 des_xmlDocPtr(n_doc, doc, 0);
40096 des_xmlNodePtr(n_node, node, 1);
40097 des_int(n_compression, compression, 2);
40098 xmlResetLastError();
40099 if (mem_base != xmlMemBlocks()) {
40100 printf("Leak of %d blocks found in xmlNewTextWriterTree",
40101 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040102 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040103 printf(" %d", n_doc);
40104 printf(" %d", n_node);
40105 printf(" %d", n_compression);
40106 printf("\n");
40107 }
40108 }
40109 }
40110 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040111 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000040112#endif
40113
Daniel Veillard42595322004-11-08 10:52:06 +000040114 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040115}
40116
40117
40118static int
40119test_xmlTextWriterEndAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040120 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040121
William M. Brack21e4ef22005-01-02 09:53:13 +000040122#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040123 int mem_base;
40124 int ret_val;
40125 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40126 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040127
Daniel Veillarde43cc572004-11-03 11:50:29 +000040128 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40129 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040130 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040131
40132 ret_val = xmlTextWriterEndAttribute(writer);
40133 desret_int(ret_val);
40134 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040135 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040136 xmlResetLastError();
40137 if (mem_base != xmlMemBlocks()) {
40138 printf("Leak of %d blocks found in xmlTextWriterEndAttribute",
40139 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040140 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040141 printf(" %d", n_writer);
40142 printf("\n");
40143 }
40144 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040145 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040146#endif
40147
Daniel Veillard42595322004-11-08 10:52:06 +000040148 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040149}
40150
40151
40152static int
40153test_xmlTextWriterEndCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040154 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040155
William M. Brack21e4ef22005-01-02 09:53:13 +000040156#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040157 int mem_base;
40158 int ret_val;
40159 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40160 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040161
Daniel Veillarde43cc572004-11-03 11:50:29 +000040162 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40163 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040164 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040165
40166 ret_val = xmlTextWriterEndCDATA(writer);
40167 desret_int(ret_val);
40168 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040169 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040170 xmlResetLastError();
40171 if (mem_base != xmlMemBlocks()) {
40172 printf("Leak of %d blocks found in xmlTextWriterEndCDATA",
40173 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040174 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040175 printf(" %d", n_writer);
40176 printf("\n");
40177 }
40178 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040179 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040180#endif
40181
Daniel Veillard42595322004-11-08 10:52:06 +000040182 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040183}
40184
40185
40186static int
40187test_xmlTextWriterEndComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040188 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040189
William M. Brack21e4ef22005-01-02 09:53:13 +000040190#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040191 int mem_base;
40192 int ret_val;
40193 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40194 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040195
Daniel Veillarde43cc572004-11-03 11:50:29 +000040196 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40197 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040198 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040199
40200 ret_val = xmlTextWriterEndComment(writer);
40201 desret_int(ret_val);
40202 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040203 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040204 xmlResetLastError();
40205 if (mem_base != xmlMemBlocks()) {
40206 printf("Leak of %d blocks found in xmlTextWriterEndComment",
40207 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040208 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040209 printf(" %d", n_writer);
40210 printf("\n");
40211 }
40212 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040213 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040214#endif
40215
Daniel Veillard42595322004-11-08 10:52:06 +000040216 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040217}
40218
40219
40220static int
40221test_xmlTextWriterEndDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040222 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040223
William M. Brack21e4ef22005-01-02 09:53:13 +000040224#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040225 int mem_base;
40226 int ret_val;
40227 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40228 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040229
Daniel Veillarde43cc572004-11-03 11:50:29 +000040230 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40231 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040232 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040233
40234 ret_val = xmlTextWriterEndDTD(writer);
40235 desret_int(ret_val);
40236 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040237 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040238 xmlResetLastError();
40239 if (mem_base != xmlMemBlocks()) {
40240 printf("Leak of %d blocks found in xmlTextWriterEndDTD",
40241 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040242 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040243 printf(" %d", n_writer);
40244 printf("\n");
40245 }
40246 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040247 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040248#endif
40249
Daniel Veillard42595322004-11-08 10:52:06 +000040250 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040251}
40252
40253
40254static int
40255test_xmlTextWriterEndDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040256 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040257
William M. Brack21e4ef22005-01-02 09:53:13 +000040258#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040259 int mem_base;
40260 int ret_val;
40261 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40262 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040263
Daniel Veillarde43cc572004-11-03 11:50:29 +000040264 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40265 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040266 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040267
40268 ret_val = xmlTextWriterEndDTDAttlist(writer);
40269 desret_int(ret_val);
40270 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040271 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040272 xmlResetLastError();
40273 if (mem_base != xmlMemBlocks()) {
40274 printf("Leak of %d blocks found in xmlTextWriterEndDTDAttlist",
40275 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040276 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040277 printf(" %d", n_writer);
40278 printf("\n");
40279 }
40280 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040281 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040282#endif
40283
Daniel Veillard42595322004-11-08 10:52:06 +000040284 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040285}
40286
40287
40288static int
40289test_xmlTextWriterEndDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040290 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040291
William M. Brack21e4ef22005-01-02 09:53:13 +000040292#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040293 int mem_base;
40294 int ret_val;
40295 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40296 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040297
Daniel Veillarde43cc572004-11-03 11:50:29 +000040298 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40299 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040300 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040301
40302 ret_val = xmlTextWriterEndDTDElement(writer);
40303 desret_int(ret_val);
40304 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040305 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040306 xmlResetLastError();
40307 if (mem_base != xmlMemBlocks()) {
40308 printf("Leak of %d blocks found in xmlTextWriterEndDTDElement",
40309 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040310 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040311 printf(" %d", n_writer);
40312 printf("\n");
40313 }
40314 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040315 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040316#endif
40317
Daniel Veillard42595322004-11-08 10:52:06 +000040318 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040319}
40320
40321
40322static int
40323test_xmlTextWriterEndDTDEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040324 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040325
William M. Brack21e4ef22005-01-02 09:53:13 +000040326#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040327 int mem_base;
40328 int ret_val;
40329 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40330 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040331
Daniel Veillarde43cc572004-11-03 11:50:29 +000040332 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40333 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040334 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040335
40336 ret_val = xmlTextWriterEndDTDEntity(writer);
40337 desret_int(ret_val);
40338 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040339 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040340 xmlResetLastError();
40341 if (mem_base != xmlMemBlocks()) {
40342 printf("Leak of %d blocks found in xmlTextWriterEndDTDEntity",
40343 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040344 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040345 printf(" %d", n_writer);
40346 printf("\n");
40347 }
40348 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040349 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040350#endif
40351
Daniel Veillard42595322004-11-08 10:52:06 +000040352 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040353}
40354
40355
40356static int
40357test_xmlTextWriterEndDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040358 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040359
William M. Brack21e4ef22005-01-02 09:53:13 +000040360#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040361 int mem_base;
40362 int ret_val;
40363 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40364 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040365
Daniel Veillarde43cc572004-11-03 11:50:29 +000040366 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40367 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040368 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040369
40370 ret_val = xmlTextWriterEndDocument(writer);
40371 desret_int(ret_val);
40372 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040373 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040374 xmlResetLastError();
40375 if (mem_base != xmlMemBlocks()) {
40376 printf("Leak of %d blocks found in xmlTextWriterEndDocument",
40377 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040378 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040379 printf(" %d", n_writer);
40380 printf("\n");
40381 }
40382 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040383 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040384#endif
40385
Daniel Veillard42595322004-11-08 10:52:06 +000040386 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040387}
40388
40389
40390static int
40391test_xmlTextWriterEndElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040392 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040393
William M. Brack21e4ef22005-01-02 09:53:13 +000040394#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040395 int mem_base;
40396 int ret_val;
40397 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40398 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040399
Daniel Veillarde43cc572004-11-03 11:50:29 +000040400 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40401 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040402 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040403
40404 ret_val = xmlTextWriterEndElement(writer);
40405 desret_int(ret_val);
40406 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040407 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040408 xmlResetLastError();
40409 if (mem_base != xmlMemBlocks()) {
40410 printf("Leak of %d blocks found in xmlTextWriterEndElement",
40411 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040412 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040413 printf(" %d", n_writer);
40414 printf("\n");
40415 }
40416 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040417 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040418#endif
40419
Daniel Veillard42595322004-11-08 10:52:06 +000040420 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040421}
40422
40423
40424static int
40425test_xmlTextWriterEndPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040426 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040427
William M. Brack21e4ef22005-01-02 09:53:13 +000040428#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040429 int mem_base;
40430 int ret_val;
40431 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40432 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040433
Daniel Veillarde43cc572004-11-03 11:50:29 +000040434 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40435 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040436 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040437
40438 ret_val = xmlTextWriterEndPI(writer);
40439 desret_int(ret_val);
40440 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040441 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040442 xmlResetLastError();
40443 if (mem_base != xmlMemBlocks()) {
40444 printf("Leak of %d blocks found in xmlTextWriterEndPI",
40445 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040446 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040447 printf(" %d", n_writer);
40448 printf("\n");
40449 }
40450 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040451 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040452#endif
40453
Daniel Veillard42595322004-11-08 10:52:06 +000040454 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040455}
40456
40457
40458static int
40459test_xmlTextWriterFlush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040460 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040461
William M. Brack21e4ef22005-01-02 09:53:13 +000040462#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040463 int mem_base;
40464 int ret_val;
40465 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40466 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040467
Daniel Veillarde43cc572004-11-03 11:50:29 +000040468 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40469 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040470 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040471
40472 ret_val = xmlTextWriterFlush(writer);
40473 desret_int(ret_val);
40474 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040475 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040476 xmlResetLastError();
40477 if (mem_base != xmlMemBlocks()) {
40478 printf("Leak of %d blocks found in xmlTextWriterFlush",
40479 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040480 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040481 printf(" %d", n_writer);
40482 printf("\n");
40483 }
40484 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040485 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040486#endif
40487
Daniel Veillard42595322004-11-08 10:52:06 +000040488 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040489}
40490
40491
40492static int
40493test_xmlTextWriterFullEndElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040494 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040495
William M. Brack21e4ef22005-01-02 09:53:13 +000040496#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040497 int mem_base;
40498 int ret_val;
40499 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40500 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040501
Daniel Veillarde43cc572004-11-03 11:50:29 +000040502 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40503 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040504 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040505
40506 ret_val = xmlTextWriterFullEndElement(writer);
40507 desret_int(ret_val);
40508 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040509 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040510 xmlResetLastError();
40511 if (mem_base != xmlMemBlocks()) {
40512 printf("Leak of %d blocks found in xmlTextWriterFullEndElement",
40513 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040514 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040515 printf(" %d", n_writer);
40516 printf("\n");
40517 }
40518 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040519 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040520#endif
40521
Daniel Veillard42595322004-11-08 10:52:06 +000040522 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040523}
40524
40525
40526static int
40527test_xmlTextWriterSetIndent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040528 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040529
William M. Brack21e4ef22005-01-02 09:53:13 +000040530#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040531 int mem_base;
40532 int ret_val;
40533 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40534 int n_writer;
40535 int indent; /* do indentation? */
40536 int n_indent;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040537
Daniel Veillarde43cc572004-11-03 11:50:29 +000040538 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40539 for (n_indent = 0;n_indent < gen_nb_int;n_indent++) {
40540 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040541 writer = gen_xmlTextWriterPtr(n_writer, 0);
40542 indent = gen_int(n_indent, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040543
40544 ret_val = xmlTextWriterSetIndent(writer, indent);
40545 desret_int(ret_val);
40546 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040547 des_xmlTextWriterPtr(n_writer, writer, 0);
40548 des_int(n_indent, indent, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040549 xmlResetLastError();
40550 if (mem_base != xmlMemBlocks()) {
40551 printf("Leak of %d blocks found in xmlTextWriterSetIndent",
40552 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040553 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040554 printf(" %d", n_writer);
40555 printf(" %d", n_indent);
40556 printf("\n");
40557 }
40558 }
40559 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040560 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040561#endif
40562
Daniel Veillard42595322004-11-08 10:52:06 +000040563 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040564}
40565
40566
40567static int
40568test_xmlTextWriterSetIndentString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040569 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040570
William M. Brack21e4ef22005-01-02 09:53:13 +000040571#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040572 int mem_base;
40573 int ret_val;
40574 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40575 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040576 xmlChar * str; /* the xmlChar string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040577 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040578
Daniel Veillarde43cc572004-11-03 11:50:29 +000040579 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40580 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
40581 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040582 writer = gen_xmlTextWriterPtr(n_writer, 0);
40583 str = gen_const_xmlChar_ptr(n_str, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040584
William M. Brackf13f77f2004-11-12 16:03:48 +000040585 ret_val = xmlTextWriterSetIndentString(writer, (const xmlChar *)str);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040586 desret_int(ret_val);
40587 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040588 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000040589 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040590 xmlResetLastError();
40591 if (mem_base != xmlMemBlocks()) {
40592 printf("Leak of %d blocks found in xmlTextWriterSetIndentString",
40593 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040594 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040595 printf(" %d", n_writer);
40596 printf(" %d", n_str);
40597 printf("\n");
40598 }
40599 }
40600 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040601 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040602#endif
40603
Daniel Veillard42595322004-11-08 10:52:06 +000040604 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040605}
40606
40607
40608static int
40609test_xmlTextWriterStartAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040610 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040611
William M. Brack21e4ef22005-01-02 09:53:13 +000040612#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040613 int mem_base;
40614 int ret_val;
40615 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40616 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040617 xmlChar * name; /* element name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040618 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040619
Daniel Veillarde43cc572004-11-03 11:50:29 +000040620 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40621 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40622 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040623 writer = gen_xmlTextWriterPtr(n_writer, 0);
40624 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040625
William M. Brackf13f77f2004-11-12 16:03:48 +000040626 ret_val = xmlTextWriterStartAttribute(writer, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040627 desret_int(ret_val);
40628 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040629 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000040630 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040631 xmlResetLastError();
40632 if (mem_base != xmlMemBlocks()) {
40633 printf("Leak of %d blocks found in xmlTextWriterStartAttribute",
40634 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040635 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040636 printf(" %d", n_writer);
40637 printf(" %d", n_name);
40638 printf("\n");
40639 }
40640 }
40641 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040642 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040643#endif
40644
Daniel Veillard42595322004-11-08 10:52:06 +000040645 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040646}
40647
40648
40649static int
40650test_xmlTextWriterStartAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040651 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040652
William M. Brack21e4ef22005-01-02 09:53:13 +000040653#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040654 int mem_base;
40655 int ret_val;
40656 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40657 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040658 xmlChar * prefix; /* namespace prefix or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040659 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040660 xmlChar * name; /* element local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040661 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040662 xmlChar * namespaceURI; /* namespace URI or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040663 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040664
Daniel Veillarde43cc572004-11-03 11:50:29 +000040665 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40666 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
40667 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40668 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
40669 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040670 writer = gen_xmlTextWriterPtr(n_writer, 0);
40671 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
40672 name = gen_const_xmlChar_ptr(n_name, 2);
40673 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040674
William M. Brackf13f77f2004-11-12 16:03:48 +000040675 ret_val = xmlTextWriterStartAttributeNS(writer, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)namespaceURI);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040676 desret_int(ret_val);
40677 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040678 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000040679 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
40680 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
40681 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040682 xmlResetLastError();
40683 if (mem_base != xmlMemBlocks()) {
40684 printf("Leak of %d blocks found in xmlTextWriterStartAttributeNS",
40685 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040686 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040687 printf(" %d", n_writer);
40688 printf(" %d", n_prefix);
40689 printf(" %d", n_name);
40690 printf(" %d", n_namespaceURI);
40691 printf("\n");
40692 }
40693 }
40694 }
40695 }
40696 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040697 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040698#endif
40699
Daniel Veillard42595322004-11-08 10:52:06 +000040700 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040701}
40702
40703
40704static int
40705test_xmlTextWriterStartCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040706 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040707
William M. Brack21e4ef22005-01-02 09:53:13 +000040708#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040709 int mem_base;
40710 int ret_val;
40711 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40712 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040713
Daniel Veillarde43cc572004-11-03 11:50:29 +000040714 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40715 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040716 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040717
40718 ret_val = xmlTextWriterStartCDATA(writer);
40719 desret_int(ret_val);
40720 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040721 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040722 xmlResetLastError();
40723 if (mem_base != xmlMemBlocks()) {
40724 printf("Leak of %d blocks found in xmlTextWriterStartCDATA",
40725 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040726 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040727 printf(" %d", n_writer);
40728 printf("\n");
40729 }
40730 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040731 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040732#endif
40733
Daniel Veillard42595322004-11-08 10:52:06 +000040734 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040735}
40736
40737
40738static int
40739test_xmlTextWriterStartComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040740 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040741
William M. Brack21e4ef22005-01-02 09:53:13 +000040742#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040743 int mem_base;
40744 int ret_val;
40745 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40746 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040747
Daniel Veillarde43cc572004-11-03 11:50:29 +000040748 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40749 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040750 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040751
40752 ret_val = xmlTextWriterStartComment(writer);
40753 desret_int(ret_val);
40754 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040755 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040756 xmlResetLastError();
40757 if (mem_base != xmlMemBlocks()) {
40758 printf("Leak of %d blocks found in xmlTextWriterStartComment",
40759 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040760 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040761 printf(" %d", n_writer);
40762 printf("\n");
40763 }
40764 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040765 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040766#endif
40767
Daniel Veillard42595322004-11-08 10:52:06 +000040768 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040769}
40770
40771
40772static int
40773test_xmlTextWriterStartDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040774 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040775
William M. Brack21e4ef22005-01-02 09:53:13 +000040776#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040777 int mem_base;
40778 int ret_val;
40779 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40780 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040781 xmlChar * name; /* the name of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040782 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040783 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040784 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040785 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040786 int n_sysid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040787
Daniel Veillarde43cc572004-11-03 11:50:29 +000040788 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40789 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40790 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
40791 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
40792 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040793 writer = gen_xmlTextWriterPtr(n_writer, 0);
40794 name = gen_const_xmlChar_ptr(n_name, 1);
40795 pubid = gen_const_xmlChar_ptr(n_pubid, 2);
40796 sysid = gen_const_xmlChar_ptr(n_sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040797
William M. Brackf13f77f2004-11-12 16:03:48 +000040798 ret_val = xmlTextWriterStartDTD(writer, (const xmlChar *)name, (const xmlChar *)pubid, (const xmlChar *)sysid);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040799 desret_int(ret_val);
40800 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040801 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000040802 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
40803 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 2);
40804 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040805 xmlResetLastError();
40806 if (mem_base != xmlMemBlocks()) {
40807 printf("Leak of %d blocks found in xmlTextWriterStartDTD",
40808 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040809 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040810 printf(" %d", n_writer);
40811 printf(" %d", n_name);
40812 printf(" %d", n_pubid);
40813 printf(" %d", n_sysid);
40814 printf("\n");
40815 }
40816 }
40817 }
40818 }
40819 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040820 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040821#endif
40822
Daniel Veillard42595322004-11-08 10:52:06 +000040823 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040824}
40825
40826
40827static int
40828test_xmlTextWriterStartDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040829 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040830
William M. Brack21e4ef22005-01-02 09:53:13 +000040831#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040832 int mem_base;
40833 int ret_val;
40834 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40835 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040836 xmlChar * name; /* the name of the DTD ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040837 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040838
Daniel Veillarde43cc572004-11-03 11:50:29 +000040839 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40840 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40841 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040842 writer = gen_xmlTextWriterPtr(n_writer, 0);
40843 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040844
William M. Brackf13f77f2004-11-12 16:03:48 +000040845 ret_val = xmlTextWriterStartDTDAttlist(writer, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040846 desret_int(ret_val);
40847 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040848 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000040849 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040850 xmlResetLastError();
40851 if (mem_base != xmlMemBlocks()) {
40852 printf("Leak of %d blocks found in xmlTextWriterStartDTDAttlist",
40853 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040854 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040855 printf(" %d", n_writer);
40856 printf(" %d", n_name);
40857 printf("\n");
40858 }
40859 }
40860 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040861 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040862#endif
40863
Daniel Veillard42595322004-11-08 10:52:06 +000040864 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040865}
40866
40867
40868static int
40869test_xmlTextWriterStartDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040870 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040871
William M. Brack21e4ef22005-01-02 09:53:13 +000040872#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040873 int mem_base;
40874 int ret_val;
40875 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40876 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040877 xmlChar * name; /* the name of the DTD element */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040878 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040879
Daniel Veillarde43cc572004-11-03 11:50:29 +000040880 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40881 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40882 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040883 writer = gen_xmlTextWriterPtr(n_writer, 0);
40884 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040885
William M. Brackf13f77f2004-11-12 16:03:48 +000040886 ret_val = xmlTextWriterStartDTDElement(writer, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040887 desret_int(ret_val);
40888 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040889 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000040890 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040891 xmlResetLastError();
40892 if (mem_base != xmlMemBlocks()) {
40893 printf("Leak of %d blocks found in xmlTextWriterStartDTDElement",
40894 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040895 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040896 printf(" %d", n_writer);
40897 printf(" %d", n_name);
40898 printf("\n");
40899 }
40900 }
40901 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040902 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040903#endif
40904
Daniel Veillard42595322004-11-08 10:52:06 +000040905 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040906}
40907
40908
40909static int
40910test_xmlTextWriterStartDTDEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040911 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040912
William M. Brack21e4ef22005-01-02 09:53:13 +000040913#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040914 int mem_base;
40915 int ret_val;
40916 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40917 int n_writer;
40918 int pe; /* TRUE if this is a parameter entity, FALSE if not */
40919 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040920 xmlChar * name; /* the name of the DTD ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040921 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040922
Daniel Veillarde43cc572004-11-03 11:50:29 +000040923 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40924 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
40925 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40926 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040927 writer = gen_xmlTextWriterPtr(n_writer, 0);
40928 pe = gen_int(n_pe, 1);
40929 name = gen_const_xmlChar_ptr(n_name, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040930
William M. Brackf13f77f2004-11-12 16:03:48 +000040931 ret_val = xmlTextWriterStartDTDEntity(writer, pe, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040932 desret_int(ret_val);
40933 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040934 des_xmlTextWriterPtr(n_writer, writer, 0);
40935 des_int(n_pe, pe, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000040936 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040937 xmlResetLastError();
40938 if (mem_base != xmlMemBlocks()) {
40939 printf("Leak of %d blocks found in xmlTextWriterStartDTDEntity",
40940 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040941 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040942 printf(" %d", n_writer);
40943 printf(" %d", n_pe);
40944 printf(" %d", n_name);
40945 printf("\n");
40946 }
40947 }
40948 }
40949 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040950 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040951#endif
40952
Daniel Veillard42595322004-11-08 10:52:06 +000040953 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040954}
40955
40956
40957static int
40958test_xmlTextWriterStartDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040959 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040960
William M. Brack21e4ef22005-01-02 09:53:13 +000040961#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040962 int mem_base;
40963 int ret_val;
40964 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40965 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040966 char * version; /* the xml version ("1.0") or NULL for default ("1.0") */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040967 int n_version;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040968 char * encoding; /* the encoding or NULL for default */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040969 int n_encoding;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040970 char * standalone; /* "yes" or "no" or NULL for default */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040971 int n_standalone;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040972
Daniel Veillarde43cc572004-11-03 11:50:29 +000040973 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40974 for (n_version = 0;n_version < gen_nb_const_char_ptr;n_version++) {
40975 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
40976 for (n_standalone = 0;n_standalone < gen_nb_const_char_ptr;n_standalone++) {
40977 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040978 writer = gen_xmlTextWriterPtr(n_writer, 0);
40979 version = gen_const_char_ptr(n_version, 1);
40980 encoding = gen_const_char_ptr(n_encoding, 2);
40981 standalone = gen_const_char_ptr(n_standalone, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040982
William M. Brackf13f77f2004-11-12 16:03:48 +000040983 ret_val = xmlTextWriterStartDocument(writer, (const char *)version, (const char *)encoding, (const char *)standalone);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040984 desret_int(ret_val);
40985 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040986 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000040987 des_const_char_ptr(n_version, (const char *)version, 1);
40988 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
40989 des_const_char_ptr(n_standalone, (const char *)standalone, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040990 xmlResetLastError();
40991 if (mem_base != xmlMemBlocks()) {
40992 printf("Leak of %d blocks found in xmlTextWriterStartDocument",
40993 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040994 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040995 printf(" %d", n_writer);
40996 printf(" %d", n_version);
40997 printf(" %d", n_encoding);
40998 printf(" %d", n_standalone);
40999 printf("\n");
41000 }
41001 }
41002 }
41003 }
41004 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041005 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041006#endif
41007
Daniel Veillard42595322004-11-08 10:52:06 +000041008 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041009}
41010
41011
41012static int
41013test_xmlTextWriterStartElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041014 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041015
William M. Brack21e4ef22005-01-02 09:53:13 +000041016#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041017 int mem_base;
41018 int ret_val;
41019 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41020 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041021 xmlChar * name; /* element name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041022 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041023
Daniel Veillarde43cc572004-11-03 11:50:29 +000041024 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41025 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41026 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041027 writer = gen_xmlTextWriterPtr(n_writer, 0);
41028 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041029
William M. Brackf13f77f2004-11-12 16:03:48 +000041030 ret_val = xmlTextWriterStartElement(writer, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041031 desret_int(ret_val);
41032 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041033 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041034 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041035 xmlResetLastError();
41036 if (mem_base != xmlMemBlocks()) {
41037 printf("Leak of %d blocks found in xmlTextWriterStartElement",
41038 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041039 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041040 printf(" %d", n_writer);
41041 printf(" %d", n_name);
41042 printf("\n");
41043 }
41044 }
41045 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041046 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041047#endif
41048
Daniel Veillard42595322004-11-08 10:52:06 +000041049 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041050}
41051
41052
41053static int
41054test_xmlTextWriterStartElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041055 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041056
William M. Brack21e4ef22005-01-02 09:53:13 +000041057#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041058 int mem_base;
41059 int ret_val;
41060 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41061 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041062 xmlChar * prefix; /* namespace prefix or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041063 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041064 xmlChar * name; /* element local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041065 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041066 xmlChar * namespaceURI; /* namespace URI or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041067 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041068
Daniel Veillarde43cc572004-11-03 11:50:29 +000041069 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41070 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
41071 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41072 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
41073 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041074 writer = gen_xmlTextWriterPtr(n_writer, 0);
41075 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
41076 name = gen_const_xmlChar_ptr(n_name, 2);
41077 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041078
William M. Brackf13f77f2004-11-12 16:03:48 +000041079 ret_val = xmlTextWriterStartElementNS(writer, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)namespaceURI);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041080 desret_int(ret_val);
41081 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041082 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041083 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
41084 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
41085 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041086 xmlResetLastError();
41087 if (mem_base != xmlMemBlocks()) {
41088 printf("Leak of %d blocks found in xmlTextWriterStartElementNS",
41089 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041090 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041091 printf(" %d", n_writer);
41092 printf(" %d", n_prefix);
41093 printf(" %d", n_name);
41094 printf(" %d", n_namespaceURI);
41095 printf("\n");
41096 }
41097 }
41098 }
41099 }
41100 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041101 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041102#endif
41103
Daniel Veillard42595322004-11-08 10:52:06 +000041104 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041105}
41106
41107
41108static int
41109test_xmlTextWriterStartPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041110 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041111
William M. Brack21e4ef22005-01-02 09:53:13 +000041112#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041113 int mem_base;
41114 int ret_val;
41115 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41116 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041117 xmlChar * target; /* PI target */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041118 int n_target;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041119
Daniel Veillarde43cc572004-11-03 11:50:29 +000041120 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41121 for (n_target = 0;n_target < gen_nb_const_xmlChar_ptr;n_target++) {
41122 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041123 writer = gen_xmlTextWriterPtr(n_writer, 0);
41124 target = gen_const_xmlChar_ptr(n_target, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041125
William M. Brackf13f77f2004-11-12 16:03:48 +000041126 ret_val = xmlTextWriterStartPI(writer, (const xmlChar *)target);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041127 desret_int(ret_val);
41128 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041129 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041130 des_const_xmlChar_ptr(n_target, (const xmlChar *)target, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041131 xmlResetLastError();
41132 if (mem_base != xmlMemBlocks()) {
41133 printf("Leak of %d blocks found in xmlTextWriterStartPI",
41134 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041135 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041136 printf(" %d", n_writer);
41137 printf(" %d", n_target);
41138 printf("\n");
41139 }
41140 }
41141 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041142 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041143#endif
41144
Daniel Veillard42595322004-11-08 10:52:06 +000041145 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041146}
41147
41148
41149static int
41150test_xmlTextWriterWriteAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041151 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041152
William M. Brack21e4ef22005-01-02 09:53:13 +000041153#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041154 int mem_base;
41155 int ret_val;
41156 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41157 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041158 xmlChar * name; /* attribute name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041159 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041160 xmlChar * content; /* attribute content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041161 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041162
Daniel Veillarde43cc572004-11-03 11:50:29 +000041163 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41164 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41165 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41166 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041167 writer = gen_xmlTextWriterPtr(n_writer, 0);
41168 name = gen_const_xmlChar_ptr(n_name, 1);
41169 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041170
William M. Brackf13f77f2004-11-12 16:03:48 +000041171 ret_val = xmlTextWriterWriteAttribute(writer, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041172 desret_int(ret_val);
41173 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041174 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041175 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
41176 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041177 xmlResetLastError();
41178 if (mem_base != xmlMemBlocks()) {
41179 printf("Leak of %d blocks found in xmlTextWriterWriteAttribute",
41180 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041181 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041182 printf(" %d", n_writer);
41183 printf(" %d", n_name);
41184 printf(" %d", n_content);
41185 printf("\n");
41186 }
41187 }
41188 }
41189 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041190 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041191#endif
41192
Daniel Veillard42595322004-11-08 10:52:06 +000041193 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041194}
41195
41196
41197static int
41198test_xmlTextWriterWriteAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041199 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041200
William M. Brack21e4ef22005-01-02 09:53:13 +000041201#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041202 int mem_base;
41203 int ret_val;
41204 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41205 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041206 xmlChar * prefix; /* namespace prefix */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041207 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041208 xmlChar * name; /* attribute local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041209 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041210 xmlChar * namespaceURI; /* namespace URI */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041211 int n_namespaceURI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041212 xmlChar * content; /* attribute content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041213 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041214
Daniel Veillarde43cc572004-11-03 11:50:29 +000041215 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41216 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
41217 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41218 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
41219 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41220 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041221 writer = gen_xmlTextWriterPtr(n_writer, 0);
41222 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
41223 name = gen_const_xmlChar_ptr(n_name, 2);
41224 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
41225 content = gen_const_xmlChar_ptr(n_content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041226
William M. Brackf13f77f2004-11-12 16:03:48 +000041227 ret_val = xmlTextWriterWriteAttributeNS(writer, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)namespaceURI, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041228 desret_int(ret_val);
41229 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041230 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041231 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
41232 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
41233 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 3);
41234 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041235 xmlResetLastError();
41236 if (mem_base != xmlMemBlocks()) {
41237 printf("Leak of %d blocks found in xmlTextWriterWriteAttributeNS",
41238 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041239 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041240 printf(" %d", n_writer);
41241 printf(" %d", n_prefix);
41242 printf(" %d", n_name);
41243 printf(" %d", n_namespaceURI);
41244 printf(" %d", n_content);
41245 printf("\n");
41246 }
41247 }
41248 }
41249 }
41250 }
41251 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041252 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041253#endif
41254
Daniel Veillard42595322004-11-08 10:52:06 +000041255 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041256}
41257
41258
41259static int
41260test_xmlTextWriterWriteBase64(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041261 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041262
William M. Brack21e4ef22005-01-02 09:53:13 +000041263#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041264 int mem_base;
41265 int ret_val;
41266 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41267 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041268 char * data; /* binary data */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041269 int n_data;
41270 int start; /* the position within the data of the first byte to encode */
41271 int n_start;
41272 int len; /* the number of bytes to encode */
41273 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041274
Daniel Veillarde43cc572004-11-03 11:50:29 +000041275 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41276 for (n_data = 0;n_data < gen_nb_const_char_ptr;n_data++) {
41277 for (n_start = 0;n_start < gen_nb_int;n_start++) {
41278 for (n_len = 0;n_len < gen_nb_int;n_len++) {
41279 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041280 writer = gen_xmlTextWriterPtr(n_writer, 0);
41281 data = gen_const_char_ptr(n_data, 1);
41282 start = gen_int(n_start, 2);
41283 len = gen_int(n_len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041284
William M. Brackf13f77f2004-11-12 16:03:48 +000041285 ret_val = xmlTextWriterWriteBase64(writer, (const char *)data, start, len);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041286 desret_int(ret_val);
41287 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041288 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041289 des_const_char_ptr(n_data, (const char *)data, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000041290 des_int(n_start, start, 2);
41291 des_int(n_len, len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041292 xmlResetLastError();
41293 if (mem_base != xmlMemBlocks()) {
41294 printf("Leak of %d blocks found in xmlTextWriterWriteBase64",
41295 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041296 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041297 printf(" %d", n_writer);
41298 printf(" %d", n_data);
41299 printf(" %d", n_start);
41300 printf(" %d", n_len);
41301 printf("\n");
41302 }
41303 }
41304 }
41305 }
41306 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041307 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041308#endif
41309
Daniel Veillard42595322004-11-08 10:52:06 +000041310 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041311}
41312
41313
41314static int
41315test_xmlTextWriterWriteBinHex(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041316 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041317
William M. Brack21e4ef22005-01-02 09:53:13 +000041318#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041319 int mem_base;
41320 int ret_val;
41321 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41322 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041323 char * data; /* binary data */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041324 int n_data;
41325 int start; /* the position within the data of the first byte to encode */
41326 int n_start;
41327 int len; /* the number of bytes to encode */
41328 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041329
Daniel Veillarde43cc572004-11-03 11:50:29 +000041330 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41331 for (n_data = 0;n_data < gen_nb_const_char_ptr;n_data++) {
41332 for (n_start = 0;n_start < gen_nb_int;n_start++) {
41333 for (n_len = 0;n_len < gen_nb_int;n_len++) {
41334 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041335 writer = gen_xmlTextWriterPtr(n_writer, 0);
41336 data = gen_const_char_ptr(n_data, 1);
41337 start = gen_int(n_start, 2);
41338 len = gen_int(n_len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041339
William M. Brackf13f77f2004-11-12 16:03:48 +000041340 ret_val = xmlTextWriterWriteBinHex(writer, (const char *)data, start, len);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041341 desret_int(ret_val);
41342 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041343 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041344 des_const_char_ptr(n_data, (const char *)data, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000041345 des_int(n_start, start, 2);
41346 des_int(n_len, len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041347 xmlResetLastError();
41348 if (mem_base != xmlMemBlocks()) {
41349 printf("Leak of %d blocks found in xmlTextWriterWriteBinHex",
41350 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041351 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041352 printf(" %d", n_writer);
41353 printf(" %d", n_data);
41354 printf(" %d", n_start);
41355 printf(" %d", n_len);
41356 printf("\n");
41357 }
41358 }
41359 }
41360 }
41361 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041362 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041363#endif
41364
Daniel Veillard42595322004-11-08 10:52:06 +000041365 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041366}
41367
41368
41369static int
41370test_xmlTextWriterWriteCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041371 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041372
William M. Brack21e4ef22005-01-02 09:53:13 +000041373#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041374 int mem_base;
41375 int ret_val;
41376 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41377 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041378 xmlChar * content; /* CDATA content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041379 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041380
Daniel Veillarde43cc572004-11-03 11:50:29 +000041381 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41382 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41383 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041384 writer = gen_xmlTextWriterPtr(n_writer, 0);
41385 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041386
William M. Brackf13f77f2004-11-12 16:03:48 +000041387 ret_val = xmlTextWriterWriteCDATA(writer, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041388 desret_int(ret_val);
41389 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041390 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041391 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041392 xmlResetLastError();
41393 if (mem_base != xmlMemBlocks()) {
41394 printf("Leak of %d blocks found in xmlTextWriterWriteCDATA",
41395 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041396 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041397 printf(" %d", n_writer);
41398 printf(" %d", n_content);
41399 printf("\n");
41400 }
41401 }
41402 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041403 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041404#endif
41405
Daniel Veillard42595322004-11-08 10:52:06 +000041406 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041407}
41408
41409
41410static int
41411test_xmlTextWriterWriteComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041412 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041413
William M. Brack21e4ef22005-01-02 09:53:13 +000041414#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041415 int mem_base;
41416 int ret_val;
41417 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41418 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041419 xmlChar * content; /* comment string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041420 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041421
Daniel Veillarde43cc572004-11-03 11:50:29 +000041422 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41423 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41424 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041425 writer = gen_xmlTextWriterPtr(n_writer, 0);
41426 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041427
William M. Brackf13f77f2004-11-12 16:03:48 +000041428 ret_val = xmlTextWriterWriteComment(writer, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041429 desret_int(ret_val);
41430 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041431 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041432 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041433 xmlResetLastError();
41434 if (mem_base != xmlMemBlocks()) {
41435 printf("Leak of %d blocks found in xmlTextWriterWriteComment",
41436 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041437 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041438 printf(" %d", n_writer);
41439 printf(" %d", n_content);
41440 printf("\n");
41441 }
41442 }
41443 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041444 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041445#endif
41446
Daniel Veillard42595322004-11-08 10:52:06 +000041447 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041448}
41449
41450
41451static int
41452test_xmlTextWriterWriteDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041453 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041454
William M. Brack21e4ef22005-01-02 09:53:13 +000041455#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041456 int mem_base;
41457 int ret_val;
41458 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41459 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041460 xmlChar * name; /* the name of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041461 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041462 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041463 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041464 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041465 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041466 xmlChar * subset; /* string content of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041467 int n_subset;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041468
Daniel Veillarde43cc572004-11-03 11:50:29 +000041469 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41470 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41471 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
41472 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
41473 for (n_subset = 0;n_subset < gen_nb_const_xmlChar_ptr;n_subset++) {
41474 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041475 writer = gen_xmlTextWriterPtr(n_writer, 0);
41476 name = gen_const_xmlChar_ptr(n_name, 1);
41477 pubid = gen_const_xmlChar_ptr(n_pubid, 2);
41478 sysid = gen_const_xmlChar_ptr(n_sysid, 3);
41479 subset = gen_const_xmlChar_ptr(n_subset, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041480
William M. Brackf13f77f2004-11-12 16:03:48 +000041481 ret_val = xmlTextWriterWriteDTD(writer, (const xmlChar *)name, (const xmlChar *)pubid, (const xmlChar *)sysid, (const xmlChar *)subset);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041482 desret_int(ret_val);
41483 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041484 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041485 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
41486 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 2);
41487 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 3);
41488 des_const_xmlChar_ptr(n_subset, (const xmlChar *)subset, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041489 xmlResetLastError();
41490 if (mem_base != xmlMemBlocks()) {
41491 printf("Leak of %d blocks found in xmlTextWriterWriteDTD",
41492 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041493 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041494 printf(" %d", n_writer);
41495 printf(" %d", n_name);
41496 printf(" %d", n_pubid);
41497 printf(" %d", n_sysid);
41498 printf(" %d", n_subset);
41499 printf("\n");
41500 }
41501 }
41502 }
41503 }
41504 }
41505 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041506 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041507#endif
41508
Daniel Veillard42595322004-11-08 10:52:06 +000041509 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041510}
41511
41512
41513static int
41514test_xmlTextWriterWriteDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041515 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041516
William M. Brack21e4ef22005-01-02 09:53:13 +000041517#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041518 int mem_base;
41519 int ret_val;
41520 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41521 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041522 xmlChar * name; /* the name of the DTD ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041523 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041524 xmlChar * content; /* content of the ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041525 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041526
Daniel Veillarde43cc572004-11-03 11:50:29 +000041527 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41528 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41529 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41530 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041531 writer = gen_xmlTextWriterPtr(n_writer, 0);
41532 name = gen_const_xmlChar_ptr(n_name, 1);
41533 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041534
William M. Brackf13f77f2004-11-12 16:03:48 +000041535 ret_val = xmlTextWriterWriteDTDAttlist(writer, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041536 desret_int(ret_val);
41537 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041538 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041539 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
41540 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041541 xmlResetLastError();
41542 if (mem_base != xmlMemBlocks()) {
41543 printf("Leak of %d blocks found in xmlTextWriterWriteDTDAttlist",
41544 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041545 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041546 printf(" %d", n_writer);
41547 printf(" %d", n_name);
41548 printf(" %d", n_content);
41549 printf("\n");
41550 }
41551 }
41552 }
41553 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041554 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041555#endif
41556
Daniel Veillard42595322004-11-08 10:52:06 +000041557 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041558}
41559
41560
41561static int
41562test_xmlTextWriterWriteDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041563 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041564
William M. Brack21e4ef22005-01-02 09:53:13 +000041565#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041566 int mem_base;
41567 int ret_val;
41568 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41569 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041570 xmlChar * name; /* the name of the DTD element */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041571 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041572 xmlChar * content; /* content of the element */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041573 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041574
Daniel Veillarde43cc572004-11-03 11:50:29 +000041575 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41576 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41577 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41578 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041579 writer = gen_xmlTextWriterPtr(n_writer, 0);
41580 name = gen_const_xmlChar_ptr(n_name, 1);
41581 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041582
William M. Brackf13f77f2004-11-12 16:03:48 +000041583 ret_val = xmlTextWriterWriteDTDElement(writer, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041584 desret_int(ret_val);
41585 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041586 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041587 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
41588 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041589 xmlResetLastError();
41590 if (mem_base != xmlMemBlocks()) {
41591 printf("Leak of %d blocks found in xmlTextWriterWriteDTDElement",
41592 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041593 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041594 printf(" %d", n_writer);
41595 printf(" %d", n_name);
41596 printf(" %d", n_content);
41597 printf("\n");
41598 }
41599 }
41600 }
41601 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041602 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041603#endif
41604
Daniel Veillard42595322004-11-08 10:52:06 +000041605 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041606}
41607
41608
41609static int
41610test_xmlTextWriterWriteDTDEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041611 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041612
William M. Brack21e4ef22005-01-02 09:53:13 +000041613#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041614 int mem_base;
41615 int ret_val;
41616 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41617 int n_writer;
41618 int pe; /* TRUE if this is a parameter entity, FALSE if not */
41619 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041620 xmlChar * name; /* the name of the DTD entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041621 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041622 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041623 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041624 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041625 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041626 xmlChar * ndataid; /* the xml notation name. */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041627 int n_ndataid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041628 xmlChar * content; /* content of the entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041629 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041630
Daniel Veillarde43cc572004-11-03 11:50:29 +000041631 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41632 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
41633 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41634 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
41635 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
41636 for (n_ndataid = 0;n_ndataid < gen_nb_const_xmlChar_ptr;n_ndataid++) {
41637 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41638 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041639 writer = gen_xmlTextWriterPtr(n_writer, 0);
41640 pe = gen_int(n_pe, 1);
41641 name = gen_const_xmlChar_ptr(n_name, 2);
41642 pubid = gen_const_xmlChar_ptr(n_pubid, 3);
41643 sysid = gen_const_xmlChar_ptr(n_sysid, 4);
41644 ndataid = gen_const_xmlChar_ptr(n_ndataid, 5);
41645 content = gen_const_xmlChar_ptr(n_content, 6);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041646
William M. Brackf13f77f2004-11-12 16:03:48 +000041647 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 +000041648 desret_int(ret_val);
41649 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041650 des_xmlTextWriterPtr(n_writer, writer, 0);
41651 des_int(n_pe, pe, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000041652 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
41653 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 3);
41654 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 4);
41655 des_const_xmlChar_ptr(n_ndataid, (const xmlChar *)ndataid, 5);
41656 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 6);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041657 xmlResetLastError();
41658 if (mem_base != xmlMemBlocks()) {
41659 printf("Leak of %d blocks found in xmlTextWriterWriteDTDEntity",
41660 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041661 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041662 printf(" %d", n_writer);
41663 printf(" %d", n_pe);
41664 printf(" %d", n_name);
41665 printf(" %d", n_pubid);
41666 printf(" %d", n_sysid);
41667 printf(" %d", n_ndataid);
41668 printf(" %d", n_content);
41669 printf("\n");
41670 }
41671 }
41672 }
41673 }
41674 }
41675 }
41676 }
41677 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041678 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041679#endif
41680
Daniel Veillard42595322004-11-08 10:52:06 +000041681 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041682}
41683
41684
41685static int
41686test_xmlTextWriterWriteDTDExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041687 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041688
William M. Brack21e4ef22005-01-02 09:53:13 +000041689#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041690 int mem_base;
41691 int ret_val;
41692 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41693 int n_writer;
41694 int pe; /* TRUE if this is a parameter entity, FALSE if not */
41695 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041696 xmlChar * name; /* the name of the DTD entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041697 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041698 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041699 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041700 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041701 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041702 xmlChar * ndataid; /* the xml notation name. */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041703 int n_ndataid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041704
Daniel Veillarde43cc572004-11-03 11:50:29 +000041705 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41706 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
41707 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41708 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
41709 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
41710 for (n_ndataid = 0;n_ndataid < gen_nb_const_xmlChar_ptr;n_ndataid++) {
41711 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041712 writer = gen_xmlTextWriterPtr(n_writer, 0);
41713 pe = gen_int(n_pe, 1);
41714 name = gen_const_xmlChar_ptr(n_name, 2);
41715 pubid = gen_const_xmlChar_ptr(n_pubid, 3);
41716 sysid = gen_const_xmlChar_ptr(n_sysid, 4);
41717 ndataid = gen_const_xmlChar_ptr(n_ndataid, 5);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041718
William M. Brackf13f77f2004-11-12 16:03:48 +000041719 ret_val = xmlTextWriterWriteDTDExternalEntity(writer, pe, (const xmlChar *)name, (const xmlChar *)pubid, (const xmlChar *)sysid, (const xmlChar *)ndataid);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041720 desret_int(ret_val);
41721 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041722 des_xmlTextWriterPtr(n_writer, writer, 0);
41723 des_int(n_pe, pe, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000041724 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
41725 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 3);
41726 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 4);
41727 des_const_xmlChar_ptr(n_ndataid, (const xmlChar *)ndataid, 5);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041728 xmlResetLastError();
41729 if (mem_base != xmlMemBlocks()) {
41730 printf("Leak of %d blocks found in xmlTextWriterWriteDTDExternalEntity",
41731 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041732 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041733 printf(" %d", n_writer);
41734 printf(" %d", n_pe);
41735 printf(" %d", n_name);
41736 printf(" %d", n_pubid);
41737 printf(" %d", n_sysid);
41738 printf(" %d", n_ndataid);
41739 printf("\n");
41740 }
41741 }
41742 }
41743 }
41744 }
41745 }
41746 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041747 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041748#endif
41749
Daniel Veillard42595322004-11-08 10:52:06 +000041750 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041751}
41752
41753
41754static int
41755test_xmlTextWriterWriteDTDExternalEntityContents(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041756 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041757
William M. Brack21e4ef22005-01-02 09:53:13 +000041758#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041759 int mem_base;
41760 int ret_val;
41761 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41762 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041763 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041764 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041765 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041766 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041767 xmlChar * ndataid; /* the xml notation name. */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041768 int n_ndataid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041769
Daniel Veillarde43cc572004-11-03 11:50:29 +000041770 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41771 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
41772 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
41773 for (n_ndataid = 0;n_ndataid < gen_nb_const_xmlChar_ptr;n_ndataid++) {
41774 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041775 writer = gen_xmlTextWriterPtr(n_writer, 0);
41776 pubid = gen_const_xmlChar_ptr(n_pubid, 1);
41777 sysid = gen_const_xmlChar_ptr(n_sysid, 2);
41778 ndataid = gen_const_xmlChar_ptr(n_ndataid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041779
William M. Brackf13f77f2004-11-12 16:03:48 +000041780 ret_val = xmlTextWriterWriteDTDExternalEntityContents(writer, (const xmlChar *)pubid, (const xmlChar *)sysid, (const xmlChar *)ndataid);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041781 desret_int(ret_val);
41782 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041783 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041784 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 1);
41785 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 2);
41786 des_const_xmlChar_ptr(n_ndataid, (const xmlChar *)ndataid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041787 xmlResetLastError();
41788 if (mem_base != xmlMemBlocks()) {
41789 printf("Leak of %d blocks found in xmlTextWriterWriteDTDExternalEntityContents",
41790 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041791 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041792 printf(" %d", n_writer);
41793 printf(" %d", n_pubid);
41794 printf(" %d", n_sysid);
41795 printf(" %d", n_ndataid);
41796 printf("\n");
41797 }
41798 }
41799 }
41800 }
41801 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041802 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041803#endif
41804
Daniel Veillard42595322004-11-08 10:52:06 +000041805 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041806}
41807
41808
41809static int
41810test_xmlTextWriterWriteDTDInternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041811 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041812
William M. Brack21e4ef22005-01-02 09:53:13 +000041813#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041814 int mem_base;
41815 int ret_val;
41816 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41817 int n_writer;
41818 int pe; /* TRUE if this is a parameter entity, FALSE if not */
41819 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041820 xmlChar * name; /* the name of the DTD entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041821 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041822 xmlChar * content; /* content of the entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041823 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041824
Daniel Veillarde43cc572004-11-03 11:50:29 +000041825 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41826 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
41827 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41828 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41829 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041830 writer = gen_xmlTextWriterPtr(n_writer, 0);
41831 pe = gen_int(n_pe, 1);
41832 name = gen_const_xmlChar_ptr(n_name, 2);
41833 content = gen_const_xmlChar_ptr(n_content, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041834
William M. Brackf13f77f2004-11-12 16:03:48 +000041835 ret_val = xmlTextWriterWriteDTDInternalEntity(writer, pe, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041836 desret_int(ret_val);
41837 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041838 des_xmlTextWriterPtr(n_writer, writer, 0);
41839 des_int(n_pe, pe, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000041840 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
41841 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041842 xmlResetLastError();
41843 if (mem_base != xmlMemBlocks()) {
41844 printf("Leak of %d blocks found in xmlTextWriterWriteDTDInternalEntity",
41845 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041846 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041847 printf(" %d", n_writer);
41848 printf(" %d", n_pe);
41849 printf(" %d", n_name);
41850 printf(" %d", n_content);
41851 printf("\n");
41852 }
41853 }
41854 }
41855 }
41856 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041857 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041858#endif
41859
Daniel Veillard42595322004-11-08 10:52:06 +000041860 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041861}
41862
41863
41864static int
41865test_xmlTextWriterWriteDTDNotation(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041866 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041867
William M. Brack21e4ef22005-01-02 09:53:13 +000041868#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041869 int mem_base;
41870 int ret_val;
41871 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41872 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041873 xmlChar * name; /* the name of the xml notation */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041874 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041875 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041876 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041877 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041878 int n_sysid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041879
Daniel Veillarde43cc572004-11-03 11:50:29 +000041880 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41881 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41882 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
41883 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
41884 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041885 writer = gen_xmlTextWriterPtr(n_writer, 0);
41886 name = gen_const_xmlChar_ptr(n_name, 1);
41887 pubid = gen_const_xmlChar_ptr(n_pubid, 2);
41888 sysid = gen_const_xmlChar_ptr(n_sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041889
William M. Brackf13f77f2004-11-12 16:03:48 +000041890 ret_val = xmlTextWriterWriteDTDNotation(writer, (const xmlChar *)name, (const xmlChar *)pubid, (const xmlChar *)sysid);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041891 desret_int(ret_val);
41892 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041893 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041894 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
41895 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 2);
41896 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041897 xmlResetLastError();
41898 if (mem_base != xmlMemBlocks()) {
41899 printf("Leak of %d blocks found in xmlTextWriterWriteDTDNotation",
41900 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041901 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041902 printf(" %d", n_writer);
41903 printf(" %d", n_name);
41904 printf(" %d", n_pubid);
41905 printf(" %d", n_sysid);
41906 printf("\n");
41907 }
41908 }
41909 }
41910 }
41911 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041912 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041913#endif
41914
Daniel Veillard42595322004-11-08 10:52:06 +000041915 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041916}
41917
41918
41919static int
41920test_xmlTextWriterWriteElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041921 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041922
William M. Brack21e4ef22005-01-02 09:53:13 +000041923#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041924 int mem_base;
41925 int ret_val;
41926 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41927 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041928 xmlChar * name; /* element name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041929 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041930 xmlChar * content; /* element content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041931 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041932
Daniel Veillarde43cc572004-11-03 11:50:29 +000041933 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41934 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41935 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41936 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041937 writer = gen_xmlTextWriterPtr(n_writer, 0);
41938 name = gen_const_xmlChar_ptr(n_name, 1);
41939 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041940
William M. Brackf13f77f2004-11-12 16:03:48 +000041941 ret_val = xmlTextWriterWriteElement(writer, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041942 desret_int(ret_val);
41943 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041944 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041945 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
41946 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041947 xmlResetLastError();
41948 if (mem_base != xmlMemBlocks()) {
41949 printf("Leak of %d blocks found in xmlTextWriterWriteElement",
41950 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041951 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041952 printf(" %d", n_writer);
41953 printf(" %d", n_name);
41954 printf(" %d", n_content);
41955 printf("\n");
41956 }
41957 }
41958 }
41959 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041960 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041961#endif
41962
Daniel Veillard42595322004-11-08 10:52:06 +000041963 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041964}
41965
41966
41967static int
41968test_xmlTextWriterWriteElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041969 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041970
William M. Brack21e4ef22005-01-02 09:53:13 +000041971#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041972 int mem_base;
41973 int ret_val;
41974 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41975 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041976 xmlChar * prefix; /* namespace prefix */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041977 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041978 xmlChar * name; /* element local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041979 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041980 xmlChar * namespaceURI; /* namespace URI */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041981 int n_namespaceURI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041982 xmlChar * content; /* element content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041983 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041984
Daniel Veillarde43cc572004-11-03 11:50:29 +000041985 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41986 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
41987 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41988 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
41989 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41990 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041991 writer = gen_xmlTextWriterPtr(n_writer, 0);
41992 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
41993 name = gen_const_xmlChar_ptr(n_name, 2);
41994 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
41995 content = gen_const_xmlChar_ptr(n_content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041996
William M. Brackf13f77f2004-11-12 16:03:48 +000041997 ret_val = xmlTextWriterWriteElementNS(writer, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)namespaceURI, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041998 desret_int(ret_val);
41999 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042000 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042001 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
42002 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
42003 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 3);
42004 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042005 xmlResetLastError();
42006 if (mem_base != xmlMemBlocks()) {
42007 printf("Leak of %d blocks found in xmlTextWriterWriteElementNS",
42008 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042009 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042010 printf(" %d", n_writer);
42011 printf(" %d", n_prefix);
42012 printf(" %d", n_name);
42013 printf(" %d", n_namespaceURI);
42014 printf(" %d", n_content);
42015 printf("\n");
42016 }
42017 }
42018 }
42019 }
42020 }
42021 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042022 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042023#endif
42024
Daniel Veillard42595322004-11-08 10:52:06 +000042025 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042026}
42027
42028
42029static int
42030test_xmlTextWriterWriteFormatAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042031 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042032
42033
42034 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042035 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042036}
42037
42038
42039static int
42040test_xmlTextWriterWriteFormatAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042041 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042042
42043
42044 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042045 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042046}
42047
42048
42049static int
42050test_xmlTextWriterWriteFormatCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042051 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042052
42053
42054 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042055 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042056}
42057
42058
42059static int
42060test_xmlTextWriterWriteFormatComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042061 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042062
42063
42064 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042065 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042066}
42067
42068
42069static int
42070test_xmlTextWriterWriteFormatDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042071 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042072
42073
42074 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042075 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042076}
42077
42078
42079static int
42080test_xmlTextWriterWriteFormatDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042081 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042082
42083
42084 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042085 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042086}
42087
42088
42089static int
42090test_xmlTextWriterWriteFormatDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042091 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042092
42093
42094 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042095 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042096}
42097
42098
42099static int
42100test_xmlTextWriterWriteFormatDTDInternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042101 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042102
42103
42104 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042105 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042106}
42107
42108
42109static int
42110test_xmlTextWriterWriteFormatElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042111 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042112
42113
42114 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042115 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042116}
42117
42118
42119static int
42120test_xmlTextWriterWriteFormatElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042121 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042122
42123
42124 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042125 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042126}
42127
42128
42129static int
42130test_xmlTextWriterWriteFormatPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042131 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042132
42133
42134 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042135 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042136}
42137
42138
42139static int
42140test_xmlTextWriterWriteFormatRaw(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042141 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042142
42143
42144 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042145 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042146}
42147
42148
42149static int
42150test_xmlTextWriterWriteFormatString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042151 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042152
42153
42154 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042155 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042156}
42157
42158
42159static int
42160test_xmlTextWriterWritePI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042161 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042162
William M. Brack21e4ef22005-01-02 09:53:13 +000042163#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042164 int mem_base;
42165 int ret_val;
42166 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42167 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042168 xmlChar * target; /* PI target */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042169 int n_target;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042170 xmlChar * content; /* PI content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042171 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042172
Daniel Veillarde43cc572004-11-03 11:50:29 +000042173 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42174 for (n_target = 0;n_target < gen_nb_const_xmlChar_ptr;n_target++) {
42175 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42176 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042177 writer = gen_xmlTextWriterPtr(n_writer, 0);
42178 target = gen_const_xmlChar_ptr(n_target, 1);
42179 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042180
William M. Brackf13f77f2004-11-12 16:03:48 +000042181 ret_val = xmlTextWriterWritePI(writer, (const xmlChar *)target, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042182 desret_int(ret_val);
42183 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042184 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042185 des_const_xmlChar_ptr(n_target, (const xmlChar *)target, 1);
42186 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042187 xmlResetLastError();
42188 if (mem_base != xmlMemBlocks()) {
42189 printf("Leak of %d blocks found in xmlTextWriterWritePI",
42190 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042191 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042192 printf(" %d", n_writer);
42193 printf(" %d", n_target);
42194 printf(" %d", n_content);
42195 printf("\n");
42196 }
42197 }
42198 }
42199 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042200 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042201#endif
42202
Daniel Veillard42595322004-11-08 10:52:06 +000042203 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042204}
42205
42206
42207static int
42208test_xmlTextWriterWriteRaw(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042209 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042210
William M. Brack21e4ef22005-01-02 09:53:13 +000042211#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042212 int mem_base;
42213 int ret_val;
42214 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42215 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042216 xmlChar * content; /* text string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042217 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042218
Daniel Veillarde43cc572004-11-03 11:50:29 +000042219 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42220 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42221 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042222 writer = gen_xmlTextWriterPtr(n_writer, 0);
42223 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042224
William M. Brackf13f77f2004-11-12 16:03:48 +000042225 ret_val = xmlTextWriterWriteRaw(writer, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042226 desret_int(ret_val);
42227 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042228 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042229 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042230 xmlResetLastError();
42231 if (mem_base != xmlMemBlocks()) {
42232 printf("Leak of %d blocks found in xmlTextWriterWriteRaw",
42233 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042234 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042235 printf(" %d", n_writer);
42236 printf(" %d", n_content);
42237 printf("\n");
42238 }
42239 }
42240 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042241 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042242#endif
42243
Daniel Veillard42595322004-11-08 10:52:06 +000042244 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042245}
42246
42247
42248static int
42249test_xmlTextWriterWriteRawLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042250 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042251
William M. Brack21e4ef22005-01-02 09:53:13 +000042252#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042253 int mem_base;
42254 int ret_val;
42255 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42256 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042257 xmlChar * content; /* text string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042258 int n_content;
42259 int len; /* length of the text string */
42260 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042261
Daniel Veillarde43cc572004-11-03 11:50:29 +000042262 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42263 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42264 for (n_len = 0;n_len < gen_nb_int;n_len++) {
42265 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042266 writer = gen_xmlTextWriterPtr(n_writer, 0);
42267 content = gen_const_xmlChar_ptr(n_content, 1);
42268 len = gen_int(n_len, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042269
William M. Brackf13f77f2004-11-12 16:03:48 +000042270 ret_val = xmlTextWriterWriteRawLen(writer, (const xmlChar *)content, len);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042271 desret_int(ret_val);
42272 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042273 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042274 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000042275 des_int(n_len, len, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042276 xmlResetLastError();
42277 if (mem_base != xmlMemBlocks()) {
42278 printf("Leak of %d blocks found in xmlTextWriterWriteRawLen",
42279 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042280 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042281 printf(" %d", n_writer);
42282 printf(" %d", n_content);
42283 printf(" %d", n_len);
42284 printf("\n");
42285 }
42286 }
42287 }
42288 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042289 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042290#endif
42291
Daniel Veillard42595322004-11-08 10:52:06 +000042292 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042293}
42294
42295
42296static int
42297test_xmlTextWriterWriteString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042298 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042299
William M. Brack21e4ef22005-01-02 09:53:13 +000042300#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042301 int mem_base;
42302 int ret_val;
42303 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42304 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042305 xmlChar * content; /* text string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042306 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042307
Daniel Veillarde43cc572004-11-03 11:50:29 +000042308 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42309 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42310 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042311 writer = gen_xmlTextWriterPtr(n_writer, 0);
42312 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042313
William M. Brackf13f77f2004-11-12 16:03:48 +000042314 ret_val = xmlTextWriterWriteString(writer, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042315 desret_int(ret_val);
42316 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042317 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042318 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042319 xmlResetLastError();
42320 if (mem_base != xmlMemBlocks()) {
42321 printf("Leak of %d blocks found in xmlTextWriterWriteString",
42322 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042323 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042324 printf(" %d", n_writer);
42325 printf(" %d", n_content);
42326 printf("\n");
42327 }
42328 }
42329 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042330 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042331#endif
42332
Daniel Veillard42595322004-11-08 10:52:06 +000042333 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042334}
42335
42336
42337static int
42338test_xmlTextWriterWriteVFormatAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042339 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042340
42341
42342 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042343 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042344}
42345
42346
42347static int
42348test_xmlTextWriterWriteVFormatAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042349 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042350
42351
42352 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042353 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042354}
42355
42356
42357static int
42358test_xmlTextWriterWriteVFormatCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042359 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042360
42361
42362 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042363 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042364}
42365
42366
42367static int
42368test_xmlTextWriterWriteVFormatComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042369 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042370
42371
42372 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042373 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042374}
42375
42376
42377static int
42378test_xmlTextWriterWriteVFormatDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042379 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042380
42381
42382 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042383 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042384}
42385
42386
42387static int
42388test_xmlTextWriterWriteVFormatDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042389 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042390
42391
42392 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042393 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042394}
42395
42396
42397static int
42398test_xmlTextWriterWriteVFormatDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042399 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042400
42401
42402 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042403 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042404}
42405
42406
42407static int
42408test_xmlTextWriterWriteVFormatDTDInternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042409 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042410
42411
42412 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042413 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042414}
42415
42416
42417static int
42418test_xmlTextWriterWriteVFormatElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042419 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042420
42421
42422 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042423 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042424}
42425
42426
42427static int
42428test_xmlTextWriterWriteVFormatElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042429 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042430
42431
42432 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042433 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042434}
42435
42436
42437static int
42438test_xmlTextWriterWriteVFormatPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042439 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042440
42441
42442 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042443 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042444}
42445
42446
42447static int
42448test_xmlTextWriterWriteVFormatRaw(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042449 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042450
42451
42452 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042453 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042454}
42455
42456
42457static int
42458test_xmlTextWriterWriteVFormatString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042459 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042460
42461
42462 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042463 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042464}
42465
42466static int
42467test_xmlwriter(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042468 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042469
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042470 if (quiet == 0) printf("Testing xmlwriter : 51 of 79 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000042471 test_ret += test_xmlNewTextWriter();
42472 test_ret += test_xmlNewTextWriterFilename();
42473 test_ret += test_xmlNewTextWriterMemory();
42474 test_ret += test_xmlNewTextWriterPushParser();
42475 test_ret += test_xmlNewTextWriterTree();
42476 test_ret += test_xmlTextWriterEndAttribute();
42477 test_ret += test_xmlTextWriterEndCDATA();
42478 test_ret += test_xmlTextWriterEndComment();
42479 test_ret += test_xmlTextWriterEndDTD();
42480 test_ret += test_xmlTextWriterEndDTDAttlist();
42481 test_ret += test_xmlTextWriterEndDTDElement();
42482 test_ret += test_xmlTextWriterEndDTDEntity();
42483 test_ret += test_xmlTextWriterEndDocument();
42484 test_ret += test_xmlTextWriterEndElement();
42485 test_ret += test_xmlTextWriterEndPI();
42486 test_ret += test_xmlTextWriterFlush();
42487 test_ret += test_xmlTextWriterFullEndElement();
42488 test_ret += test_xmlTextWriterSetIndent();
42489 test_ret += test_xmlTextWriterSetIndentString();
42490 test_ret += test_xmlTextWriterStartAttribute();
42491 test_ret += test_xmlTextWriterStartAttributeNS();
42492 test_ret += test_xmlTextWriterStartCDATA();
42493 test_ret += test_xmlTextWriterStartComment();
42494 test_ret += test_xmlTextWriterStartDTD();
42495 test_ret += test_xmlTextWriterStartDTDAttlist();
42496 test_ret += test_xmlTextWriterStartDTDElement();
42497 test_ret += test_xmlTextWriterStartDTDEntity();
42498 test_ret += test_xmlTextWriterStartDocument();
42499 test_ret += test_xmlTextWriterStartElement();
42500 test_ret += test_xmlTextWriterStartElementNS();
42501 test_ret += test_xmlTextWriterStartPI();
42502 test_ret += test_xmlTextWriterWriteAttribute();
42503 test_ret += test_xmlTextWriterWriteAttributeNS();
42504 test_ret += test_xmlTextWriterWriteBase64();
42505 test_ret += test_xmlTextWriterWriteBinHex();
42506 test_ret += test_xmlTextWriterWriteCDATA();
42507 test_ret += test_xmlTextWriterWriteComment();
42508 test_ret += test_xmlTextWriterWriteDTD();
42509 test_ret += test_xmlTextWriterWriteDTDAttlist();
42510 test_ret += test_xmlTextWriterWriteDTDElement();
42511 test_ret += test_xmlTextWriterWriteDTDEntity();
42512 test_ret += test_xmlTextWriterWriteDTDExternalEntity();
42513 test_ret += test_xmlTextWriterWriteDTDExternalEntityContents();
42514 test_ret += test_xmlTextWriterWriteDTDInternalEntity();
42515 test_ret += test_xmlTextWriterWriteDTDNotation();
42516 test_ret += test_xmlTextWriterWriteElement();
42517 test_ret += test_xmlTextWriterWriteElementNS();
42518 test_ret += test_xmlTextWriterWriteFormatAttribute();
42519 test_ret += test_xmlTextWriterWriteFormatAttributeNS();
42520 test_ret += test_xmlTextWriterWriteFormatCDATA();
42521 test_ret += test_xmlTextWriterWriteFormatComment();
42522 test_ret += test_xmlTextWriterWriteFormatDTD();
42523 test_ret += test_xmlTextWriterWriteFormatDTDAttlist();
42524 test_ret += test_xmlTextWriterWriteFormatDTDElement();
42525 test_ret += test_xmlTextWriterWriteFormatDTDInternalEntity();
42526 test_ret += test_xmlTextWriterWriteFormatElement();
42527 test_ret += test_xmlTextWriterWriteFormatElementNS();
42528 test_ret += test_xmlTextWriterWriteFormatPI();
42529 test_ret += test_xmlTextWriterWriteFormatRaw();
42530 test_ret += test_xmlTextWriterWriteFormatString();
42531 test_ret += test_xmlTextWriterWritePI();
42532 test_ret += test_xmlTextWriterWriteRaw();
42533 test_ret += test_xmlTextWriterWriteRawLen();
42534 test_ret += test_xmlTextWriterWriteString();
42535 test_ret += test_xmlTextWriterWriteVFormatAttribute();
42536 test_ret += test_xmlTextWriterWriteVFormatAttributeNS();
42537 test_ret += test_xmlTextWriterWriteVFormatCDATA();
42538 test_ret += test_xmlTextWriterWriteVFormatComment();
42539 test_ret += test_xmlTextWriterWriteVFormatDTD();
42540 test_ret += test_xmlTextWriterWriteVFormatDTDAttlist();
42541 test_ret += test_xmlTextWriterWriteVFormatDTDElement();
42542 test_ret += test_xmlTextWriterWriteVFormatDTDInternalEntity();
42543 test_ret += test_xmlTextWriterWriteVFormatElement();
42544 test_ret += test_xmlTextWriterWriteVFormatElementNS();
42545 test_ret += test_xmlTextWriterWriteVFormatPI();
42546 test_ret += test_xmlTextWriterWriteVFormatRaw();
42547 test_ret += test_xmlTextWriterWriteVFormatString();
Daniel Veillardd93f6252004-11-02 15:53:51 +000042548
Daniel Veillard42595322004-11-08 10:52:06 +000042549 if (test_ret != 0)
42550 printf("Module xmlwriter: %d errors\n", test_ret);
42551 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042552}
42553
42554static int
42555test_xmlXPathCastBooleanToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042556 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042557
William M. Brack21e4ef22005-01-02 09:53:13 +000042558#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042559 int mem_base;
42560 double ret_val;
42561 int val; /* a boolean */
42562 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042563
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042564 for (n_val = 0;n_val < gen_nb_int;n_val++) {
42565 mem_base = xmlMemBlocks();
42566 val = gen_int(n_val, 0);
42567
42568 ret_val = xmlXPathCastBooleanToNumber(val);
42569 desret_double(ret_val);
42570 call_tests++;
42571 des_int(n_val, val, 0);
42572 xmlResetLastError();
42573 if (mem_base != xmlMemBlocks()) {
42574 printf("Leak of %d blocks found in xmlXPathCastBooleanToNumber",
42575 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042576 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042577 printf(" %d", n_val);
42578 printf("\n");
42579 }
42580 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042581 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042582#endif
42583
Daniel Veillard42595322004-11-08 10:52:06 +000042584 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042585}
42586
42587
42588static int
42589test_xmlXPathCastBooleanToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042590 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042591
William M. Brack21e4ef22005-01-02 09:53:13 +000042592#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042593 int mem_base;
42594 xmlChar * ret_val;
42595 int val; /* a boolean */
42596 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042597
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042598 for (n_val = 0;n_val < gen_nb_int;n_val++) {
42599 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042600 val = gen_int(n_val, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042601
42602 ret_val = xmlXPathCastBooleanToString(val);
42603 desret_xmlChar_ptr(ret_val);
42604 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042605 des_int(n_val, val, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042606 xmlResetLastError();
42607 if (mem_base != xmlMemBlocks()) {
42608 printf("Leak of %d blocks found in xmlXPathCastBooleanToString",
42609 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042610 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042611 printf(" %d", n_val);
42612 printf("\n");
42613 }
42614 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042615 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042616#endif
42617
Daniel Veillard42595322004-11-08 10:52:06 +000042618 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042619}
42620
42621
42622static int
42623test_xmlXPathCastNodeSetToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042624 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042625
William M. Brack21e4ef22005-01-02 09:53:13 +000042626#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000042627 int mem_base;
42628 int ret_val;
42629 xmlNodeSetPtr ns; /* a node-set */
42630 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042631
Daniel Veillardce682bc2004-11-05 17:22:25 +000042632 for (n_ns = 0;n_ns < gen_nb_xmlNodeSetPtr;n_ns++) {
42633 mem_base = xmlMemBlocks();
42634 ns = gen_xmlNodeSetPtr(n_ns, 0);
42635
42636 ret_val = xmlXPathCastNodeSetToBoolean(ns);
42637 desret_int(ret_val);
42638 call_tests++;
42639 des_xmlNodeSetPtr(n_ns, ns, 0);
42640 xmlResetLastError();
42641 if (mem_base != xmlMemBlocks()) {
42642 printf("Leak of %d blocks found in xmlXPathCastNodeSetToBoolean",
42643 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042644 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042645 printf(" %d", n_ns);
42646 printf("\n");
42647 }
42648 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042649 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042650#endif
42651
Daniel Veillard42595322004-11-08 10:52:06 +000042652 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042653}
42654
42655
42656static int
42657test_xmlXPathCastNodeSetToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042658 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042659
William M. Brack21e4ef22005-01-02 09:53:13 +000042660#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000042661 int mem_base;
42662 double ret_val;
42663 xmlNodeSetPtr ns; /* a node-set */
42664 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042665
Daniel Veillardce682bc2004-11-05 17:22:25 +000042666 for (n_ns = 0;n_ns < gen_nb_xmlNodeSetPtr;n_ns++) {
42667 mem_base = xmlMemBlocks();
42668 ns = gen_xmlNodeSetPtr(n_ns, 0);
42669
42670 ret_val = xmlXPathCastNodeSetToNumber(ns);
42671 desret_double(ret_val);
42672 call_tests++;
42673 des_xmlNodeSetPtr(n_ns, ns, 0);
42674 xmlResetLastError();
42675 if (mem_base != xmlMemBlocks()) {
42676 printf("Leak of %d blocks found in xmlXPathCastNodeSetToNumber",
42677 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042678 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042679 printf(" %d", n_ns);
42680 printf("\n");
42681 }
42682 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042683 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042684#endif
42685
Daniel Veillard42595322004-11-08 10:52:06 +000042686 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042687}
42688
42689
42690static int
42691test_xmlXPathCastNodeSetToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042692 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042693
William M. Brack21e4ef22005-01-02 09:53:13 +000042694#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000042695 int mem_base;
42696 xmlChar * ret_val;
42697 xmlNodeSetPtr ns; /* a node-set */
42698 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042699
Daniel Veillardce682bc2004-11-05 17:22:25 +000042700 for (n_ns = 0;n_ns < gen_nb_xmlNodeSetPtr;n_ns++) {
42701 mem_base = xmlMemBlocks();
42702 ns = gen_xmlNodeSetPtr(n_ns, 0);
42703
42704 ret_val = xmlXPathCastNodeSetToString(ns);
42705 desret_xmlChar_ptr(ret_val);
42706 call_tests++;
42707 des_xmlNodeSetPtr(n_ns, ns, 0);
42708 xmlResetLastError();
42709 if (mem_base != xmlMemBlocks()) {
42710 printf("Leak of %d blocks found in xmlXPathCastNodeSetToString",
42711 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042712 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042713 printf(" %d", n_ns);
42714 printf("\n");
42715 }
42716 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042717 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042718#endif
42719
Daniel Veillard42595322004-11-08 10:52:06 +000042720 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042721}
42722
42723
42724static int
42725test_xmlXPathCastNodeToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042726 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042727
William M. Brack21e4ef22005-01-02 09:53:13 +000042728#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042729 int mem_base;
42730 double ret_val;
42731 xmlNodePtr node; /* a node */
42732 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042733
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042734 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
42735 mem_base = xmlMemBlocks();
42736 node = gen_xmlNodePtr(n_node, 0);
42737
42738 ret_val = xmlXPathCastNodeToNumber(node);
42739 desret_double(ret_val);
42740 call_tests++;
42741 des_xmlNodePtr(n_node, node, 0);
42742 xmlResetLastError();
42743 if (mem_base != xmlMemBlocks()) {
42744 printf("Leak of %d blocks found in xmlXPathCastNodeToNumber",
42745 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042746 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042747 printf(" %d", n_node);
42748 printf("\n");
42749 }
42750 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042751 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042752#endif
42753
Daniel Veillard42595322004-11-08 10:52:06 +000042754 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042755}
42756
42757
42758static int
42759test_xmlXPathCastNodeToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042760 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042761
William M. Brack21e4ef22005-01-02 09:53:13 +000042762#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042763 int mem_base;
42764 xmlChar * ret_val;
42765 xmlNodePtr node; /* a node */
42766 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042767
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042768 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
42769 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042770 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042771
42772 ret_val = xmlXPathCastNodeToString(node);
42773 desret_xmlChar_ptr(ret_val);
42774 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042775 des_xmlNodePtr(n_node, node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042776 xmlResetLastError();
42777 if (mem_base != xmlMemBlocks()) {
42778 printf("Leak of %d blocks found in xmlXPathCastNodeToString",
42779 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042780 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042781 printf(" %d", n_node);
42782 printf("\n");
42783 }
42784 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042785 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042786#endif
42787
Daniel Veillard42595322004-11-08 10:52:06 +000042788 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042789}
42790
42791
42792static int
42793test_xmlXPathCastNumberToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042794 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042795
William M. Brack21e4ef22005-01-02 09:53:13 +000042796#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000042797 int mem_base;
42798 int ret_val;
42799 double val; /* a number */
42800 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042801
Daniel Veillard3d95c732004-11-06 22:25:14 +000042802 for (n_val = 0;n_val < gen_nb_double;n_val++) {
42803 mem_base = xmlMemBlocks();
42804 val = gen_double(n_val, 0);
42805
42806 ret_val = xmlXPathCastNumberToBoolean(val);
42807 desret_int(ret_val);
42808 call_tests++;
42809 des_double(n_val, val, 0);
42810 xmlResetLastError();
42811 if (mem_base != xmlMemBlocks()) {
42812 printf("Leak of %d blocks found in xmlXPathCastNumberToBoolean",
42813 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042814 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000042815 printf(" %d", n_val);
42816 printf("\n");
42817 }
42818 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042819 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000042820#endif
42821
Daniel Veillard42595322004-11-08 10:52:06 +000042822 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042823}
42824
42825
42826static int
42827test_xmlXPathCastNumberToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042828 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042829
William M. Brack21e4ef22005-01-02 09:53:13 +000042830#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000042831 int mem_base;
42832 xmlChar * ret_val;
42833 double val; /* a number */
42834 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042835
Daniel Veillard3d95c732004-11-06 22:25:14 +000042836 for (n_val = 0;n_val < gen_nb_double;n_val++) {
42837 mem_base = xmlMemBlocks();
42838 val = gen_double(n_val, 0);
42839
42840 ret_val = xmlXPathCastNumberToString(val);
42841 desret_xmlChar_ptr(ret_val);
42842 call_tests++;
42843 des_double(n_val, val, 0);
42844 xmlResetLastError();
42845 if (mem_base != xmlMemBlocks()) {
42846 printf("Leak of %d blocks found in xmlXPathCastNumberToString",
42847 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042848 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000042849 printf(" %d", n_val);
42850 printf("\n");
42851 }
42852 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042853 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000042854#endif
42855
Daniel Veillard42595322004-11-08 10:52:06 +000042856 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042857}
42858
42859
42860static int
42861test_xmlXPathCastStringToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042862 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042863
William M. Brack21e4ef22005-01-02 09:53:13 +000042864#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000042865 int mem_base;
42866 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042867 xmlChar * val; /* a string */
Daniel Veillardd93f6252004-11-02 15:53:51 +000042868 int n_val;
42869
42870 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
42871 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042872 val = gen_const_xmlChar_ptr(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042873
William M. Brackf13f77f2004-11-12 16:03:48 +000042874 ret_val = xmlXPathCastStringToBoolean((const xmlChar *)val);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042875 desret_int(ret_val);
42876 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000042877 des_const_xmlChar_ptr(n_val, (const xmlChar *)val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042878 xmlResetLastError();
42879 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000042880 printf("Leak of %d blocks found in xmlXPathCastStringToBoolean",
Daniel Veillardd93f6252004-11-02 15:53:51 +000042881 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042882 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000042883 printf(" %d", n_val);
42884 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000042885 }
42886 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042887 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042888#endif
42889
Daniel Veillard42595322004-11-08 10:52:06 +000042890 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042891}
42892
42893
42894static int
42895test_xmlXPathCastStringToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042896 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042897
William M. Brack21e4ef22005-01-02 09:53:13 +000042898#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042899 int mem_base;
42900 double ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042901 xmlChar * val; /* a string */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042902 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042903
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042904 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
42905 mem_base = xmlMemBlocks();
42906 val = gen_const_xmlChar_ptr(n_val, 0);
42907
William M. Brackf13f77f2004-11-12 16:03:48 +000042908 ret_val = xmlXPathCastStringToNumber((const xmlChar *)val);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042909 desret_double(ret_val);
42910 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000042911 des_const_xmlChar_ptr(n_val, (const xmlChar *)val, 0);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042912 xmlResetLastError();
42913 if (mem_base != xmlMemBlocks()) {
42914 printf("Leak of %d blocks found in xmlXPathCastStringToNumber",
42915 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042916 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042917 printf(" %d", n_val);
42918 printf("\n");
42919 }
42920 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042921 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042922#endif
42923
Daniel Veillard42595322004-11-08 10:52:06 +000042924 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042925}
42926
42927
42928static int
42929test_xmlXPathCastToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042930 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042931
William M. Brack21e4ef22005-01-02 09:53:13 +000042932#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042933 int mem_base;
42934 int ret_val;
42935 xmlXPathObjectPtr val; /* an XPath object */
42936 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042937
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042938 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
42939 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042940 val = gen_xmlXPathObjectPtr(n_val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042941
42942 ret_val = xmlXPathCastToBoolean(val);
42943 desret_int(ret_val);
42944 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042945 des_xmlXPathObjectPtr(n_val, val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042946 xmlResetLastError();
42947 if (mem_base != xmlMemBlocks()) {
42948 printf("Leak of %d blocks found in xmlXPathCastToBoolean",
42949 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042950 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042951 printf(" %d", n_val);
42952 printf("\n");
42953 }
42954 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042955 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042956#endif
42957
Daniel Veillard42595322004-11-08 10:52:06 +000042958 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042959}
42960
42961
42962static int
42963test_xmlXPathCastToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042964 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042965
William M. Brack21e4ef22005-01-02 09:53:13 +000042966#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042967 int mem_base;
42968 double ret_val;
42969 xmlXPathObjectPtr val; /* an XPath object */
42970 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042971
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042972 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
42973 mem_base = xmlMemBlocks();
42974 val = gen_xmlXPathObjectPtr(n_val, 0);
42975
42976 ret_val = xmlXPathCastToNumber(val);
42977 desret_double(ret_val);
42978 call_tests++;
42979 des_xmlXPathObjectPtr(n_val, val, 0);
42980 xmlResetLastError();
42981 if (mem_base != xmlMemBlocks()) {
42982 printf("Leak of %d blocks found in xmlXPathCastToNumber",
42983 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042984 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042985 printf(" %d", n_val);
42986 printf("\n");
42987 }
42988 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042989 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042990#endif
42991
Daniel Veillard42595322004-11-08 10:52:06 +000042992 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042993}
42994
42995
42996static int
42997test_xmlXPathCastToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042998 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042999
William M. Brack21e4ef22005-01-02 09:53:13 +000043000#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043001 int mem_base;
43002 xmlChar * ret_val;
43003 xmlXPathObjectPtr val; /* an XPath object */
43004 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043005
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043006 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43007 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000043008 val = gen_xmlXPathObjectPtr(n_val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043009
43010 ret_val = xmlXPathCastToString(val);
43011 desret_xmlChar_ptr(ret_val);
43012 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043013 des_xmlXPathObjectPtr(n_val, val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043014 xmlResetLastError();
43015 if (mem_base != xmlMemBlocks()) {
43016 printf("Leak of %d blocks found in xmlXPathCastToString",
43017 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043018 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043019 printf(" %d", n_val);
43020 printf("\n");
43021 }
43022 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043023 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000043024#endif
43025
Daniel Veillard42595322004-11-08 10:52:06 +000043026 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043027}
43028
43029
43030static int
43031test_xmlXPathCmpNodes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043032 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043033
William M. Brack21e4ef22005-01-02 09:53:13 +000043034#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000043035 int mem_base;
43036 int ret_val;
43037 xmlNodePtr node1; /* the first node */
43038 int n_node1;
43039 xmlNodePtr node2; /* the second node */
43040 int n_node2;
43041
43042 for (n_node1 = 0;n_node1 < gen_nb_xmlNodePtr;n_node1++) {
43043 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
43044 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000043045 node1 = gen_xmlNodePtr(n_node1, 0);
43046 node2 = gen_xmlNodePtr(n_node2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043047
43048 ret_val = xmlXPathCmpNodes(node1, node2);
43049 desret_int(ret_val);
43050 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043051 des_xmlNodePtr(n_node1, node1, 0);
43052 des_xmlNodePtr(n_node2, node2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043053 xmlResetLastError();
43054 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000043055 printf("Leak of %d blocks found in xmlXPathCmpNodes",
Daniel Veillardd93f6252004-11-02 15:53:51 +000043056 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043057 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000043058 printf(" %d", n_node1);
43059 printf(" %d", n_node2);
43060 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000043061 }
43062 }
43063 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043064 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043065#endif
43066
Daniel Veillard42595322004-11-08 10:52:06 +000043067 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043068}
43069
43070
43071static int
43072test_xmlXPathCompile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043073 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043074
43075
43076 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043077 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043078}
43079
Daniel Veillarda521d282004-11-09 14:59:59 +000043080#ifdef LIBXML_XPATH_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000043081
Daniel Veillardce682bc2004-11-05 17:22:25 +000043082#define gen_nb_xmlXPathCompExprPtr 1
43083static xmlXPathCompExprPtr gen_xmlXPathCompExprPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
43084 return(NULL);
43085}
43086static void des_xmlXPathCompExprPtr(int no ATTRIBUTE_UNUSED, xmlXPathCompExprPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
43087}
Daniel Veillarda521d282004-11-09 14:59:59 +000043088#endif
43089
43090#ifdef LIBXML_XPATH_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000043091
43092#define gen_nb_xmlXPathContextPtr 1
43093static xmlXPathContextPtr gen_xmlXPathContextPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
43094 return(NULL);
43095}
43096static void des_xmlXPathContextPtr(int no ATTRIBUTE_UNUSED, xmlXPathContextPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
43097}
Daniel Veillarda521d282004-11-09 14:59:59 +000043098#endif
43099
Daniel Veillardce682bc2004-11-05 17:22:25 +000043100
Daniel Veillardd93f6252004-11-02 15:53:51 +000043101static int
43102test_xmlXPathCompiledEval(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043103 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043104
William M. Brack21e4ef22005-01-02 09:53:13 +000043105#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000043106 int mem_base;
43107 xmlXPathObjectPtr ret_val;
43108 xmlXPathCompExprPtr comp; /* the compiled XPath expression */
43109 int n_comp;
43110 xmlXPathContextPtr ctx; /* the XPath context */
43111 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043112
Daniel Veillardce682bc2004-11-05 17:22:25 +000043113 for (n_comp = 0;n_comp < gen_nb_xmlXPathCompExprPtr;n_comp++) {
43114 for (n_ctx = 0;n_ctx < gen_nb_xmlXPathContextPtr;n_ctx++) {
43115 mem_base = xmlMemBlocks();
43116 comp = gen_xmlXPathCompExprPtr(n_comp, 0);
43117 ctx = gen_xmlXPathContextPtr(n_ctx, 1);
43118
43119 ret_val = xmlXPathCompiledEval(comp, ctx);
43120 desret_xmlXPathObjectPtr(ret_val);
43121 call_tests++;
43122 des_xmlXPathCompExprPtr(n_comp, comp, 0);
43123 des_xmlXPathContextPtr(n_ctx, ctx, 1);
43124 xmlResetLastError();
43125 if (mem_base != xmlMemBlocks()) {
43126 printf("Leak of %d blocks found in xmlXPathCompiledEval",
43127 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043128 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043129 printf(" %d", n_comp);
43130 printf(" %d", n_ctx);
43131 printf("\n");
43132 }
43133 }
43134 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043135 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043136#endif
43137
Daniel Veillard42595322004-11-08 10:52:06 +000043138 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043139}
43140
43141
43142static int
43143test_xmlXPathConvertBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043144 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043145
William M. Brack21e4ef22005-01-02 09:53:13 +000043146#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000043147 int mem_base;
43148 xmlXPathObjectPtr ret_val;
43149 xmlXPathObjectPtr val; /* an XPath object */
43150 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043151
Daniel Veillard3d97e662004-11-04 10:49:00 +000043152 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43153 mem_base = xmlMemBlocks();
43154 val = gen_xmlXPathObjectPtr(n_val, 0);
43155
43156 ret_val = xmlXPathConvertBoolean(val);
43157 val = NULL;
43158 desret_xmlXPathObjectPtr(ret_val);
43159 call_tests++;
43160 des_xmlXPathObjectPtr(n_val, val, 0);
43161 xmlResetLastError();
43162 if (mem_base != xmlMemBlocks()) {
43163 printf("Leak of %d blocks found in xmlXPathConvertBoolean",
43164 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043165 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043166 printf(" %d", n_val);
43167 printf("\n");
43168 }
43169 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043170 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043171#endif
43172
Daniel Veillard42595322004-11-08 10:52:06 +000043173 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043174}
43175
43176
43177static int
43178test_xmlXPathConvertNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043179 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043180
William M. Brack21e4ef22005-01-02 09:53:13 +000043181#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000043182 int mem_base;
43183 xmlXPathObjectPtr ret_val;
43184 xmlXPathObjectPtr val; /* an XPath object */
43185 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043186
Daniel Veillard3d97e662004-11-04 10:49:00 +000043187 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43188 mem_base = xmlMemBlocks();
43189 val = gen_xmlXPathObjectPtr(n_val, 0);
43190
43191 ret_val = xmlXPathConvertNumber(val);
43192 val = NULL;
43193 desret_xmlXPathObjectPtr(ret_val);
43194 call_tests++;
43195 des_xmlXPathObjectPtr(n_val, val, 0);
43196 xmlResetLastError();
43197 if (mem_base != xmlMemBlocks()) {
43198 printf("Leak of %d blocks found in xmlXPathConvertNumber",
43199 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043200 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043201 printf(" %d", n_val);
43202 printf("\n");
43203 }
43204 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043205 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043206#endif
43207
Daniel Veillard42595322004-11-08 10:52:06 +000043208 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043209}
43210
43211
43212static int
43213test_xmlXPathConvertString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043214 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043215
William M. Brack21e4ef22005-01-02 09:53:13 +000043216#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000043217 int mem_base;
43218 xmlXPathObjectPtr ret_val;
43219 xmlXPathObjectPtr val; /* an XPath object */
43220 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043221
Daniel Veillard3d97e662004-11-04 10:49:00 +000043222 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43223 mem_base = xmlMemBlocks();
43224 val = gen_xmlXPathObjectPtr(n_val, 0);
43225
43226 ret_val = xmlXPathConvertString(val);
43227 val = NULL;
43228 desret_xmlXPathObjectPtr(ret_val);
43229 call_tests++;
43230 des_xmlXPathObjectPtr(n_val, val, 0);
43231 xmlResetLastError();
43232 if (mem_base != xmlMemBlocks()) {
43233 printf("Leak of %d blocks found in xmlXPathConvertString",
43234 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043235 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043236 printf(" %d", n_val);
43237 printf("\n");
43238 }
43239 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043240 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043241#endif
43242
Daniel Veillard42595322004-11-08 10:52:06 +000043243 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043244}
43245
43246
43247static int
43248test_xmlXPathCtxtCompile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043249 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043250
43251
43252 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043253 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043254}
43255
43256
43257static int
43258test_xmlXPathEval(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043259 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043260
William M. Brack21e4ef22005-01-02 09:53:13 +000043261#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000043262 int mem_base;
43263 xmlXPathObjectPtr ret_val;
43264 xmlChar * str; /* the XPath expression */
43265 int n_str;
43266 xmlXPathContextPtr ctx; /* the XPath context */
43267 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043268
Daniel Veillardce682bc2004-11-05 17:22:25 +000043269 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
43270 for (n_ctx = 0;n_ctx < gen_nb_xmlXPathContextPtr;n_ctx++) {
43271 mem_base = xmlMemBlocks();
43272 str = gen_const_xmlChar_ptr(n_str, 0);
43273 ctx = gen_xmlXPathContextPtr(n_ctx, 1);
43274
William M. Brackf13f77f2004-11-12 16:03:48 +000043275 ret_val = xmlXPathEval((const xmlChar *)str, ctx);
Daniel Veillardce682bc2004-11-05 17:22:25 +000043276 desret_xmlXPathObjectPtr(ret_val);
43277 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000043278 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000043279 des_xmlXPathContextPtr(n_ctx, ctx, 1);
43280 xmlResetLastError();
43281 if (mem_base != xmlMemBlocks()) {
43282 printf("Leak of %d blocks found in xmlXPathEval",
43283 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043284 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043285 printf(" %d", n_str);
43286 printf(" %d", n_ctx);
43287 printf("\n");
43288 }
43289 }
43290 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043291 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043292#endif
43293
Daniel Veillard42595322004-11-08 10:52:06 +000043294 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043295}
43296
43297
43298static int
43299test_xmlXPathEvalExpression(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043300 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043301
William M. Brack21e4ef22005-01-02 09:53:13 +000043302#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000043303 int mem_base;
43304 xmlXPathObjectPtr ret_val;
43305 xmlChar * str; /* the XPath expression */
43306 int n_str;
43307 xmlXPathContextPtr ctxt; /* the XPath context */
43308 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043309
Daniel Veillardce682bc2004-11-05 17:22:25 +000043310 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
43311 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
43312 mem_base = xmlMemBlocks();
43313 str = gen_const_xmlChar_ptr(n_str, 0);
43314 ctxt = gen_xmlXPathContextPtr(n_ctxt, 1);
43315
William M. Brackf13f77f2004-11-12 16:03:48 +000043316 ret_val = xmlXPathEvalExpression((const xmlChar *)str, ctxt);
Daniel Veillardce682bc2004-11-05 17:22:25 +000043317 desret_xmlXPathObjectPtr(ret_val);
43318 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000043319 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000043320 des_xmlXPathContextPtr(n_ctxt, ctxt, 1);
43321 xmlResetLastError();
43322 if (mem_base != xmlMemBlocks()) {
43323 printf("Leak of %d blocks found in xmlXPathEvalExpression",
43324 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043325 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043326 printf(" %d", n_str);
43327 printf(" %d", n_ctxt);
43328 printf("\n");
43329 }
43330 }
43331 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043332 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043333#endif
43334
Daniel Veillard42595322004-11-08 10:52:06 +000043335 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043336}
43337
43338
43339static int
43340test_xmlXPathEvalPredicate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043341 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043342
William M. Brack21e4ef22005-01-02 09:53:13 +000043343#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000043344 int mem_base;
43345 int ret_val;
43346 xmlXPathContextPtr ctxt; /* the XPath context */
43347 int n_ctxt;
43348 xmlXPathObjectPtr res; /* the Predicate Expression evaluation result */
43349 int n_res;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043350
Daniel Veillardce682bc2004-11-05 17:22:25 +000043351 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
43352 for (n_res = 0;n_res < gen_nb_xmlXPathObjectPtr;n_res++) {
43353 mem_base = xmlMemBlocks();
43354 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
43355 res = gen_xmlXPathObjectPtr(n_res, 1);
43356
43357 ret_val = xmlXPathEvalPredicate(ctxt, res);
43358 desret_int(ret_val);
43359 call_tests++;
43360 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
43361 des_xmlXPathObjectPtr(n_res, res, 1);
43362 xmlResetLastError();
43363 if (mem_base != xmlMemBlocks()) {
43364 printf("Leak of %d blocks found in xmlXPathEvalPredicate",
43365 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043366 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043367 printf(" %d", n_ctxt);
43368 printf(" %d", n_res);
43369 printf("\n");
43370 }
43371 }
43372 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043373 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043374#endif
43375
Daniel Veillard42595322004-11-08 10:52:06 +000043376 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043377}
43378
43379
43380static int
43381test_xmlXPathInit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043382 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043383
William M. Brack21e4ef22005-01-02 09:53:13 +000043384#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000043385 int mem_base;
43386
43387 mem_base = xmlMemBlocks();
43388
43389 xmlXPathInit();
43390 call_tests++;
43391 xmlResetLastError();
43392 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000043393 printf("Leak of %d blocks found in xmlXPathInit",
Daniel Veillardd93f6252004-11-02 15:53:51 +000043394 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043395 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000043396 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000043397 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043398 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043399#endif
43400
Daniel Veillard42595322004-11-08 10:52:06 +000043401 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043402}
43403
43404
43405static int
43406test_xmlXPathIsInf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043407 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043408
William M. Brack21e4ef22005-01-02 09:53:13 +000043409#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000043410 int mem_base;
43411 int ret_val;
43412 double val; /* a double value */
43413 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043414
Daniel Veillard3d95c732004-11-06 22:25:14 +000043415 for (n_val = 0;n_val < gen_nb_double;n_val++) {
43416 mem_base = xmlMemBlocks();
43417 val = gen_double(n_val, 0);
43418
43419 ret_val = xmlXPathIsInf(val);
43420 desret_int(ret_val);
43421 call_tests++;
43422 des_double(n_val, val, 0);
43423 xmlResetLastError();
43424 if (mem_base != xmlMemBlocks()) {
43425 printf("Leak of %d blocks found in xmlXPathIsInf",
43426 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043427 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043428 printf(" %d", n_val);
43429 printf("\n");
43430 }
43431 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043432 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043433#endif
43434
Daniel Veillard42595322004-11-08 10:52:06 +000043435 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043436}
43437
43438
43439static int
43440test_xmlXPathIsNaN(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043441 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043442
William M. Brack21e4ef22005-01-02 09:53:13 +000043443#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000043444 int mem_base;
43445 int ret_val;
43446 double val; /* a double value */
43447 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043448
Daniel Veillard3d95c732004-11-06 22:25:14 +000043449 for (n_val = 0;n_val < gen_nb_double;n_val++) {
43450 mem_base = xmlMemBlocks();
43451 val = gen_double(n_val, 0);
43452
43453 ret_val = xmlXPathIsNaN(val);
43454 desret_int(ret_val);
43455 call_tests++;
43456 des_double(n_val, val, 0);
43457 xmlResetLastError();
43458 if (mem_base != xmlMemBlocks()) {
43459 printf("Leak of %d blocks found in xmlXPathIsNaN",
43460 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043461 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043462 printf(" %d", n_val);
43463 printf("\n");
43464 }
43465 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043466 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043467#endif
43468
Daniel Veillard42595322004-11-08 10:52:06 +000043469 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043470}
43471
43472
43473static int
43474test_xmlXPathNewContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043475 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043476
43477
43478 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043479 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043480}
43481
43482
43483static int
43484test_xmlXPathNodeSetCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043485 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043486
William M. Brack21e4ef22005-01-02 09:53:13 +000043487#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000043488 int mem_base;
43489 xmlNodeSetPtr ret_val;
43490 xmlNodePtr val; /* an initial xmlNodePtr, or NULL */
43491 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043492
Daniel Veillardf2a36f92004-11-08 17:55:01 +000043493 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
43494 mem_base = xmlMemBlocks();
43495 val = gen_xmlNodePtr(n_val, 0);
43496
43497 ret_val = xmlXPathNodeSetCreate(val);
43498 desret_xmlNodeSetPtr(ret_val);
43499 call_tests++;
43500 des_xmlNodePtr(n_val, val, 0);
43501 xmlResetLastError();
43502 if (mem_base != xmlMemBlocks()) {
43503 printf("Leak of %d blocks found in xmlXPathNodeSetCreate",
43504 xmlMemBlocks() - mem_base);
43505 test_ret++;
43506 printf(" %d", n_val);
43507 printf("\n");
43508 }
43509 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043510 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000043511#endif
43512
Daniel Veillard42595322004-11-08 10:52:06 +000043513 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043514}
43515
43516
43517static int
43518test_xmlXPathObjectCopy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043519 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043520
William M. Brack21e4ef22005-01-02 09:53:13 +000043521#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000043522 int mem_base;
43523 xmlXPathObjectPtr ret_val;
43524 xmlXPathObjectPtr val; /* the original object */
43525 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043526
Daniel Veillard3d97e662004-11-04 10:49:00 +000043527 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43528 mem_base = xmlMemBlocks();
43529 val = gen_xmlXPathObjectPtr(n_val, 0);
43530
43531 ret_val = xmlXPathObjectCopy(val);
43532 desret_xmlXPathObjectPtr(ret_val);
43533 call_tests++;
43534 des_xmlXPathObjectPtr(n_val, val, 0);
43535 xmlResetLastError();
43536 if (mem_base != xmlMemBlocks()) {
43537 printf("Leak of %d blocks found in xmlXPathObjectCopy",
43538 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043539 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043540 printf(" %d", n_val);
43541 printf("\n");
43542 }
43543 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043544 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043545#endif
43546
Daniel Veillard42595322004-11-08 10:52:06 +000043547 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043548}
43549
43550
43551static int
43552test_xmlXPathOrderDocElems(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043553 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043554
William M. Brack21e4ef22005-01-02 09:53:13 +000043555#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043556 int mem_base;
43557 long ret_val;
43558 xmlDocPtr doc; /* an input document */
43559 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043560
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043561 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
43562 mem_base = xmlMemBlocks();
43563 doc = gen_xmlDocPtr(n_doc, 0);
43564
43565 ret_val = xmlXPathOrderDocElems(doc);
43566 desret_long(ret_val);
43567 call_tests++;
43568 des_xmlDocPtr(n_doc, doc, 0);
43569 xmlResetLastError();
43570 if (mem_base != xmlMemBlocks()) {
43571 printf("Leak of %d blocks found in xmlXPathOrderDocElems",
43572 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043573 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043574 printf(" %d", n_doc);
43575 printf("\n");
43576 }
43577 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043578 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043579#endif
43580
Daniel Veillard42595322004-11-08 10:52:06 +000043581 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043582}
43583
43584static int
43585test_xpath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043586 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043587
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043588 if (quiet == 0) printf("Testing xpath : 28 of 36 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000043589 test_ret += test_xmlXPathCastBooleanToNumber();
43590 test_ret += test_xmlXPathCastBooleanToString();
43591 test_ret += test_xmlXPathCastNodeSetToBoolean();
43592 test_ret += test_xmlXPathCastNodeSetToNumber();
43593 test_ret += test_xmlXPathCastNodeSetToString();
43594 test_ret += test_xmlXPathCastNodeToNumber();
43595 test_ret += test_xmlXPathCastNodeToString();
43596 test_ret += test_xmlXPathCastNumberToBoolean();
43597 test_ret += test_xmlXPathCastNumberToString();
43598 test_ret += test_xmlXPathCastStringToBoolean();
43599 test_ret += test_xmlXPathCastStringToNumber();
43600 test_ret += test_xmlXPathCastToBoolean();
43601 test_ret += test_xmlXPathCastToNumber();
43602 test_ret += test_xmlXPathCastToString();
43603 test_ret += test_xmlXPathCmpNodes();
43604 test_ret += test_xmlXPathCompile();
43605 test_ret += test_xmlXPathCompiledEval();
43606 test_ret += test_xmlXPathConvertBoolean();
43607 test_ret += test_xmlXPathConvertNumber();
43608 test_ret += test_xmlXPathConvertString();
43609 test_ret += test_xmlXPathCtxtCompile();
43610 test_ret += test_xmlXPathEval();
43611 test_ret += test_xmlXPathEvalExpression();
43612 test_ret += test_xmlXPathEvalPredicate();
43613 test_ret += test_xmlXPathInit();
43614 test_ret += test_xmlXPathIsInf();
43615 test_ret += test_xmlXPathIsNaN();
43616 test_ret += test_xmlXPathNewContext();
43617 test_ret += test_xmlXPathNodeSetCreate();
43618 test_ret += test_xmlXPathObjectCopy();
43619 test_ret += test_xmlXPathOrderDocElems();
Daniel Veillardd93f6252004-11-02 15:53:51 +000043620
Daniel Veillard42595322004-11-08 10:52:06 +000043621 if (test_ret != 0)
43622 printf("Module xpath: %d errors\n", test_ret);
43623 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043624}
Daniel Veillarda521d282004-11-09 14:59:59 +000043625#ifdef LIBXML_XPATH_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000043626
Daniel Veillarda82b1822004-11-08 16:24:57 +000043627#define gen_nb_xmlXPathParserContextPtr 1
43628static xmlXPathParserContextPtr gen_xmlXPathParserContextPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
43629 return(NULL);
43630}
43631static void des_xmlXPathParserContextPtr(int no ATTRIBUTE_UNUSED, xmlXPathParserContextPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
43632}
Daniel Veillarda521d282004-11-09 14:59:59 +000043633#endif
43634
Daniel Veillarda82b1822004-11-08 16:24:57 +000043635
43636static int
43637test_valuePop(void) {
43638 int test_ret = 0;
43639
William M. Brack21e4ef22005-01-02 09:53:13 +000043640#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000043641 int mem_base;
43642 xmlXPathObjectPtr ret_val;
43643 xmlXPathParserContextPtr ctxt; /* an XPath evaluation context */
43644 int n_ctxt;
43645
43646 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43647 mem_base = xmlMemBlocks();
43648 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43649
43650 ret_val = valuePop(ctxt);
43651 desret_xmlXPathObjectPtr(ret_val);
43652 call_tests++;
43653 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43654 xmlResetLastError();
43655 if (mem_base != xmlMemBlocks()) {
43656 printf("Leak of %d blocks found in valuePop",
43657 xmlMemBlocks() - mem_base);
43658 test_ret++;
43659 printf(" %d", n_ctxt);
43660 printf("\n");
43661 }
43662 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043663 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043664#endif
43665
Daniel Veillarda82b1822004-11-08 16:24:57 +000043666 return(test_ret);
43667}
43668
43669
43670static int
43671test_valuePush(void) {
43672 int test_ret = 0;
43673
William M. Brack21e4ef22005-01-02 09:53:13 +000043674#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000043675 int mem_base;
43676 int ret_val;
43677 xmlXPathParserContextPtr ctxt; /* an XPath evaluation context */
43678 int n_ctxt;
43679 xmlXPathObjectPtr value; /* the XPath object */
43680 int n_value;
43681
43682 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43683 for (n_value = 0;n_value < gen_nb_xmlXPathObjectPtr;n_value++) {
43684 mem_base = xmlMemBlocks();
43685 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43686 value = gen_xmlXPathObjectPtr(n_value, 1);
43687
43688 ret_val = valuePush(ctxt, value);
43689 desret_int(ret_val);
43690 call_tests++;
43691 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43692 des_xmlXPathObjectPtr(n_value, value, 1);
43693 xmlResetLastError();
43694 if (mem_base != xmlMemBlocks()) {
43695 printf("Leak of %d blocks found in valuePush",
43696 xmlMemBlocks() - mem_base);
43697 test_ret++;
43698 printf(" %d", n_ctxt);
43699 printf(" %d", n_value);
43700 printf("\n");
43701 }
43702 }
43703 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043704 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043705#endif
43706
Daniel Veillarda82b1822004-11-08 16:24:57 +000043707 return(test_ret);
43708}
43709
43710
43711static int
43712test_xmlXPathAddValues(void) {
43713 int test_ret = 0;
43714
William M. Brack21e4ef22005-01-02 09:53:13 +000043715#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000043716 int mem_base;
43717 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43718 int n_ctxt;
43719
43720 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43721 mem_base = xmlMemBlocks();
43722 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43723
43724 xmlXPathAddValues(ctxt);
43725 call_tests++;
43726 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43727 xmlResetLastError();
43728 if (mem_base != xmlMemBlocks()) {
43729 printf("Leak of %d blocks found in xmlXPathAddValues",
43730 xmlMemBlocks() - mem_base);
43731 test_ret++;
43732 printf(" %d", n_ctxt);
43733 printf("\n");
43734 }
43735 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043736 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043737#endif
43738
Daniel Veillarda82b1822004-11-08 16:24:57 +000043739 return(test_ret);
43740}
43741
43742
43743static int
43744test_xmlXPathBooleanFunction(void) {
43745 int test_ret = 0;
43746
William M. Brack21e4ef22005-01-02 09:53:13 +000043747#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000043748 int mem_base;
43749 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43750 int n_ctxt;
43751 int nargs; /* the number of arguments */
43752 int n_nargs;
43753
43754 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43755 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
43756 mem_base = xmlMemBlocks();
43757 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43758 nargs = gen_int(n_nargs, 1);
43759
43760 xmlXPathBooleanFunction(ctxt, nargs);
43761 call_tests++;
43762 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43763 des_int(n_nargs, nargs, 1);
43764 xmlResetLastError();
43765 if (mem_base != xmlMemBlocks()) {
43766 printf("Leak of %d blocks found in xmlXPathBooleanFunction",
43767 xmlMemBlocks() - mem_base);
43768 test_ret++;
43769 printf(" %d", n_ctxt);
43770 printf(" %d", n_nargs);
43771 printf("\n");
43772 }
43773 }
43774 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043775 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043776#endif
43777
Daniel Veillarda82b1822004-11-08 16:24:57 +000043778 return(test_ret);
43779}
43780
43781
43782static int
43783test_xmlXPathCeilingFunction(void) {
43784 int test_ret = 0;
43785
William M. Brack21e4ef22005-01-02 09:53:13 +000043786#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000043787 int mem_base;
43788 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43789 int n_ctxt;
43790 int nargs; /* the number of arguments */
43791 int n_nargs;
43792
43793 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43794 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
43795 mem_base = xmlMemBlocks();
43796 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43797 nargs = gen_int(n_nargs, 1);
43798
43799 xmlXPathCeilingFunction(ctxt, nargs);
43800 call_tests++;
43801 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43802 des_int(n_nargs, nargs, 1);
43803 xmlResetLastError();
43804 if (mem_base != xmlMemBlocks()) {
43805 printf("Leak of %d blocks found in xmlXPathCeilingFunction",
43806 xmlMemBlocks() - mem_base);
43807 test_ret++;
43808 printf(" %d", n_ctxt);
43809 printf(" %d", n_nargs);
43810 printf("\n");
43811 }
43812 }
43813 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043814 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043815#endif
43816
Daniel Veillarda82b1822004-11-08 16:24:57 +000043817 return(test_ret);
43818}
43819
43820
43821static int
43822test_xmlXPathCompareValues(void) {
43823 int test_ret = 0;
43824
William M. Brack21e4ef22005-01-02 09:53:13 +000043825#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000043826 int mem_base;
43827 int ret_val;
43828 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43829 int n_ctxt;
43830 int inf; /* less than (1) or greater than (0) */
43831 int n_inf;
43832 int strict; /* is the comparison strict */
43833 int n_strict;
43834
43835 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43836 for (n_inf = 0;n_inf < gen_nb_int;n_inf++) {
43837 for (n_strict = 0;n_strict < gen_nb_int;n_strict++) {
43838 mem_base = xmlMemBlocks();
43839 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43840 inf = gen_int(n_inf, 1);
43841 strict = gen_int(n_strict, 2);
43842
43843 ret_val = xmlXPathCompareValues(ctxt, inf, strict);
43844 desret_int(ret_val);
43845 call_tests++;
43846 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43847 des_int(n_inf, inf, 1);
43848 des_int(n_strict, strict, 2);
43849 xmlResetLastError();
43850 if (mem_base != xmlMemBlocks()) {
43851 printf("Leak of %d blocks found in xmlXPathCompareValues",
43852 xmlMemBlocks() - mem_base);
43853 test_ret++;
43854 printf(" %d", n_ctxt);
43855 printf(" %d", n_inf);
43856 printf(" %d", n_strict);
43857 printf("\n");
43858 }
43859 }
43860 }
43861 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043862 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043863#endif
43864
Daniel Veillarda82b1822004-11-08 16:24:57 +000043865 return(test_ret);
43866}
43867
43868
43869static int
43870test_xmlXPathConcatFunction(void) {
43871 int test_ret = 0;
43872
William M. Brack21e4ef22005-01-02 09:53:13 +000043873#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000043874 int mem_base;
43875 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43876 int n_ctxt;
43877 int nargs; /* the number of arguments */
43878 int n_nargs;
43879
43880 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43881 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
43882 mem_base = xmlMemBlocks();
43883 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43884 nargs = gen_int(n_nargs, 1);
43885
43886 xmlXPathConcatFunction(ctxt, nargs);
43887 call_tests++;
43888 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43889 des_int(n_nargs, nargs, 1);
43890 xmlResetLastError();
43891 if (mem_base != xmlMemBlocks()) {
43892 printf("Leak of %d blocks found in xmlXPathConcatFunction",
43893 xmlMemBlocks() - mem_base);
43894 test_ret++;
43895 printf(" %d", n_ctxt);
43896 printf(" %d", n_nargs);
43897 printf("\n");
43898 }
43899 }
43900 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043901 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043902#endif
43903
Daniel Veillarda82b1822004-11-08 16:24:57 +000043904 return(test_ret);
43905}
43906
43907
43908static int
43909test_xmlXPathContainsFunction(void) {
43910 int test_ret = 0;
43911
William M. Brack21e4ef22005-01-02 09:53:13 +000043912#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000043913 int mem_base;
43914 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43915 int n_ctxt;
43916 int nargs; /* the number of arguments */
43917 int n_nargs;
43918
43919 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43920 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
43921 mem_base = xmlMemBlocks();
43922 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43923 nargs = gen_int(n_nargs, 1);
43924
43925 xmlXPathContainsFunction(ctxt, nargs);
43926 call_tests++;
43927 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43928 des_int(n_nargs, nargs, 1);
43929 xmlResetLastError();
43930 if (mem_base != xmlMemBlocks()) {
43931 printf("Leak of %d blocks found in xmlXPathContainsFunction",
43932 xmlMemBlocks() - mem_base);
43933 test_ret++;
43934 printf(" %d", n_ctxt);
43935 printf(" %d", n_nargs);
43936 printf("\n");
43937 }
43938 }
43939 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043940 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043941#endif
43942
Daniel Veillarda82b1822004-11-08 16:24:57 +000043943 return(test_ret);
43944}
43945
43946
43947static int
43948test_xmlXPathCountFunction(void) {
43949 int test_ret = 0;
43950
William M. Brack21e4ef22005-01-02 09:53:13 +000043951#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000043952 int mem_base;
43953 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43954 int n_ctxt;
43955 int nargs; /* the number of arguments */
43956 int n_nargs;
43957
43958 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43959 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
43960 mem_base = xmlMemBlocks();
43961 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43962 nargs = gen_int(n_nargs, 1);
43963
43964 xmlXPathCountFunction(ctxt, nargs);
43965 call_tests++;
43966 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43967 des_int(n_nargs, nargs, 1);
43968 xmlResetLastError();
43969 if (mem_base != xmlMemBlocks()) {
43970 printf("Leak of %d blocks found in xmlXPathCountFunction",
43971 xmlMemBlocks() - mem_base);
43972 test_ret++;
43973 printf(" %d", n_ctxt);
43974 printf(" %d", n_nargs);
43975 printf("\n");
43976 }
43977 }
43978 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043979 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043980#endif
43981
Daniel Veillarda82b1822004-11-08 16:24:57 +000043982 return(test_ret);
43983}
43984
43985
43986static int
43987test_xmlXPathDebugDumpCompExpr(void) {
43988 int test_ret = 0;
43989
William M. Brack21e4ef22005-01-02 09:53:13 +000043990#if defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000043991 int mem_base;
43992 FILE * output; /* the FILE * for the output */
43993 int n_output;
43994 xmlXPathCompExprPtr comp; /* the precompiled XPath expression */
43995 int n_comp;
43996 int depth; /* the indentation level. */
43997 int n_depth;
43998
43999 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
44000 for (n_comp = 0;n_comp < gen_nb_xmlXPathCompExprPtr;n_comp++) {
44001 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
44002 mem_base = xmlMemBlocks();
44003 output = gen_FILE_ptr(n_output, 0);
44004 comp = gen_xmlXPathCompExprPtr(n_comp, 1);
44005 depth = gen_int(n_depth, 2);
44006
44007 xmlXPathDebugDumpCompExpr(output, comp, depth);
44008 call_tests++;
44009 des_FILE_ptr(n_output, output, 0);
44010 des_xmlXPathCompExprPtr(n_comp, comp, 1);
44011 des_int(n_depth, depth, 2);
44012 xmlResetLastError();
44013 if (mem_base != xmlMemBlocks()) {
44014 printf("Leak of %d blocks found in xmlXPathDebugDumpCompExpr",
44015 xmlMemBlocks() - mem_base);
44016 test_ret++;
44017 printf(" %d", n_output);
44018 printf(" %d", n_comp);
44019 printf(" %d", n_depth);
44020 printf("\n");
44021 }
44022 }
44023 }
44024 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044025 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044026#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +000044027
Daniel Veillarda82b1822004-11-08 16:24:57 +000044028 return(test_ret);
44029}
44030
44031
44032static int
44033test_xmlXPathDebugDumpObject(void) {
44034 int test_ret = 0;
44035
William M. Brack21e4ef22005-01-02 09:53:13 +000044036#if defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044037 int mem_base;
44038 FILE * output; /* the FILE * to dump the output */
44039 int n_output;
44040 xmlXPathObjectPtr cur; /* the object to inspect */
44041 int n_cur;
44042 int depth; /* indentation level */
44043 int n_depth;
44044
44045 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
44046 for (n_cur = 0;n_cur < gen_nb_xmlXPathObjectPtr;n_cur++) {
44047 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
44048 mem_base = xmlMemBlocks();
44049 output = gen_FILE_ptr(n_output, 0);
44050 cur = gen_xmlXPathObjectPtr(n_cur, 1);
44051 depth = gen_int(n_depth, 2);
44052
44053 xmlXPathDebugDumpObject(output, cur, depth);
44054 call_tests++;
44055 des_FILE_ptr(n_output, output, 0);
44056 des_xmlXPathObjectPtr(n_cur, cur, 1);
44057 des_int(n_depth, depth, 2);
44058 xmlResetLastError();
44059 if (mem_base != xmlMemBlocks()) {
44060 printf("Leak of %d blocks found in xmlXPathDebugDumpObject",
44061 xmlMemBlocks() - mem_base);
44062 test_ret++;
44063 printf(" %d", n_output);
44064 printf(" %d", n_cur);
44065 printf(" %d", n_depth);
44066 printf("\n");
44067 }
44068 }
44069 }
44070 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044071 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044072#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +000044073
Daniel Veillarda82b1822004-11-08 16:24:57 +000044074 return(test_ret);
44075}
44076
44077
44078static int
44079test_xmlXPathDifference(void) {
44080 int test_ret = 0;
44081
William M. Brack21e4ef22005-01-02 09:53:13 +000044082#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044083 int mem_base;
44084 xmlNodeSetPtr ret_val;
44085 xmlNodeSetPtr nodes1; /* a node-set */
44086 int n_nodes1;
44087 xmlNodeSetPtr nodes2; /* a node-set */
44088 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044089
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044090 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
44091 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
44092 mem_base = xmlMemBlocks();
44093 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
44094 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
44095
44096 ret_val = xmlXPathDifference(nodes1, nodes2);
44097 desret_xmlNodeSetPtr(ret_val);
44098 call_tests++;
44099 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
44100 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
44101 xmlResetLastError();
44102 if (mem_base != xmlMemBlocks()) {
44103 printf("Leak of %d blocks found in xmlXPathDifference",
44104 xmlMemBlocks() - mem_base);
44105 test_ret++;
44106 printf(" %d", n_nodes1);
44107 printf(" %d", n_nodes2);
44108 printf("\n");
44109 }
44110 }
44111 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044112 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044113#endif
44114
Daniel Veillarda82b1822004-11-08 16:24:57 +000044115 return(test_ret);
44116}
44117
44118
44119static int
44120test_xmlXPathDistinct(void) {
44121 int test_ret = 0;
44122
William M. Brack21e4ef22005-01-02 09:53:13 +000044123#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044124 int mem_base;
44125 xmlNodeSetPtr ret_val;
44126 xmlNodeSetPtr nodes; /* a node-set */
44127 int n_nodes;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044128
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044129 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
44130 mem_base = xmlMemBlocks();
44131 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
44132
44133 ret_val = xmlXPathDistinct(nodes);
44134 desret_xmlNodeSetPtr(ret_val);
44135 call_tests++;
44136 des_xmlNodeSetPtr(n_nodes, nodes, 0);
44137 xmlResetLastError();
44138 if (mem_base != xmlMemBlocks()) {
44139 printf("Leak of %d blocks found in xmlXPathDistinct",
44140 xmlMemBlocks() - mem_base);
44141 test_ret++;
44142 printf(" %d", n_nodes);
44143 printf("\n");
44144 }
44145 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044146 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044147#endif
44148
Daniel Veillarda82b1822004-11-08 16:24:57 +000044149 return(test_ret);
44150}
44151
44152
44153static int
44154test_xmlXPathDistinctSorted(void) {
44155 int test_ret = 0;
44156
William M. Brack21e4ef22005-01-02 09:53:13 +000044157#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044158 int mem_base;
44159 xmlNodeSetPtr ret_val;
44160 xmlNodeSetPtr nodes; /* a node-set, sorted by document order */
44161 int n_nodes;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044162
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044163 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
44164 mem_base = xmlMemBlocks();
44165 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
44166
44167 ret_val = xmlXPathDistinctSorted(nodes);
44168 desret_xmlNodeSetPtr(ret_val);
44169 call_tests++;
44170 des_xmlNodeSetPtr(n_nodes, nodes, 0);
44171 xmlResetLastError();
44172 if (mem_base != xmlMemBlocks()) {
44173 printf("Leak of %d blocks found in xmlXPathDistinctSorted",
44174 xmlMemBlocks() - mem_base);
44175 test_ret++;
44176 printf(" %d", n_nodes);
44177 printf("\n");
44178 }
44179 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044180 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044181#endif
44182
Daniel Veillarda82b1822004-11-08 16:24:57 +000044183 return(test_ret);
44184}
44185
44186
44187static int
44188test_xmlXPathDivValues(void) {
44189 int test_ret = 0;
44190
William M. Brack21e4ef22005-01-02 09:53:13 +000044191#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044192 int mem_base;
44193 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44194 int n_ctxt;
44195
44196 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44197 mem_base = xmlMemBlocks();
44198 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44199
44200 xmlXPathDivValues(ctxt);
44201 call_tests++;
44202 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44203 xmlResetLastError();
44204 if (mem_base != xmlMemBlocks()) {
44205 printf("Leak of %d blocks found in xmlXPathDivValues",
44206 xmlMemBlocks() - mem_base);
44207 test_ret++;
44208 printf(" %d", n_ctxt);
44209 printf("\n");
44210 }
44211 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044212 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044213#endif
44214
Daniel Veillarda82b1822004-11-08 16:24:57 +000044215 return(test_ret);
44216}
44217
44218
44219static int
44220test_xmlXPathEqualValues(void) {
44221 int test_ret = 0;
44222
William M. Brack21e4ef22005-01-02 09:53:13 +000044223#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044224 int mem_base;
44225 int ret_val;
44226 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44227 int n_ctxt;
44228
44229 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44230 mem_base = xmlMemBlocks();
44231 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44232
44233 ret_val = xmlXPathEqualValues(ctxt);
44234 desret_int(ret_val);
44235 call_tests++;
44236 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44237 xmlResetLastError();
44238 if (mem_base != xmlMemBlocks()) {
44239 printf("Leak of %d blocks found in xmlXPathEqualValues",
44240 xmlMemBlocks() - mem_base);
44241 test_ret++;
44242 printf(" %d", n_ctxt);
44243 printf("\n");
44244 }
44245 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044246 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044247#endif
44248
Daniel Veillarda82b1822004-11-08 16:24:57 +000044249 return(test_ret);
44250}
44251
44252
44253static int
44254test_xmlXPathErr(void) {
44255 int test_ret = 0;
44256
William M. Brack21e4ef22005-01-02 09:53:13 +000044257#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044258 int mem_base;
44259 xmlXPathParserContextPtr ctxt; /* a XPath parser context */
44260 int n_ctxt;
44261 int error; /* the error code */
44262 int n_error;
44263
44264 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44265 for (n_error = 0;n_error < gen_nb_int;n_error++) {
44266 mem_base = xmlMemBlocks();
44267 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44268 error = gen_int(n_error, 1);
44269
44270 xmlXPathErr(ctxt, error);
44271 call_tests++;
44272 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44273 des_int(n_error, error, 1);
44274 xmlResetLastError();
44275 if (mem_base != xmlMemBlocks()) {
44276 printf("Leak of %d blocks found in xmlXPathErr",
44277 xmlMemBlocks() - mem_base);
44278 test_ret++;
44279 printf(" %d", n_ctxt);
44280 printf(" %d", n_error);
44281 printf("\n");
44282 }
44283 }
44284 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044285 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044286#endif
44287
Daniel Veillarda82b1822004-11-08 16:24:57 +000044288 return(test_ret);
44289}
44290
44291
44292static int
44293test_xmlXPathEvalExpr(void) {
44294 int test_ret = 0;
44295
William M. Brack21e4ef22005-01-02 09:53:13 +000044296#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044297 int mem_base;
44298 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44299 int n_ctxt;
44300
44301 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44302 mem_base = xmlMemBlocks();
44303 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44304
44305 xmlXPathEvalExpr(ctxt);
44306 call_tests++;
44307 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44308 xmlResetLastError();
44309 if (mem_base != xmlMemBlocks()) {
44310 printf("Leak of %d blocks found in xmlXPathEvalExpr",
44311 xmlMemBlocks() - mem_base);
44312 test_ret++;
44313 printf(" %d", n_ctxt);
44314 printf("\n");
44315 }
44316 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044317 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044318#endif
44319
Daniel Veillarda82b1822004-11-08 16:24:57 +000044320 return(test_ret);
44321}
44322
44323
44324static int
44325test_xmlXPathEvaluatePredicateResult(void) {
44326 int test_ret = 0;
44327
William M. Brack21e4ef22005-01-02 09:53:13 +000044328#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044329 int mem_base;
44330 int ret_val;
44331 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44332 int n_ctxt;
44333 xmlXPathObjectPtr res; /* the Predicate Expression evaluation result */
44334 int n_res;
44335
44336 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44337 for (n_res = 0;n_res < gen_nb_xmlXPathObjectPtr;n_res++) {
44338 mem_base = xmlMemBlocks();
44339 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44340 res = gen_xmlXPathObjectPtr(n_res, 1);
44341
44342 ret_val = xmlXPathEvaluatePredicateResult(ctxt, res);
44343 desret_int(ret_val);
44344 call_tests++;
44345 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44346 des_xmlXPathObjectPtr(n_res, res, 1);
44347 xmlResetLastError();
44348 if (mem_base != xmlMemBlocks()) {
44349 printf("Leak of %d blocks found in xmlXPathEvaluatePredicateResult",
44350 xmlMemBlocks() - mem_base);
44351 test_ret++;
44352 printf(" %d", n_ctxt);
44353 printf(" %d", n_res);
44354 printf("\n");
44355 }
44356 }
44357 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044358 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044359#endif
44360
Daniel Veillarda82b1822004-11-08 16:24:57 +000044361 return(test_ret);
44362}
44363
44364
44365static int
44366test_xmlXPathFalseFunction(void) {
44367 int test_ret = 0;
44368
William M. Brack21e4ef22005-01-02 09:53:13 +000044369#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044370 int mem_base;
44371 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44372 int n_ctxt;
44373 int nargs; /* the number of arguments */
44374 int n_nargs;
44375
44376 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44377 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44378 mem_base = xmlMemBlocks();
44379 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44380 nargs = gen_int(n_nargs, 1);
44381
44382 xmlXPathFalseFunction(ctxt, nargs);
44383 call_tests++;
44384 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44385 des_int(n_nargs, nargs, 1);
44386 xmlResetLastError();
44387 if (mem_base != xmlMemBlocks()) {
44388 printf("Leak of %d blocks found in xmlXPathFalseFunction",
44389 xmlMemBlocks() - mem_base);
44390 test_ret++;
44391 printf(" %d", n_ctxt);
44392 printf(" %d", n_nargs);
44393 printf("\n");
44394 }
44395 }
44396 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044397 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044398#endif
44399
Daniel Veillarda82b1822004-11-08 16:24:57 +000044400 return(test_ret);
44401}
44402
44403
44404static int
44405test_xmlXPathFloorFunction(void) {
44406 int test_ret = 0;
44407
William M. Brack21e4ef22005-01-02 09:53:13 +000044408#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044409 int mem_base;
44410 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44411 int n_ctxt;
44412 int nargs; /* the number of arguments */
44413 int n_nargs;
44414
44415 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44416 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44417 mem_base = xmlMemBlocks();
44418 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44419 nargs = gen_int(n_nargs, 1);
44420
44421 xmlXPathFloorFunction(ctxt, nargs);
44422 call_tests++;
44423 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44424 des_int(n_nargs, nargs, 1);
44425 xmlResetLastError();
44426 if (mem_base != xmlMemBlocks()) {
44427 printf("Leak of %d blocks found in xmlXPathFloorFunction",
44428 xmlMemBlocks() - mem_base);
44429 test_ret++;
44430 printf(" %d", n_ctxt);
44431 printf(" %d", n_nargs);
44432 printf("\n");
44433 }
44434 }
44435 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044436 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044437#endif
44438
Daniel Veillarda82b1822004-11-08 16:24:57 +000044439 return(test_ret);
44440}
44441
44442
44443static int
44444test_xmlXPathFunctionLookup(void) {
44445 int test_ret = 0;
44446
44447
44448 /* missing type support */
44449 return(test_ret);
44450}
44451
44452
44453static int
44454test_xmlXPathFunctionLookupNS(void) {
44455 int test_ret = 0;
44456
44457
44458 /* missing type support */
44459 return(test_ret);
44460}
44461
44462
44463static int
44464test_xmlXPathHasSameNodes(void) {
44465 int test_ret = 0;
44466
William M. Brack21e4ef22005-01-02 09:53:13 +000044467#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044468 int mem_base;
44469 int ret_val;
44470 xmlNodeSetPtr nodes1; /* a node-set */
44471 int n_nodes1;
44472 xmlNodeSetPtr nodes2; /* a node-set */
44473 int n_nodes2;
44474
44475 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
44476 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
44477 mem_base = xmlMemBlocks();
44478 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
44479 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
44480
44481 ret_val = xmlXPathHasSameNodes(nodes1, nodes2);
44482 desret_int(ret_val);
44483 call_tests++;
44484 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
44485 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
44486 xmlResetLastError();
44487 if (mem_base != xmlMemBlocks()) {
44488 printf("Leak of %d blocks found in xmlXPathHasSameNodes",
44489 xmlMemBlocks() - mem_base);
44490 test_ret++;
44491 printf(" %d", n_nodes1);
44492 printf(" %d", n_nodes2);
44493 printf("\n");
44494 }
44495 }
44496 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044497 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044498#endif
44499
Daniel Veillarda82b1822004-11-08 16:24:57 +000044500 return(test_ret);
44501}
44502
44503
44504static int
44505test_xmlXPathIdFunction(void) {
44506 int test_ret = 0;
44507
William M. Brack21e4ef22005-01-02 09:53:13 +000044508#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044509 int mem_base;
44510 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44511 int n_ctxt;
44512 int nargs; /* the number of arguments */
44513 int n_nargs;
44514
44515 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44516 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44517 mem_base = xmlMemBlocks();
44518 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44519 nargs = gen_int(n_nargs, 1);
44520
44521 xmlXPathIdFunction(ctxt, nargs);
44522 call_tests++;
44523 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44524 des_int(n_nargs, nargs, 1);
44525 xmlResetLastError();
44526 if (mem_base != xmlMemBlocks()) {
44527 printf("Leak of %d blocks found in xmlXPathIdFunction",
44528 xmlMemBlocks() - mem_base);
44529 test_ret++;
44530 printf(" %d", n_ctxt);
44531 printf(" %d", n_nargs);
44532 printf("\n");
44533 }
44534 }
44535 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044536 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044537#endif
44538
Daniel Veillarda82b1822004-11-08 16:24:57 +000044539 return(test_ret);
44540}
44541
44542
44543static int
44544test_xmlXPathIntersection(void) {
44545 int test_ret = 0;
44546
William M. Brack21e4ef22005-01-02 09:53:13 +000044547#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044548 int mem_base;
44549 xmlNodeSetPtr ret_val;
44550 xmlNodeSetPtr nodes1; /* a node-set */
44551 int n_nodes1;
44552 xmlNodeSetPtr nodes2; /* a node-set */
44553 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044554
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044555 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
44556 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
44557 mem_base = xmlMemBlocks();
44558 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
44559 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
44560
44561 ret_val = xmlXPathIntersection(nodes1, nodes2);
44562 desret_xmlNodeSetPtr(ret_val);
44563 call_tests++;
44564 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
44565 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
44566 xmlResetLastError();
44567 if (mem_base != xmlMemBlocks()) {
44568 printf("Leak of %d blocks found in xmlXPathIntersection",
44569 xmlMemBlocks() - mem_base);
44570 test_ret++;
44571 printf(" %d", n_nodes1);
44572 printf(" %d", n_nodes2);
44573 printf("\n");
44574 }
44575 }
44576 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044577 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044578#endif
44579
Daniel Veillarda82b1822004-11-08 16:24:57 +000044580 return(test_ret);
44581}
44582
44583
44584static int
44585test_xmlXPathIsNodeType(void) {
44586 int test_ret = 0;
44587
William M. Brack21e4ef22005-01-02 09:53:13 +000044588#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044589 int mem_base;
44590 int ret_val;
44591 xmlChar * name; /* a name string */
44592 int n_name;
44593
44594 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
44595 mem_base = xmlMemBlocks();
44596 name = gen_const_xmlChar_ptr(n_name, 0);
44597
William M. Brackf13f77f2004-11-12 16:03:48 +000044598 ret_val = xmlXPathIsNodeType((const xmlChar *)name);
Daniel Veillarda82b1822004-11-08 16:24:57 +000044599 desret_int(ret_val);
44600 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000044601 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillarda82b1822004-11-08 16:24:57 +000044602 xmlResetLastError();
44603 if (mem_base != xmlMemBlocks()) {
44604 printf("Leak of %d blocks found in xmlXPathIsNodeType",
44605 xmlMemBlocks() - mem_base);
44606 test_ret++;
44607 printf(" %d", n_name);
44608 printf("\n");
44609 }
44610 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044611 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044612#endif
44613
Daniel Veillarda82b1822004-11-08 16:24:57 +000044614 return(test_ret);
44615}
44616
44617
44618static int
44619test_xmlXPathLangFunction(void) {
44620 int test_ret = 0;
44621
William M. Brack21e4ef22005-01-02 09:53:13 +000044622#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044623 int mem_base;
44624 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44625 int n_ctxt;
44626 int nargs; /* the number of arguments */
44627 int n_nargs;
44628
44629 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44630 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44631 mem_base = xmlMemBlocks();
44632 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44633 nargs = gen_int(n_nargs, 1);
44634
44635 xmlXPathLangFunction(ctxt, nargs);
44636 call_tests++;
44637 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44638 des_int(n_nargs, nargs, 1);
44639 xmlResetLastError();
44640 if (mem_base != xmlMemBlocks()) {
44641 printf("Leak of %d blocks found in xmlXPathLangFunction",
44642 xmlMemBlocks() - mem_base);
44643 test_ret++;
44644 printf(" %d", n_ctxt);
44645 printf(" %d", n_nargs);
44646 printf("\n");
44647 }
44648 }
44649 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044650 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044651#endif
44652
Daniel Veillarda82b1822004-11-08 16:24:57 +000044653 return(test_ret);
44654}
44655
44656
44657static int
44658test_xmlXPathLastFunction(void) {
44659 int test_ret = 0;
44660
William M. Brack21e4ef22005-01-02 09:53:13 +000044661#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044662 int mem_base;
44663 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44664 int n_ctxt;
44665 int nargs; /* the number of arguments */
44666 int n_nargs;
44667
44668 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44669 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44670 mem_base = xmlMemBlocks();
44671 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44672 nargs = gen_int(n_nargs, 1);
44673
44674 xmlXPathLastFunction(ctxt, nargs);
44675 call_tests++;
44676 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44677 des_int(n_nargs, nargs, 1);
44678 xmlResetLastError();
44679 if (mem_base != xmlMemBlocks()) {
44680 printf("Leak of %d blocks found in xmlXPathLastFunction",
44681 xmlMemBlocks() - mem_base);
44682 test_ret++;
44683 printf(" %d", n_ctxt);
44684 printf(" %d", n_nargs);
44685 printf("\n");
44686 }
44687 }
44688 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044689 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044690#endif
44691
Daniel Veillarda82b1822004-11-08 16:24:57 +000044692 return(test_ret);
44693}
44694
44695
44696static int
44697test_xmlXPathLeading(void) {
44698 int test_ret = 0;
44699
William M. Brack21e4ef22005-01-02 09:53:13 +000044700#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044701 int mem_base;
44702 xmlNodeSetPtr ret_val;
44703 xmlNodeSetPtr nodes1; /* a node-set */
44704 int n_nodes1;
44705 xmlNodeSetPtr nodes2; /* a node-set */
44706 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044707
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044708 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
44709 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
44710 mem_base = xmlMemBlocks();
44711 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
44712 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
44713
44714 ret_val = xmlXPathLeading(nodes1, nodes2);
44715 desret_xmlNodeSetPtr(ret_val);
44716 call_tests++;
44717 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
44718 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
44719 xmlResetLastError();
44720 if (mem_base != xmlMemBlocks()) {
44721 printf("Leak of %d blocks found in xmlXPathLeading",
44722 xmlMemBlocks() - mem_base);
44723 test_ret++;
44724 printf(" %d", n_nodes1);
44725 printf(" %d", n_nodes2);
44726 printf("\n");
44727 }
44728 }
44729 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044730 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044731#endif
44732
Daniel Veillarda82b1822004-11-08 16:24:57 +000044733 return(test_ret);
44734}
44735
44736
44737static int
44738test_xmlXPathLeadingSorted(void) {
44739 int test_ret = 0;
44740
William M. Brack21e4ef22005-01-02 09:53:13 +000044741#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044742 int mem_base;
44743 xmlNodeSetPtr ret_val;
44744 xmlNodeSetPtr nodes1; /* a node-set, sorted by document order */
44745 int n_nodes1;
44746 xmlNodeSetPtr nodes2; /* a node-set, sorted by document order */
44747 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044748
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044749 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
44750 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
44751 mem_base = xmlMemBlocks();
44752 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
44753 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
44754
44755 ret_val = xmlXPathLeadingSorted(nodes1, nodes2);
44756 desret_xmlNodeSetPtr(ret_val);
44757 call_tests++;
44758 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
44759 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
44760 xmlResetLastError();
44761 if (mem_base != xmlMemBlocks()) {
44762 printf("Leak of %d blocks found in xmlXPathLeadingSorted",
44763 xmlMemBlocks() - mem_base);
44764 test_ret++;
44765 printf(" %d", n_nodes1);
44766 printf(" %d", n_nodes2);
44767 printf("\n");
44768 }
44769 }
44770 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044771 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044772#endif
44773
Daniel Veillarda82b1822004-11-08 16:24:57 +000044774 return(test_ret);
44775}
44776
44777
44778static int
44779test_xmlXPathLocalNameFunction(void) {
44780 int test_ret = 0;
44781
William M. Brack21e4ef22005-01-02 09:53:13 +000044782#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044783 int mem_base;
44784 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44785 int n_ctxt;
44786 int nargs; /* the number of arguments */
44787 int n_nargs;
44788
44789 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44790 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44791 mem_base = xmlMemBlocks();
44792 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44793 nargs = gen_int(n_nargs, 1);
44794
44795 xmlXPathLocalNameFunction(ctxt, nargs);
44796 call_tests++;
44797 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44798 des_int(n_nargs, nargs, 1);
44799 xmlResetLastError();
44800 if (mem_base != xmlMemBlocks()) {
44801 printf("Leak of %d blocks found in xmlXPathLocalNameFunction",
44802 xmlMemBlocks() - mem_base);
44803 test_ret++;
44804 printf(" %d", n_ctxt);
44805 printf(" %d", n_nargs);
44806 printf("\n");
44807 }
44808 }
44809 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044810 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044811#endif
44812
Daniel Veillarda82b1822004-11-08 16:24:57 +000044813 return(test_ret);
44814}
44815
44816
44817static int
44818test_xmlXPathModValues(void) {
44819 int test_ret = 0;
44820
William M. Brack21e4ef22005-01-02 09:53:13 +000044821#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044822 int mem_base;
44823 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44824 int n_ctxt;
44825
44826 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44827 mem_base = xmlMemBlocks();
44828 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44829
44830 xmlXPathModValues(ctxt);
44831 call_tests++;
44832 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44833 xmlResetLastError();
44834 if (mem_base != xmlMemBlocks()) {
44835 printf("Leak of %d blocks found in xmlXPathModValues",
44836 xmlMemBlocks() - mem_base);
44837 test_ret++;
44838 printf(" %d", n_ctxt);
44839 printf("\n");
44840 }
44841 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044842 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044843#endif
44844
Daniel Veillarda82b1822004-11-08 16:24:57 +000044845 return(test_ret);
44846}
44847
44848
44849static int
44850test_xmlXPathMultValues(void) {
44851 int test_ret = 0;
44852
William M. Brack21e4ef22005-01-02 09:53:13 +000044853#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044854 int mem_base;
44855 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44856 int n_ctxt;
44857
44858 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44859 mem_base = xmlMemBlocks();
44860 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44861
44862 xmlXPathMultValues(ctxt);
44863 call_tests++;
44864 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44865 xmlResetLastError();
44866 if (mem_base != xmlMemBlocks()) {
44867 printf("Leak of %d blocks found in xmlXPathMultValues",
44868 xmlMemBlocks() - mem_base);
44869 test_ret++;
44870 printf(" %d", n_ctxt);
44871 printf("\n");
44872 }
44873 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044874 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044875#endif
44876
Daniel Veillarda82b1822004-11-08 16:24:57 +000044877 return(test_ret);
44878}
44879
44880
44881static int
44882test_xmlXPathNamespaceURIFunction(void) {
44883 int test_ret = 0;
44884
William M. Brack21e4ef22005-01-02 09:53:13 +000044885#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044886 int mem_base;
44887 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44888 int n_ctxt;
44889 int nargs; /* the number of arguments */
44890 int n_nargs;
44891
44892 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44893 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44894 mem_base = xmlMemBlocks();
44895 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44896 nargs = gen_int(n_nargs, 1);
44897
44898 xmlXPathNamespaceURIFunction(ctxt, nargs);
44899 call_tests++;
44900 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44901 des_int(n_nargs, nargs, 1);
44902 xmlResetLastError();
44903 if (mem_base != xmlMemBlocks()) {
44904 printf("Leak of %d blocks found in xmlXPathNamespaceURIFunction",
44905 xmlMemBlocks() - mem_base);
44906 test_ret++;
44907 printf(" %d", n_ctxt);
44908 printf(" %d", n_nargs);
44909 printf("\n");
44910 }
44911 }
44912 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044913 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044914#endif
44915
Daniel Veillarda82b1822004-11-08 16:24:57 +000044916 return(test_ret);
44917}
44918
44919
44920static int
44921test_xmlXPathNewBoolean(void) {
44922 int test_ret = 0;
44923
William M. Brack21e4ef22005-01-02 09:53:13 +000044924#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044925 int mem_base;
44926 xmlXPathObjectPtr ret_val;
44927 int val; /* the boolean value */
44928 int n_val;
44929
44930 for (n_val = 0;n_val < gen_nb_int;n_val++) {
44931 mem_base = xmlMemBlocks();
44932 val = gen_int(n_val, 0);
44933
44934 ret_val = xmlXPathNewBoolean(val);
44935 desret_xmlXPathObjectPtr(ret_val);
44936 call_tests++;
44937 des_int(n_val, val, 0);
44938 xmlResetLastError();
44939 if (mem_base != xmlMemBlocks()) {
44940 printf("Leak of %d blocks found in xmlXPathNewBoolean",
44941 xmlMemBlocks() - mem_base);
44942 test_ret++;
44943 printf(" %d", n_val);
44944 printf("\n");
44945 }
44946 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044947 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044948#endif
44949
Daniel Veillarda82b1822004-11-08 16:24:57 +000044950 return(test_ret);
44951}
44952
44953
44954static int
44955test_xmlXPathNewCString(void) {
44956 int test_ret = 0;
44957
William M. Brack21e4ef22005-01-02 09:53:13 +000044958#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044959 int mem_base;
44960 xmlXPathObjectPtr ret_val;
44961 char * val; /* the char * value */
44962 int n_val;
44963
44964 for (n_val = 0;n_val < gen_nb_const_char_ptr;n_val++) {
44965 mem_base = xmlMemBlocks();
44966 val = gen_const_char_ptr(n_val, 0);
44967
William M. Brackf13f77f2004-11-12 16:03:48 +000044968 ret_val = xmlXPathNewCString((const char *)val);
Daniel Veillarda82b1822004-11-08 16:24:57 +000044969 desret_xmlXPathObjectPtr(ret_val);
44970 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000044971 des_const_char_ptr(n_val, (const char *)val, 0);
Daniel Veillarda82b1822004-11-08 16:24:57 +000044972 xmlResetLastError();
44973 if (mem_base != xmlMemBlocks()) {
44974 printf("Leak of %d blocks found in xmlXPathNewCString",
44975 xmlMemBlocks() - mem_base);
44976 test_ret++;
44977 printf(" %d", n_val);
44978 printf("\n");
44979 }
44980 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044981 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044982#endif
44983
Daniel Veillarda82b1822004-11-08 16:24:57 +000044984 return(test_ret);
44985}
44986
44987
44988static int
44989test_xmlXPathNewFloat(void) {
44990 int test_ret = 0;
44991
William M. Brack21e4ef22005-01-02 09:53:13 +000044992#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044993 int mem_base;
44994 xmlXPathObjectPtr ret_val;
44995 double val; /* the double value */
44996 int n_val;
44997
44998 for (n_val = 0;n_val < gen_nb_double;n_val++) {
44999 mem_base = xmlMemBlocks();
45000 val = gen_double(n_val, 0);
45001
45002 ret_val = xmlXPathNewFloat(val);
45003 desret_xmlXPathObjectPtr(ret_val);
45004 call_tests++;
45005 des_double(n_val, val, 0);
45006 xmlResetLastError();
45007 if (mem_base != xmlMemBlocks()) {
45008 printf("Leak of %d blocks found in xmlXPathNewFloat",
45009 xmlMemBlocks() - mem_base);
45010 test_ret++;
45011 printf(" %d", n_val);
45012 printf("\n");
45013 }
45014 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045015 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045016#endif
45017
Daniel Veillarda82b1822004-11-08 16:24:57 +000045018 return(test_ret);
45019}
45020
45021
45022static int
45023test_xmlXPathNewNodeSet(void) {
45024 int test_ret = 0;
45025
William M. Brack21e4ef22005-01-02 09:53:13 +000045026#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045027 int mem_base;
45028 xmlXPathObjectPtr ret_val;
45029 xmlNodePtr val; /* the NodePtr value */
45030 int n_val;
45031
45032 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
45033 mem_base = xmlMemBlocks();
45034 val = gen_xmlNodePtr(n_val, 0);
45035
45036 ret_val = xmlXPathNewNodeSet(val);
45037 desret_xmlXPathObjectPtr(ret_val);
45038 call_tests++;
45039 des_xmlNodePtr(n_val, val, 0);
45040 xmlResetLastError();
45041 if (mem_base != xmlMemBlocks()) {
45042 printf("Leak of %d blocks found in xmlXPathNewNodeSet",
45043 xmlMemBlocks() - mem_base);
45044 test_ret++;
45045 printf(" %d", n_val);
45046 printf("\n");
45047 }
45048 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045049 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045050#endif
45051
Daniel Veillarda82b1822004-11-08 16:24:57 +000045052 return(test_ret);
45053}
45054
45055
45056static int
45057test_xmlXPathNewNodeSetList(void) {
45058 int test_ret = 0;
45059
William M. Brack21e4ef22005-01-02 09:53:13 +000045060#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045061 int mem_base;
45062 xmlXPathObjectPtr ret_val;
45063 xmlNodeSetPtr val; /* an existing NodeSet */
45064 int n_val;
45065
45066 for (n_val = 0;n_val < gen_nb_xmlNodeSetPtr;n_val++) {
45067 mem_base = xmlMemBlocks();
45068 val = gen_xmlNodeSetPtr(n_val, 0);
45069
45070 ret_val = xmlXPathNewNodeSetList(val);
45071 desret_xmlXPathObjectPtr(ret_val);
45072 call_tests++;
45073 des_xmlNodeSetPtr(n_val, val, 0);
45074 xmlResetLastError();
45075 if (mem_base != xmlMemBlocks()) {
45076 printf("Leak of %d blocks found in xmlXPathNewNodeSetList",
45077 xmlMemBlocks() - mem_base);
45078 test_ret++;
45079 printf(" %d", n_val);
45080 printf("\n");
45081 }
45082 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045083 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045084#endif
45085
Daniel Veillarda82b1822004-11-08 16:24:57 +000045086 return(test_ret);
45087}
45088
45089
45090static int
45091test_xmlXPathNewParserContext(void) {
45092 int test_ret = 0;
45093
45094
45095 /* missing type support */
45096 return(test_ret);
45097}
45098
45099
45100static int
45101test_xmlXPathNewString(void) {
45102 int test_ret = 0;
45103
William M. Brack21e4ef22005-01-02 09:53:13 +000045104#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045105 int mem_base;
45106 xmlXPathObjectPtr ret_val;
45107 xmlChar * val; /* the xmlChar * value */
45108 int n_val;
45109
45110 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
45111 mem_base = xmlMemBlocks();
45112 val = gen_const_xmlChar_ptr(n_val, 0);
45113
William M. Brackf13f77f2004-11-12 16:03:48 +000045114 ret_val = xmlXPathNewString((const xmlChar *)val);
Daniel Veillarda82b1822004-11-08 16:24:57 +000045115 desret_xmlXPathObjectPtr(ret_val);
45116 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000045117 des_const_xmlChar_ptr(n_val, (const xmlChar *)val, 0);
Daniel Veillarda82b1822004-11-08 16:24:57 +000045118 xmlResetLastError();
45119 if (mem_base != xmlMemBlocks()) {
45120 printf("Leak of %d blocks found in xmlXPathNewString",
45121 xmlMemBlocks() - mem_base);
45122 test_ret++;
45123 printf(" %d", n_val);
45124 printf("\n");
45125 }
45126 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045127 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045128#endif
45129
Daniel Veillarda82b1822004-11-08 16:24:57 +000045130 return(test_ret);
45131}
45132
45133
45134static int
45135test_xmlXPathNextAncestor(void) {
45136 int test_ret = 0;
45137
William M. Brack21e4ef22005-01-02 09:53:13 +000045138#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045139 int mem_base;
45140 xmlNodePtr ret_val;
45141 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45142 int n_ctxt;
45143 xmlNodePtr cur; /* the current node in the traversal */
45144 int n_cur;
45145
45146 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45147 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45148 mem_base = xmlMemBlocks();
45149 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45150 cur = gen_xmlNodePtr(n_cur, 1);
45151
45152 ret_val = xmlXPathNextAncestor(ctxt, cur);
45153 desret_xmlNodePtr(ret_val);
45154 call_tests++;
45155 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45156 des_xmlNodePtr(n_cur, cur, 1);
45157 xmlResetLastError();
45158 if (mem_base != xmlMemBlocks()) {
45159 printf("Leak of %d blocks found in xmlXPathNextAncestor",
45160 xmlMemBlocks() - mem_base);
45161 test_ret++;
45162 printf(" %d", n_ctxt);
45163 printf(" %d", n_cur);
45164 printf("\n");
45165 }
45166 }
45167 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045168 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045169#endif
45170
Daniel Veillarda82b1822004-11-08 16:24:57 +000045171 return(test_ret);
45172}
45173
45174
45175static int
45176test_xmlXPathNextAncestorOrSelf(void) {
45177 int test_ret = 0;
45178
William M. Brack21e4ef22005-01-02 09:53:13 +000045179#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045180 int mem_base;
45181 xmlNodePtr ret_val;
45182 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45183 int n_ctxt;
45184 xmlNodePtr cur; /* the current node in the traversal */
45185 int n_cur;
45186
45187 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45188 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45189 mem_base = xmlMemBlocks();
45190 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45191 cur = gen_xmlNodePtr(n_cur, 1);
45192
45193 ret_val = xmlXPathNextAncestorOrSelf(ctxt, cur);
45194 desret_xmlNodePtr(ret_val);
45195 call_tests++;
45196 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45197 des_xmlNodePtr(n_cur, cur, 1);
45198 xmlResetLastError();
45199 if (mem_base != xmlMemBlocks()) {
45200 printf("Leak of %d blocks found in xmlXPathNextAncestorOrSelf",
45201 xmlMemBlocks() - mem_base);
45202 test_ret++;
45203 printf(" %d", n_ctxt);
45204 printf(" %d", n_cur);
45205 printf("\n");
45206 }
45207 }
45208 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045209 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045210#endif
45211
Daniel Veillarda82b1822004-11-08 16:24:57 +000045212 return(test_ret);
45213}
45214
45215
45216static int
45217test_xmlXPathNextAttribute(void) {
45218 int test_ret = 0;
45219
William M. Brack21e4ef22005-01-02 09:53:13 +000045220#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045221 int mem_base;
45222 xmlNodePtr ret_val;
45223 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45224 int n_ctxt;
45225 xmlNodePtr cur; /* the current attribute in the traversal */
45226 int n_cur;
45227
45228 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45229 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45230 mem_base = xmlMemBlocks();
45231 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45232 cur = gen_xmlNodePtr(n_cur, 1);
45233
45234 ret_val = xmlXPathNextAttribute(ctxt, cur);
45235 desret_xmlNodePtr(ret_val);
45236 call_tests++;
45237 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45238 des_xmlNodePtr(n_cur, cur, 1);
45239 xmlResetLastError();
45240 if (mem_base != xmlMemBlocks()) {
45241 printf("Leak of %d blocks found in xmlXPathNextAttribute",
45242 xmlMemBlocks() - mem_base);
45243 test_ret++;
45244 printf(" %d", n_ctxt);
45245 printf(" %d", n_cur);
45246 printf("\n");
45247 }
45248 }
45249 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045250 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045251#endif
45252
Daniel Veillarda82b1822004-11-08 16:24:57 +000045253 return(test_ret);
45254}
45255
45256
45257static int
45258test_xmlXPathNextChild(void) {
45259 int test_ret = 0;
45260
William M. Brack21e4ef22005-01-02 09:53:13 +000045261#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045262 int mem_base;
45263 xmlNodePtr ret_val;
45264 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45265 int n_ctxt;
45266 xmlNodePtr cur; /* the current node in the traversal */
45267 int n_cur;
45268
45269 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45270 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45271 mem_base = xmlMemBlocks();
45272 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45273 cur = gen_xmlNodePtr(n_cur, 1);
45274
45275 ret_val = xmlXPathNextChild(ctxt, cur);
45276 desret_xmlNodePtr(ret_val);
45277 call_tests++;
45278 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45279 des_xmlNodePtr(n_cur, cur, 1);
45280 xmlResetLastError();
45281 if (mem_base != xmlMemBlocks()) {
45282 printf("Leak of %d blocks found in xmlXPathNextChild",
45283 xmlMemBlocks() - mem_base);
45284 test_ret++;
45285 printf(" %d", n_ctxt);
45286 printf(" %d", n_cur);
45287 printf("\n");
45288 }
45289 }
45290 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045291 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045292#endif
45293
Daniel Veillarda82b1822004-11-08 16:24:57 +000045294 return(test_ret);
45295}
45296
45297
45298static int
45299test_xmlXPathNextDescendant(void) {
45300 int test_ret = 0;
45301
William M. Brack21e4ef22005-01-02 09:53:13 +000045302#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045303 int mem_base;
45304 xmlNodePtr ret_val;
45305 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45306 int n_ctxt;
45307 xmlNodePtr cur; /* the current node in the traversal */
45308 int n_cur;
45309
45310 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45311 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45312 mem_base = xmlMemBlocks();
45313 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45314 cur = gen_xmlNodePtr(n_cur, 1);
45315
45316 ret_val = xmlXPathNextDescendant(ctxt, cur);
45317 desret_xmlNodePtr(ret_val);
45318 call_tests++;
45319 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45320 des_xmlNodePtr(n_cur, cur, 1);
45321 xmlResetLastError();
45322 if (mem_base != xmlMemBlocks()) {
45323 printf("Leak of %d blocks found in xmlXPathNextDescendant",
45324 xmlMemBlocks() - mem_base);
45325 test_ret++;
45326 printf(" %d", n_ctxt);
45327 printf(" %d", n_cur);
45328 printf("\n");
45329 }
45330 }
45331 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045332 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045333#endif
45334
Daniel Veillarda82b1822004-11-08 16:24:57 +000045335 return(test_ret);
45336}
45337
45338
45339static int
45340test_xmlXPathNextDescendantOrSelf(void) {
45341 int test_ret = 0;
45342
William M. Brack21e4ef22005-01-02 09:53:13 +000045343#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045344 int mem_base;
45345 xmlNodePtr ret_val;
45346 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45347 int n_ctxt;
45348 xmlNodePtr cur; /* the current node in the traversal */
45349 int n_cur;
45350
45351 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45352 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45353 mem_base = xmlMemBlocks();
45354 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45355 cur = gen_xmlNodePtr(n_cur, 1);
45356
45357 ret_val = xmlXPathNextDescendantOrSelf(ctxt, cur);
45358 desret_xmlNodePtr(ret_val);
45359 call_tests++;
45360 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45361 des_xmlNodePtr(n_cur, cur, 1);
45362 xmlResetLastError();
45363 if (mem_base != xmlMemBlocks()) {
45364 printf("Leak of %d blocks found in xmlXPathNextDescendantOrSelf",
45365 xmlMemBlocks() - mem_base);
45366 test_ret++;
45367 printf(" %d", n_ctxt);
45368 printf(" %d", n_cur);
45369 printf("\n");
45370 }
45371 }
45372 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045373 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045374#endif
45375
Daniel Veillarda82b1822004-11-08 16:24:57 +000045376 return(test_ret);
45377}
45378
45379
45380static int
45381test_xmlXPathNextFollowing(void) {
45382 int test_ret = 0;
45383
William M. Brack21e4ef22005-01-02 09:53:13 +000045384#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045385 int mem_base;
45386 xmlNodePtr ret_val;
45387 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45388 int n_ctxt;
45389 xmlNodePtr cur; /* the current node in the traversal */
45390 int n_cur;
45391
45392 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45393 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45394 mem_base = xmlMemBlocks();
45395 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45396 cur = gen_xmlNodePtr(n_cur, 1);
45397
45398 ret_val = xmlXPathNextFollowing(ctxt, cur);
45399 desret_xmlNodePtr(ret_val);
45400 call_tests++;
45401 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45402 des_xmlNodePtr(n_cur, cur, 1);
45403 xmlResetLastError();
45404 if (mem_base != xmlMemBlocks()) {
45405 printf("Leak of %d blocks found in xmlXPathNextFollowing",
45406 xmlMemBlocks() - mem_base);
45407 test_ret++;
45408 printf(" %d", n_ctxt);
45409 printf(" %d", n_cur);
45410 printf("\n");
45411 }
45412 }
45413 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045414 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045415#endif
45416
Daniel Veillarda82b1822004-11-08 16:24:57 +000045417 return(test_ret);
45418}
45419
45420
45421static int
45422test_xmlXPathNextFollowingSibling(void) {
45423 int test_ret = 0;
45424
William M. Brack21e4ef22005-01-02 09:53:13 +000045425#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045426 int mem_base;
45427 xmlNodePtr ret_val;
45428 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45429 int n_ctxt;
45430 xmlNodePtr cur; /* the current node in the traversal */
45431 int n_cur;
45432
45433 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45434 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45435 mem_base = xmlMemBlocks();
45436 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45437 cur = gen_xmlNodePtr(n_cur, 1);
45438
45439 ret_val = xmlXPathNextFollowingSibling(ctxt, cur);
45440 desret_xmlNodePtr(ret_val);
45441 call_tests++;
45442 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45443 des_xmlNodePtr(n_cur, cur, 1);
45444 xmlResetLastError();
45445 if (mem_base != xmlMemBlocks()) {
45446 printf("Leak of %d blocks found in xmlXPathNextFollowingSibling",
45447 xmlMemBlocks() - mem_base);
45448 test_ret++;
45449 printf(" %d", n_ctxt);
45450 printf(" %d", n_cur);
45451 printf("\n");
45452 }
45453 }
45454 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045455 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045456#endif
45457
Daniel Veillarda82b1822004-11-08 16:24:57 +000045458 return(test_ret);
45459}
45460
45461
45462static int
45463test_xmlXPathNextNamespace(void) {
45464 int test_ret = 0;
45465
William M. Brack21e4ef22005-01-02 09:53:13 +000045466#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045467 int mem_base;
45468 xmlNodePtr ret_val;
45469 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45470 int n_ctxt;
45471 xmlNodePtr cur; /* the current attribute in the traversal */
45472 int n_cur;
45473
45474 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45475 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45476 mem_base = xmlMemBlocks();
45477 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45478 cur = gen_xmlNodePtr(n_cur, 1);
45479
45480 ret_val = xmlXPathNextNamespace(ctxt, cur);
45481 desret_xmlNodePtr(ret_val);
45482 call_tests++;
45483 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45484 des_xmlNodePtr(n_cur, cur, 1);
45485 xmlResetLastError();
45486 if (mem_base != xmlMemBlocks()) {
45487 printf("Leak of %d blocks found in xmlXPathNextNamespace",
45488 xmlMemBlocks() - mem_base);
45489 test_ret++;
45490 printf(" %d", n_ctxt);
45491 printf(" %d", n_cur);
45492 printf("\n");
45493 }
45494 }
45495 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045496 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045497#endif
45498
Daniel Veillarda82b1822004-11-08 16:24:57 +000045499 return(test_ret);
45500}
45501
45502
45503static int
45504test_xmlXPathNextParent(void) {
45505 int test_ret = 0;
45506
William M. Brack21e4ef22005-01-02 09:53:13 +000045507#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045508 int mem_base;
45509 xmlNodePtr ret_val;
45510 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45511 int n_ctxt;
45512 xmlNodePtr cur; /* the current node in the traversal */
45513 int n_cur;
45514
45515 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45516 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45517 mem_base = xmlMemBlocks();
45518 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45519 cur = gen_xmlNodePtr(n_cur, 1);
45520
45521 ret_val = xmlXPathNextParent(ctxt, cur);
45522 desret_xmlNodePtr(ret_val);
45523 call_tests++;
45524 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45525 des_xmlNodePtr(n_cur, cur, 1);
45526 xmlResetLastError();
45527 if (mem_base != xmlMemBlocks()) {
45528 printf("Leak of %d blocks found in xmlXPathNextParent",
45529 xmlMemBlocks() - mem_base);
45530 test_ret++;
45531 printf(" %d", n_ctxt);
45532 printf(" %d", n_cur);
45533 printf("\n");
45534 }
45535 }
45536 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045537 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045538#endif
45539
Daniel Veillarda82b1822004-11-08 16:24:57 +000045540 return(test_ret);
45541}
45542
45543
45544static int
45545test_xmlXPathNextPreceding(void) {
45546 int test_ret = 0;
45547
William M. Brack21e4ef22005-01-02 09:53:13 +000045548#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045549 int mem_base;
45550 xmlNodePtr ret_val;
45551 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45552 int n_ctxt;
45553 xmlNodePtr cur; /* the current node in the traversal */
45554 int n_cur;
45555
45556 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45557 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45558 mem_base = xmlMemBlocks();
45559 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45560 cur = gen_xmlNodePtr(n_cur, 1);
45561
45562 ret_val = xmlXPathNextPreceding(ctxt, cur);
45563 desret_xmlNodePtr(ret_val);
45564 call_tests++;
45565 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45566 des_xmlNodePtr(n_cur, cur, 1);
45567 xmlResetLastError();
45568 if (mem_base != xmlMemBlocks()) {
45569 printf("Leak of %d blocks found in xmlXPathNextPreceding",
45570 xmlMemBlocks() - mem_base);
45571 test_ret++;
45572 printf(" %d", n_ctxt);
45573 printf(" %d", n_cur);
45574 printf("\n");
45575 }
45576 }
45577 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045578 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045579#endif
45580
Daniel Veillarda82b1822004-11-08 16:24:57 +000045581 return(test_ret);
45582}
45583
45584
45585static int
45586test_xmlXPathNextPrecedingSibling(void) {
45587 int test_ret = 0;
45588
William M. Brack21e4ef22005-01-02 09:53:13 +000045589#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045590 int mem_base;
45591 xmlNodePtr ret_val;
45592 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45593 int n_ctxt;
45594 xmlNodePtr cur; /* the current node in the traversal */
45595 int n_cur;
45596
45597 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45598 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45599 mem_base = xmlMemBlocks();
45600 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45601 cur = gen_xmlNodePtr(n_cur, 1);
45602
45603 ret_val = xmlXPathNextPrecedingSibling(ctxt, cur);
45604 desret_xmlNodePtr(ret_val);
45605 call_tests++;
45606 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45607 des_xmlNodePtr(n_cur, cur, 1);
45608 xmlResetLastError();
45609 if (mem_base != xmlMemBlocks()) {
45610 printf("Leak of %d blocks found in xmlXPathNextPrecedingSibling",
45611 xmlMemBlocks() - mem_base);
45612 test_ret++;
45613 printf(" %d", n_ctxt);
45614 printf(" %d", n_cur);
45615 printf("\n");
45616 }
45617 }
45618 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045619 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045620#endif
45621
Daniel Veillarda82b1822004-11-08 16:24:57 +000045622 return(test_ret);
45623}
45624
45625
45626static int
45627test_xmlXPathNextSelf(void) {
45628 int test_ret = 0;
45629
William M. Brack21e4ef22005-01-02 09:53:13 +000045630#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045631 int mem_base;
45632 xmlNodePtr ret_val;
45633 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45634 int n_ctxt;
45635 xmlNodePtr cur; /* the current node in the traversal */
45636 int n_cur;
45637
45638 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45639 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45640 mem_base = xmlMemBlocks();
45641 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45642 cur = gen_xmlNodePtr(n_cur, 1);
45643
45644 ret_val = xmlXPathNextSelf(ctxt, cur);
45645 desret_xmlNodePtr(ret_val);
45646 call_tests++;
45647 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45648 des_xmlNodePtr(n_cur, cur, 1);
45649 xmlResetLastError();
45650 if (mem_base != xmlMemBlocks()) {
45651 printf("Leak of %d blocks found in xmlXPathNextSelf",
45652 xmlMemBlocks() - mem_base);
45653 test_ret++;
45654 printf(" %d", n_ctxt);
45655 printf(" %d", n_cur);
45656 printf("\n");
45657 }
45658 }
45659 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045660 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045661#endif
45662
Daniel Veillarda82b1822004-11-08 16:24:57 +000045663 return(test_ret);
45664}
45665
45666
45667static int
45668test_xmlXPathNodeLeading(void) {
45669 int test_ret = 0;
45670
William M. Brack21e4ef22005-01-02 09:53:13 +000045671#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045672 int mem_base;
45673 xmlNodeSetPtr ret_val;
45674 xmlNodeSetPtr nodes; /* a node-set */
45675 int n_nodes;
45676 xmlNodePtr node; /* a node */
45677 int n_node;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045678
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045679 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
45680 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
45681 mem_base = xmlMemBlocks();
45682 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
45683 node = gen_xmlNodePtr(n_node, 1);
45684
45685 ret_val = xmlXPathNodeLeading(nodes, node);
45686 desret_xmlNodeSetPtr(ret_val);
45687 call_tests++;
45688 des_xmlNodeSetPtr(n_nodes, nodes, 0);
45689 des_xmlNodePtr(n_node, node, 1);
45690 xmlResetLastError();
45691 if (mem_base != xmlMemBlocks()) {
45692 printf("Leak of %d blocks found in xmlXPathNodeLeading",
45693 xmlMemBlocks() - mem_base);
45694 test_ret++;
45695 printf(" %d", n_nodes);
45696 printf(" %d", n_node);
45697 printf("\n");
45698 }
45699 }
45700 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045701 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045702#endif
45703
Daniel Veillarda82b1822004-11-08 16:24:57 +000045704 return(test_ret);
45705}
45706
45707
45708static int
45709test_xmlXPathNodeLeadingSorted(void) {
45710 int test_ret = 0;
45711
William M. Brack21e4ef22005-01-02 09:53:13 +000045712#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045713 int mem_base;
45714 xmlNodeSetPtr ret_val;
45715 xmlNodeSetPtr nodes; /* a node-set, sorted by document order */
45716 int n_nodes;
45717 xmlNodePtr node; /* a node */
45718 int n_node;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045719
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045720 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
45721 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
45722 mem_base = xmlMemBlocks();
45723 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
45724 node = gen_xmlNodePtr(n_node, 1);
45725
45726 ret_val = xmlXPathNodeLeadingSorted(nodes, node);
45727 desret_xmlNodeSetPtr(ret_val);
45728 call_tests++;
45729 des_xmlNodeSetPtr(n_nodes, nodes, 0);
45730 des_xmlNodePtr(n_node, node, 1);
45731 xmlResetLastError();
45732 if (mem_base != xmlMemBlocks()) {
45733 printf("Leak of %d blocks found in xmlXPathNodeLeadingSorted",
45734 xmlMemBlocks() - mem_base);
45735 test_ret++;
45736 printf(" %d", n_nodes);
45737 printf(" %d", n_node);
45738 printf("\n");
45739 }
45740 }
45741 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045742 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045743#endif
45744
Daniel Veillarda82b1822004-11-08 16:24:57 +000045745 return(test_ret);
45746}
45747
45748
45749static int
45750test_xmlXPathNodeSetAdd(void) {
45751 int test_ret = 0;
45752
William M. Brack21e4ef22005-01-02 09:53:13 +000045753#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045754 int mem_base;
45755 xmlNodeSetPtr cur; /* the initial node set */
45756 int n_cur;
45757 xmlNodePtr val; /* a new xmlNodePtr */
45758 int n_val;
45759
45760 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
45761 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
45762 mem_base = xmlMemBlocks();
45763 cur = gen_xmlNodeSetPtr(n_cur, 0);
45764 val = gen_xmlNodePtr(n_val, 1);
45765
45766 xmlXPathNodeSetAdd(cur, val);
45767 call_tests++;
45768 des_xmlNodeSetPtr(n_cur, cur, 0);
45769 des_xmlNodePtr(n_val, val, 1);
45770 xmlResetLastError();
45771 if (mem_base != xmlMemBlocks()) {
45772 printf("Leak of %d blocks found in xmlXPathNodeSetAdd",
45773 xmlMemBlocks() - mem_base);
45774 test_ret++;
45775 printf(" %d", n_cur);
45776 printf(" %d", n_val);
45777 printf("\n");
45778 }
45779 }
45780 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045781 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045782#endif
45783
Daniel Veillarda82b1822004-11-08 16:24:57 +000045784 return(test_ret);
45785}
45786
45787
45788static int
45789test_xmlXPathNodeSetAddNs(void) {
45790 int test_ret = 0;
45791
William M. Brack21e4ef22005-01-02 09:53:13 +000045792#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045793 int mem_base;
45794 xmlNodeSetPtr cur; /* the initial node set */
45795 int n_cur;
45796 xmlNodePtr node; /* the hosting node */
45797 int n_node;
45798 xmlNsPtr ns; /* a the namespace node */
45799 int n_ns;
45800
45801 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
45802 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
45803 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
45804 mem_base = xmlMemBlocks();
45805 cur = gen_xmlNodeSetPtr(n_cur, 0);
45806 node = gen_xmlNodePtr(n_node, 1);
45807 ns = gen_xmlNsPtr(n_ns, 2);
45808
45809 xmlXPathNodeSetAddNs(cur, node, ns);
45810 call_tests++;
45811 des_xmlNodeSetPtr(n_cur, cur, 0);
45812 des_xmlNodePtr(n_node, node, 1);
45813 des_xmlNsPtr(n_ns, ns, 2);
45814 xmlResetLastError();
45815 if (mem_base != xmlMemBlocks()) {
45816 printf("Leak of %d blocks found in xmlXPathNodeSetAddNs",
45817 xmlMemBlocks() - mem_base);
45818 test_ret++;
45819 printf(" %d", n_cur);
45820 printf(" %d", n_node);
45821 printf(" %d", n_ns);
45822 printf("\n");
45823 }
45824 }
45825 }
45826 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045827 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045828#endif
45829
Daniel Veillarda82b1822004-11-08 16:24:57 +000045830 return(test_ret);
45831}
45832
45833
45834static int
45835test_xmlXPathNodeSetAddUnique(void) {
45836 int test_ret = 0;
45837
William M. Brack21e4ef22005-01-02 09:53:13 +000045838#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045839 int mem_base;
45840 xmlNodeSetPtr cur; /* the initial node set */
45841 int n_cur;
45842 xmlNodePtr val; /* a new xmlNodePtr */
45843 int n_val;
45844
45845 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
45846 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
45847 mem_base = xmlMemBlocks();
45848 cur = gen_xmlNodeSetPtr(n_cur, 0);
45849 val = gen_xmlNodePtr(n_val, 1);
45850
45851 xmlXPathNodeSetAddUnique(cur, val);
45852 call_tests++;
45853 des_xmlNodeSetPtr(n_cur, cur, 0);
45854 des_xmlNodePtr(n_val, val, 1);
45855 xmlResetLastError();
45856 if (mem_base != xmlMemBlocks()) {
45857 printf("Leak of %d blocks found in xmlXPathNodeSetAddUnique",
45858 xmlMemBlocks() - mem_base);
45859 test_ret++;
45860 printf(" %d", n_cur);
45861 printf(" %d", n_val);
45862 printf("\n");
45863 }
45864 }
45865 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045866 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045867#endif
45868
Daniel Veillarda82b1822004-11-08 16:24:57 +000045869 return(test_ret);
45870}
45871
45872
45873static int
45874test_xmlXPathNodeSetContains(void) {
45875 int test_ret = 0;
45876
William M. Brack21e4ef22005-01-02 09:53:13 +000045877#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045878 int mem_base;
45879 int ret_val;
45880 xmlNodeSetPtr cur; /* the node-set */
45881 int n_cur;
45882 xmlNodePtr val; /* the node */
45883 int n_val;
45884
45885 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
45886 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
45887 mem_base = xmlMemBlocks();
45888 cur = gen_xmlNodeSetPtr(n_cur, 0);
45889 val = gen_xmlNodePtr(n_val, 1);
45890
45891 ret_val = xmlXPathNodeSetContains(cur, val);
45892 desret_int(ret_val);
45893 call_tests++;
45894 des_xmlNodeSetPtr(n_cur, cur, 0);
45895 des_xmlNodePtr(n_val, val, 1);
45896 xmlResetLastError();
45897 if (mem_base != xmlMemBlocks()) {
45898 printf("Leak of %d blocks found in xmlXPathNodeSetContains",
45899 xmlMemBlocks() - mem_base);
45900 test_ret++;
45901 printf(" %d", n_cur);
45902 printf(" %d", n_val);
45903 printf("\n");
45904 }
45905 }
45906 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045907 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045908#endif
45909
Daniel Veillarda82b1822004-11-08 16:24:57 +000045910 return(test_ret);
45911}
45912
45913
45914static int
45915test_xmlXPathNodeSetDel(void) {
45916 int test_ret = 0;
45917
William M. Brack21e4ef22005-01-02 09:53:13 +000045918#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045919 int mem_base;
45920 xmlNodeSetPtr cur; /* the initial node set */
45921 int n_cur;
45922 xmlNodePtr val; /* an xmlNodePtr */
45923 int n_val;
45924
45925 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
45926 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
45927 mem_base = xmlMemBlocks();
45928 cur = gen_xmlNodeSetPtr(n_cur, 0);
45929 val = gen_xmlNodePtr(n_val, 1);
45930
45931 xmlXPathNodeSetDel(cur, val);
45932 call_tests++;
45933 des_xmlNodeSetPtr(n_cur, cur, 0);
45934 des_xmlNodePtr(n_val, val, 1);
45935 xmlResetLastError();
45936 if (mem_base != xmlMemBlocks()) {
45937 printf("Leak of %d blocks found in xmlXPathNodeSetDel",
45938 xmlMemBlocks() - mem_base);
45939 test_ret++;
45940 printf(" %d", n_cur);
45941 printf(" %d", n_val);
45942 printf("\n");
45943 }
45944 }
45945 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045946 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045947#endif
45948
Daniel Veillarda82b1822004-11-08 16:24:57 +000045949 return(test_ret);
45950}
45951
45952
45953static int
45954test_xmlXPathNodeSetMerge(void) {
45955 int test_ret = 0;
45956
William M. Brack21e4ef22005-01-02 09:53:13 +000045957#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045958 int mem_base;
45959 xmlNodeSetPtr ret_val;
45960 xmlNodeSetPtr val1; /* the first NodeSet or NULL */
45961 int n_val1;
45962 xmlNodeSetPtr val2; /* the second NodeSet */
45963 int n_val2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045964
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045965 for (n_val1 = 0;n_val1 < gen_nb_xmlNodeSetPtr;n_val1++) {
45966 for (n_val2 = 0;n_val2 < gen_nb_xmlNodeSetPtr;n_val2++) {
45967 mem_base = xmlMemBlocks();
45968 val1 = gen_xmlNodeSetPtr(n_val1, 0);
45969 val2 = gen_xmlNodeSetPtr(n_val2, 1);
45970
45971 ret_val = xmlXPathNodeSetMerge(val1, val2);
45972 desret_xmlNodeSetPtr(ret_val);
45973 call_tests++;
45974 des_xmlNodeSetPtr(n_val1, val1, 0);
45975 des_xmlNodeSetPtr(n_val2, val2, 1);
45976 xmlResetLastError();
45977 if (mem_base != xmlMemBlocks()) {
45978 printf("Leak of %d blocks found in xmlXPathNodeSetMerge",
45979 xmlMemBlocks() - mem_base);
45980 test_ret++;
45981 printf(" %d", n_val1);
45982 printf(" %d", n_val2);
45983 printf("\n");
45984 }
45985 }
45986 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045987 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045988#endif
45989
Daniel Veillarda82b1822004-11-08 16:24:57 +000045990 return(test_ret);
45991}
45992
45993
45994static int
45995test_xmlXPathNodeSetRemove(void) {
45996 int test_ret = 0;
45997
William M. Brack21e4ef22005-01-02 09:53:13 +000045998#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045999 int mem_base;
46000 xmlNodeSetPtr cur; /* the initial node set */
46001 int n_cur;
46002 int val; /* the index to remove */
46003 int n_val;
46004
46005 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
46006 for (n_val = 0;n_val < gen_nb_int;n_val++) {
46007 mem_base = xmlMemBlocks();
46008 cur = gen_xmlNodeSetPtr(n_cur, 0);
46009 val = gen_int(n_val, 1);
46010
46011 xmlXPathNodeSetRemove(cur, val);
46012 call_tests++;
46013 des_xmlNodeSetPtr(n_cur, cur, 0);
46014 des_int(n_val, val, 1);
46015 xmlResetLastError();
46016 if (mem_base != xmlMemBlocks()) {
46017 printf("Leak of %d blocks found in xmlXPathNodeSetRemove",
46018 xmlMemBlocks() - mem_base);
46019 test_ret++;
46020 printf(" %d", n_cur);
46021 printf(" %d", n_val);
46022 printf("\n");
46023 }
46024 }
46025 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046026 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046027#endif
46028
Daniel Veillarda82b1822004-11-08 16:24:57 +000046029 return(test_ret);
46030}
46031
46032
46033static int
46034test_xmlXPathNodeSetSort(void) {
46035 int test_ret = 0;
46036
William M. Brack21e4ef22005-01-02 09:53:13 +000046037#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046038 int mem_base;
46039 xmlNodeSetPtr set; /* the node set */
46040 int n_set;
46041
46042 for (n_set = 0;n_set < gen_nb_xmlNodeSetPtr;n_set++) {
46043 mem_base = xmlMemBlocks();
46044 set = gen_xmlNodeSetPtr(n_set, 0);
46045
46046 xmlXPathNodeSetSort(set);
46047 call_tests++;
46048 des_xmlNodeSetPtr(n_set, set, 0);
46049 xmlResetLastError();
46050 if (mem_base != xmlMemBlocks()) {
46051 printf("Leak of %d blocks found in xmlXPathNodeSetSort",
46052 xmlMemBlocks() - mem_base);
46053 test_ret++;
46054 printf(" %d", n_set);
46055 printf("\n");
46056 }
46057 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046058 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046059#endif
46060
Daniel Veillarda82b1822004-11-08 16:24:57 +000046061 return(test_ret);
46062}
46063
46064
46065static int
46066test_xmlXPathNodeTrailing(void) {
46067 int test_ret = 0;
46068
William M. Brack21e4ef22005-01-02 09:53:13 +000046069#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046070 int mem_base;
46071 xmlNodeSetPtr ret_val;
46072 xmlNodeSetPtr nodes; /* a node-set */
46073 int n_nodes;
46074 xmlNodePtr node; /* a node */
46075 int n_node;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046076
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046077 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
46078 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
46079 mem_base = xmlMemBlocks();
46080 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
46081 node = gen_xmlNodePtr(n_node, 1);
46082
46083 ret_val = xmlXPathNodeTrailing(nodes, node);
46084 desret_xmlNodeSetPtr(ret_val);
46085 call_tests++;
46086 des_xmlNodeSetPtr(n_nodes, nodes, 0);
46087 des_xmlNodePtr(n_node, node, 1);
46088 xmlResetLastError();
46089 if (mem_base != xmlMemBlocks()) {
46090 printf("Leak of %d blocks found in xmlXPathNodeTrailing",
46091 xmlMemBlocks() - mem_base);
46092 test_ret++;
46093 printf(" %d", n_nodes);
46094 printf(" %d", n_node);
46095 printf("\n");
46096 }
46097 }
46098 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046099 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046100#endif
46101
Daniel Veillarda82b1822004-11-08 16:24:57 +000046102 return(test_ret);
46103}
46104
46105
46106static int
46107test_xmlXPathNodeTrailingSorted(void) {
46108 int test_ret = 0;
46109
William M. Brack21e4ef22005-01-02 09:53:13 +000046110#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046111 int mem_base;
46112 xmlNodeSetPtr ret_val;
46113 xmlNodeSetPtr nodes; /* a node-set, sorted by document order */
46114 int n_nodes;
46115 xmlNodePtr node; /* a node */
46116 int n_node;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046117
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046118 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
46119 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
46120 mem_base = xmlMemBlocks();
46121 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
46122 node = gen_xmlNodePtr(n_node, 1);
46123
46124 ret_val = xmlXPathNodeTrailingSorted(nodes, node);
46125 desret_xmlNodeSetPtr(ret_val);
46126 call_tests++;
46127 des_xmlNodeSetPtr(n_nodes, nodes, 0);
46128 des_xmlNodePtr(n_node, node, 1);
46129 xmlResetLastError();
46130 if (mem_base != xmlMemBlocks()) {
46131 printf("Leak of %d blocks found in xmlXPathNodeTrailingSorted",
46132 xmlMemBlocks() - mem_base);
46133 test_ret++;
46134 printf(" %d", n_nodes);
46135 printf(" %d", n_node);
46136 printf("\n");
46137 }
46138 }
46139 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046140 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046141#endif
46142
Daniel Veillarda82b1822004-11-08 16:24:57 +000046143 return(test_ret);
46144}
46145
46146
46147static int
46148test_xmlXPathNormalizeFunction(void) {
46149 int test_ret = 0;
46150
William M. Brack21e4ef22005-01-02 09:53:13 +000046151#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046152 int mem_base;
46153 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46154 int n_ctxt;
46155 int nargs; /* the number of arguments */
46156 int n_nargs;
46157
46158 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46159 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46160 mem_base = xmlMemBlocks();
46161 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46162 nargs = gen_int(n_nargs, 1);
46163
46164 xmlXPathNormalizeFunction(ctxt, nargs);
46165 call_tests++;
46166 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46167 des_int(n_nargs, nargs, 1);
46168 xmlResetLastError();
46169 if (mem_base != xmlMemBlocks()) {
46170 printf("Leak of %d blocks found in xmlXPathNormalizeFunction",
46171 xmlMemBlocks() - mem_base);
46172 test_ret++;
46173 printf(" %d", n_ctxt);
46174 printf(" %d", n_nargs);
46175 printf("\n");
46176 }
46177 }
46178 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046179 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046180#endif
46181
Daniel Veillarda82b1822004-11-08 16:24:57 +000046182 return(test_ret);
46183}
46184
46185
46186static int
46187test_xmlXPathNotEqualValues(void) {
46188 int test_ret = 0;
46189
William M. Brack21e4ef22005-01-02 09:53:13 +000046190#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046191 int mem_base;
46192 int ret_val;
46193 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46194 int n_ctxt;
46195
46196 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46197 mem_base = xmlMemBlocks();
46198 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46199
46200 ret_val = xmlXPathNotEqualValues(ctxt);
46201 desret_int(ret_val);
46202 call_tests++;
46203 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46204 xmlResetLastError();
46205 if (mem_base != xmlMemBlocks()) {
46206 printf("Leak of %d blocks found in xmlXPathNotEqualValues",
46207 xmlMemBlocks() - mem_base);
46208 test_ret++;
46209 printf(" %d", n_ctxt);
46210 printf("\n");
46211 }
46212 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046213 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046214#endif
46215
Daniel Veillarda82b1822004-11-08 16:24:57 +000046216 return(test_ret);
46217}
46218
46219
46220static int
46221test_xmlXPathNotFunction(void) {
46222 int test_ret = 0;
46223
William M. Brack21e4ef22005-01-02 09:53:13 +000046224#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046225 int mem_base;
46226 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46227 int n_ctxt;
46228 int nargs; /* the number of arguments */
46229 int n_nargs;
46230
46231 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46232 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46233 mem_base = xmlMemBlocks();
46234 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46235 nargs = gen_int(n_nargs, 1);
46236
46237 xmlXPathNotFunction(ctxt, nargs);
46238 call_tests++;
46239 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46240 des_int(n_nargs, nargs, 1);
46241 xmlResetLastError();
46242 if (mem_base != xmlMemBlocks()) {
46243 printf("Leak of %d blocks found in xmlXPathNotFunction",
46244 xmlMemBlocks() - mem_base);
46245 test_ret++;
46246 printf(" %d", n_ctxt);
46247 printf(" %d", n_nargs);
46248 printf("\n");
46249 }
46250 }
46251 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046252 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046253#endif
46254
Daniel Veillarda82b1822004-11-08 16:24:57 +000046255 return(test_ret);
46256}
46257
46258
46259static int
46260test_xmlXPathNsLookup(void) {
46261 int test_ret = 0;
46262
William M. Brack21e4ef22005-01-02 09:53:13 +000046263#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046264 int mem_base;
46265 const xmlChar * ret_val;
46266 xmlXPathContextPtr ctxt; /* the XPath context */
46267 int n_ctxt;
46268 xmlChar * prefix; /* the namespace prefix value */
46269 int n_prefix;
46270
46271 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46272 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
46273 mem_base = xmlMemBlocks();
46274 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46275 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
46276
William M. Brackf13f77f2004-11-12 16:03:48 +000046277 ret_val = xmlXPathNsLookup(ctxt, (const xmlChar *)prefix);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046278 desret_const_xmlChar_ptr(ret_val);
46279 call_tests++;
46280 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000046281 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046282 xmlResetLastError();
46283 if (mem_base != xmlMemBlocks()) {
46284 printf("Leak of %d blocks found in xmlXPathNsLookup",
46285 xmlMemBlocks() - mem_base);
46286 test_ret++;
46287 printf(" %d", n_ctxt);
46288 printf(" %d", n_prefix);
46289 printf("\n");
46290 }
46291 }
46292 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046293 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046294#endif
46295
Daniel Veillarda82b1822004-11-08 16:24:57 +000046296 return(test_ret);
46297}
46298
46299
46300static int
46301test_xmlXPathNumberFunction(void) {
46302 int test_ret = 0;
46303
William M. Brack21e4ef22005-01-02 09:53:13 +000046304#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046305 int mem_base;
46306 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46307 int n_ctxt;
46308 int nargs; /* the number of arguments */
46309 int n_nargs;
46310
46311 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46312 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46313 mem_base = xmlMemBlocks();
46314 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46315 nargs = gen_int(n_nargs, 1);
46316
46317 xmlXPathNumberFunction(ctxt, nargs);
46318 call_tests++;
46319 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46320 des_int(n_nargs, nargs, 1);
46321 xmlResetLastError();
46322 if (mem_base != xmlMemBlocks()) {
46323 printf("Leak of %d blocks found in xmlXPathNumberFunction",
46324 xmlMemBlocks() - mem_base);
46325 test_ret++;
46326 printf(" %d", n_ctxt);
46327 printf(" %d", n_nargs);
46328 printf("\n");
46329 }
46330 }
46331 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046332 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046333#endif
46334
Daniel Veillarda82b1822004-11-08 16:24:57 +000046335 return(test_ret);
46336}
46337
46338
46339static int
46340test_xmlXPathParseNCName(void) {
46341 int test_ret = 0;
46342
William M. Brack21e4ef22005-01-02 09:53:13 +000046343#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046344 int mem_base;
46345 xmlChar * ret_val;
46346 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46347 int n_ctxt;
46348
46349 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46350 mem_base = xmlMemBlocks();
46351 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46352
46353 ret_val = xmlXPathParseNCName(ctxt);
46354 desret_xmlChar_ptr(ret_val);
46355 call_tests++;
46356 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46357 xmlResetLastError();
46358 if (mem_base != xmlMemBlocks()) {
46359 printf("Leak of %d blocks found in xmlXPathParseNCName",
46360 xmlMemBlocks() - mem_base);
46361 test_ret++;
46362 printf(" %d", n_ctxt);
46363 printf("\n");
46364 }
46365 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046366 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046367#endif
46368
Daniel Veillarda82b1822004-11-08 16:24:57 +000046369 return(test_ret);
46370}
46371
46372
46373static int
46374test_xmlXPathParseName(void) {
46375 int test_ret = 0;
46376
William M. Brack21e4ef22005-01-02 09:53:13 +000046377#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046378 int mem_base;
46379 xmlChar * ret_val;
46380 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46381 int n_ctxt;
46382
46383 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46384 mem_base = xmlMemBlocks();
46385 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46386
46387 ret_val = xmlXPathParseName(ctxt);
46388 desret_xmlChar_ptr(ret_val);
46389 call_tests++;
46390 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46391 xmlResetLastError();
46392 if (mem_base != xmlMemBlocks()) {
46393 printf("Leak of %d blocks found in xmlXPathParseName",
46394 xmlMemBlocks() - mem_base);
46395 test_ret++;
46396 printf(" %d", n_ctxt);
46397 printf("\n");
46398 }
46399 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046400 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046401#endif
46402
Daniel Veillarda82b1822004-11-08 16:24:57 +000046403 return(test_ret);
46404}
46405
46406
46407static int
46408test_xmlXPathPopBoolean(void) {
46409 int test_ret = 0;
46410
William M. Brack21e4ef22005-01-02 09:53:13 +000046411#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046412 int mem_base;
46413 int ret_val;
46414 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
46415 int n_ctxt;
46416
46417 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46418 mem_base = xmlMemBlocks();
46419 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46420
46421 ret_val = xmlXPathPopBoolean(ctxt);
46422 desret_int(ret_val);
46423 call_tests++;
46424 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46425 xmlResetLastError();
46426 if (mem_base != xmlMemBlocks()) {
46427 printf("Leak of %d blocks found in xmlXPathPopBoolean",
46428 xmlMemBlocks() - mem_base);
46429 test_ret++;
46430 printf(" %d", n_ctxt);
46431 printf("\n");
46432 }
46433 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046434 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046435#endif
46436
Daniel Veillarda82b1822004-11-08 16:24:57 +000046437 return(test_ret);
46438}
46439
46440
46441static int
46442test_xmlXPathPopExternal(void) {
46443 int test_ret = 0;
46444
William M. Brack21e4ef22005-01-02 09:53:13 +000046445#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046446 int mem_base;
46447 void * ret_val;
46448 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
46449 int n_ctxt;
46450
46451 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46452 mem_base = xmlMemBlocks();
46453 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46454
46455 ret_val = xmlXPathPopExternal(ctxt);
46456 desret_void_ptr(ret_val);
46457 call_tests++;
46458 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46459 xmlResetLastError();
46460 if (mem_base != xmlMemBlocks()) {
46461 printf("Leak of %d blocks found in xmlXPathPopExternal",
46462 xmlMemBlocks() - mem_base);
46463 test_ret++;
46464 printf(" %d", n_ctxt);
46465 printf("\n");
46466 }
46467 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046468 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046469#endif
46470
Daniel Veillarda82b1822004-11-08 16:24:57 +000046471 return(test_ret);
46472}
46473
46474
46475static int
46476test_xmlXPathPopNodeSet(void) {
46477 int test_ret = 0;
46478
William M. Brack21e4ef22005-01-02 09:53:13 +000046479#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046480 int mem_base;
46481 xmlNodeSetPtr ret_val;
46482 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
46483 int n_ctxt;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046484
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046485 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46486 mem_base = xmlMemBlocks();
46487 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46488
46489 ret_val = xmlXPathPopNodeSet(ctxt);
46490 desret_xmlNodeSetPtr(ret_val);
46491 call_tests++;
46492 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46493 xmlResetLastError();
46494 if (mem_base != xmlMemBlocks()) {
46495 printf("Leak of %d blocks found in xmlXPathPopNodeSet",
46496 xmlMemBlocks() - mem_base);
46497 test_ret++;
46498 printf(" %d", n_ctxt);
46499 printf("\n");
46500 }
46501 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046502 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046503#endif
46504
Daniel Veillarda82b1822004-11-08 16:24:57 +000046505 return(test_ret);
46506}
46507
46508
46509static int
46510test_xmlXPathPopNumber(void) {
46511 int test_ret = 0;
46512
William M. Brack21e4ef22005-01-02 09:53:13 +000046513#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046514 int mem_base;
46515 double ret_val;
46516 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
46517 int n_ctxt;
46518
46519 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46520 mem_base = xmlMemBlocks();
46521 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46522
46523 ret_val = xmlXPathPopNumber(ctxt);
46524 desret_double(ret_val);
46525 call_tests++;
46526 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46527 xmlResetLastError();
46528 if (mem_base != xmlMemBlocks()) {
46529 printf("Leak of %d blocks found in xmlXPathPopNumber",
46530 xmlMemBlocks() - mem_base);
46531 test_ret++;
46532 printf(" %d", n_ctxt);
46533 printf("\n");
46534 }
46535 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046536 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046537#endif
46538
Daniel Veillarda82b1822004-11-08 16:24:57 +000046539 return(test_ret);
46540}
46541
46542
46543static int
46544test_xmlXPathPopString(void) {
46545 int test_ret = 0;
46546
William M. Brack21e4ef22005-01-02 09:53:13 +000046547#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046548 int mem_base;
46549 xmlChar * ret_val;
46550 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
46551 int n_ctxt;
46552
46553 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46554 mem_base = xmlMemBlocks();
46555 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46556
46557 ret_val = xmlXPathPopString(ctxt);
46558 desret_xmlChar_ptr(ret_val);
46559 call_tests++;
46560 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46561 xmlResetLastError();
46562 if (mem_base != xmlMemBlocks()) {
46563 printf("Leak of %d blocks found in xmlXPathPopString",
46564 xmlMemBlocks() - mem_base);
46565 test_ret++;
46566 printf(" %d", n_ctxt);
46567 printf("\n");
46568 }
46569 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046570 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046571#endif
46572
Daniel Veillarda82b1822004-11-08 16:24:57 +000046573 return(test_ret);
46574}
46575
46576
46577static int
46578test_xmlXPathPositionFunction(void) {
46579 int test_ret = 0;
46580
William M. Brack21e4ef22005-01-02 09:53:13 +000046581#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046582 int mem_base;
46583 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46584 int n_ctxt;
46585 int nargs; /* the number of arguments */
46586 int n_nargs;
46587
46588 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46589 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46590 mem_base = xmlMemBlocks();
46591 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46592 nargs = gen_int(n_nargs, 1);
46593
46594 xmlXPathPositionFunction(ctxt, nargs);
46595 call_tests++;
46596 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46597 des_int(n_nargs, nargs, 1);
46598 xmlResetLastError();
46599 if (mem_base != xmlMemBlocks()) {
46600 printf("Leak of %d blocks found in xmlXPathPositionFunction",
46601 xmlMemBlocks() - mem_base);
46602 test_ret++;
46603 printf(" %d", n_ctxt);
46604 printf(" %d", n_nargs);
46605 printf("\n");
46606 }
46607 }
46608 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046609 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046610#endif
46611
Daniel Veillarda82b1822004-11-08 16:24:57 +000046612 return(test_ret);
46613}
46614
46615
46616static int
46617test_xmlXPathRegisterAllFunctions(void) {
46618 int test_ret = 0;
46619
William M. Brack21e4ef22005-01-02 09:53:13 +000046620#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046621 int mem_base;
46622 xmlXPathContextPtr ctxt; /* the XPath context */
46623 int n_ctxt;
46624
46625 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46626 mem_base = xmlMemBlocks();
46627 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46628
46629 xmlXPathRegisterAllFunctions(ctxt);
46630 call_tests++;
46631 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
46632 xmlResetLastError();
46633 if (mem_base != xmlMemBlocks()) {
46634 printf("Leak of %d blocks found in xmlXPathRegisterAllFunctions",
46635 xmlMemBlocks() - mem_base);
46636 test_ret++;
46637 printf(" %d", n_ctxt);
46638 printf("\n");
46639 }
46640 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046641 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046642#endif
46643
Daniel Veillarda82b1822004-11-08 16:24:57 +000046644 return(test_ret);
46645}
46646
46647
46648static int
46649test_xmlXPathRegisterFunc(void) {
46650 int test_ret = 0;
46651
46652
46653 /* missing type support */
46654 return(test_ret);
46655}
46656
46657
46658static int
46659test_xmlXPathRegisterFuncLookup(void) {
46660 int test_ret = 0;
46661
46662
46663 /* missing type support */
46664 return(test_ret);
46665}
46666
46667
46668static int
46669test_xmlXPathRegisterFuncNS(void) {
46670 int test_ret = 0;
46671
46672
46673 /* missing type support */
46674 return(test_ret);
46675}
46676
46677
46678static int
46679test_xmlXPathRegisterNs(void) {
46680 int test_ret = 0;
46681
William M. Brack21e4ef22005-01-02 09:53:13 +000046682#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046683 int mem_base;
46684 int ret_val;
46685 xmlXPathContextPtr ctxt; /* the XPath context */
46686 int n_ctxt;
46687 xmlChar * prefix; /* the namespace prefix */
46688 int n_prefix;
46689 xmlChar * ns_uri; /* the namespace name */
46690 int n_ns_uri;
46691
46692 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46693 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
46694 for (n_ns_uri = 0;n_ns_uri < gen_nb_const_xmlChar_ptr;n_ns_uri++) {
46695 mem_base = xmlMemBlocks();
46696 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46697 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
46698 ns_uri = gen_const_xmlChar_ptr(n_ns_uri, 2);
46699
William M. Brackf13f77f2004-11-12 16:03:48 +000046700 ret_val = xmlXPathRegisterNs(ctxt, (const xmlChar *)prefix, (const xmlChar *)ns_uri);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046701 desret_int(ret_val);
46702 call_tests++;
46703 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000046704 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
46705 des_const_xmlChar_ptr(n_ns_uri, (const xmlChar *)ns_uri, 2);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046706 xmlResetLastError();
46707 if (mem_base != xmlMemBlocks()) {
46708 printf("Leak of %d blocks found in xmlXPathRegisterNs",
46709 xmlMemBlocks() - mem_base);
46710 test_ret++;
46711 printf(" %d", n_ctxt);
46712 printf(" %d", n_prefix);
46713 printf(" %d", n_ns_uri);
46714 printf("\n");
46715 }
46716 }
46717 }
46718 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046719 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046720#endif
46721
Daniel Veillarda82b1822004-11-08 16:24:57 +000046722 return(test_ret);
46723}
46724
46725
46726static int
46727test_xmlXPathRegisterVariable(void) {
46728 int test_ret = 0;
46729
William M. Brack21e4ef22005-01-02 09:53:13 +000046730#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046731 int mem_base;
46732 int ret_val;
46733 xmlXPathContextPtr ctxt; /* the XPath context */
46734 int n_ctxt;
46735 xmlChar * name; /* the variable name */
46736 int n_name;
46737 xmlXPathObjectPtr value; /* the variable value or NULL */
46738 int n_value;
46739
46740 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46741 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
46742 for (n_value = 0;n_value < gen_nb_xmlXPathObjectPtr;n_value++) {
46743 mem_base = xmlMemBlocks();
46744 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46745 name = gen_const_xmlChar_ptr(n_name, 1);
46746 value = gen_xmlXPathObjectPtr(n_value, 2);
46747
William M. Brackf13f77f2004-11-12 16:03:48 +000046748 ret_val = xmlXPathRegisterVariable(ctxt, (const xmlChar *)name, value);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046749 desret_int(ret_val);
46750 call_tests++;
46751 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000046752 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046753 des_xmlXPathObjectPtr(n_value, value, 2);
46754 xmlResetLastError();
46755 if (mem_base != xmlMemBlocks()) {
46756 printf("Leak of %d blocks found in xmlXPathRegisterVariable",
46757 xmlMemBlocks() - mem_base);
46758 test_ret++;
46759 printf(" %d", n_ctxt);
46760 printf(" %d", n_name);
46761 printf(" %d", n_value);
46762 printf("\n");
46763 }
46764 }
46765 }
46766 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046767 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046768#endif
46769
Daniel Veillarda82b1822004-11-08 16:24:57 +000046770 return(test_ret);
46771}
46772
46773
46774static int
46775test_xmlXPathRegisterVariableLookup(void) {
46776 int test_ret = 0;
46777
46778
46779 /* missing type support */
46780 return(test_ret);
46781}
46782
46783
46784static int
46785test_xmlXPathRegisterVariableNS(void) {
46786 int test_ret = 0;
46787
William M. Brack21e4ef22005-01-02 09:53:13 +000046788#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046789 int mem_base;
46790 int ret_val;
46791 xmlXPathContextPtr ctxt; /* the XPath context */
46792 int n_ctxt;
46793 xmlChar * name; /* the variable name */
46794 int n_name;
46795 xmlChar * ns_uri; /* the variable namespace URI */
46796 int n_ns_uri;
46797 xmlXPathObjectPtr value; /* the variable value or NULL */
46798 int n_value;
46799
46800 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46801 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
46802 for (n_ns_uri = 0;n_ns_uri < gen_nb_const_xmlChar_ptr;n_ns_uri++) {
46803 for (n_value = 0;n_value < gen_nb_xmlXPathObjectPtr;n_value++) {
46804 mem_base = xmlMemBlocks();
46805 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46806 name = gen_const_xmlChar_ptr(n_name, 1);
46807 ns_uri = gen_const_xmlChar_ptr(n_ns_uri, 2);
46808 value = gen_xmlXPathObjectPtr(n_value, 3);
46809
William M. Brackf13f77f2004-11-12 16:03:48 +000046810 ret_val = xmlXPathRegisterVariableNS(ctxt, (const xmlChar *)name, (const xmlChar *)ns_uri, value);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046811 desret_int(ret_val);
46812 call_tests++;
46813 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000046814 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
46815 des_const_xmlChar_ptr(n_ns_uri, (const xmlChar *)ns_uri, 2);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046816 des_xmlXPathObjectPtr(n_value, value, 3);
46817 xmlResetLastError();
46818 if (mem_base != xmlMemBlocks()) {
46819 printf("Leak of %d blocks found in xmlXPathRegisterVariableNS",
46820 xmlMemBlocks() - mem_base);
46821 test_ret++;
46822 printf(" %d", n_ctxt);
46823 printf(" %d", n_name);
46824 printf(" %d", n_ns_uri);
46825 printf(" %d", n_value);
46826 printf("\n");
46827 }
46828 }
46829 }
46830 }
46831 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046832 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046833#endif
46834
Daniel Veillarda82b1822004-11-08 16:24:57 +000046835 return(test_ret);
46836}
46837
46838
46839static int
46840test_xmlXPathRegisteredFuncsCleanup(void) {
46841 int test_ret = 0;
46842
William M. Brack21e4ef22005-01-02 09:53:13 +000046843#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046844 int mem_base;
46845 xmlXPathContextPtr ctxt; /* the XPath context */
46846 int n_ctxt;
46847
46848 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46849 mem_base = xmlMemBlocks();
46850 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46851
46852 xmlXPathRegisteredFuncsCleanup(ctxt);
46853 call_tests++;
46854 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
46855 xmlResetLastError();
46856 if (mem_base != xmlMemBlocks()) {
46857 printf("Leak of %d blocks found in xmlXPathRegisteredFuncsCleanup",
46858 xmlMemBlocks() - mem_base);
46859 test_ret++;
46860 printf(" %d", n_ctxt);
46861 printf("\n");
46862 }
46863 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046864 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046865#endif
46866
Daniel Veillarda82b1822004-11-08 16:24:57 +000046867 return(test_ret);
46868}
46869
46870
46871static int
46872test_xmlXPathRegisteredNsCleanup(void) {
46873 int test_ret = 0;
46874
William M. Brack21e4ef22005-01-02 09:53:13 +000046875#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046876 int mem_base;
46877 xmlXPathContextPtr ctxt; /* the XPath context */
46878 int n_ctxt;
46879
46880 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46881 mem_base = xmlMemBlocks();
46882 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46883
46884 xmlXPathRegisteredNsCleanup(ctxt);
46885 call_tests++;
46886 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
46887 xmlResetLastError();
46888 if (mem_base != xmlMemBlocks()) {
46889 printf("Leak of %d blocks found in xmlXPathRegisteredNsCleanup",
46890 xmlMemBlocks() - mem_base);
46891 test_ret++;
46892 printf(" %d", n_ctxt);
46893 printf("\n");
46894 }
46895 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046896 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046897#endif
46898
Daniel Veillarda82b1822004-11-08 16:24:57 +000046899 return(test_ret);
46900}
46901
46902
46903static int
46904test_xmlXPathRegisteredVariablesCleanup(void) {
46905 int test_ret = 0;
46906
William M. Brack21e4ef22005-01-02 09:53:13 +000046907#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046908 int mem_base;
46909 xmlXPathContextPtr ctxt; /* the XPath context */
46910 int n_ctxt;
46911
46912 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46913 mem_base = xmlMemBlocks();
46914 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46915
46916 xmlXPathRegisteredVariablesCleanup(ctxt);
46917 call_tests++;
46918 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
46919 xmlResetLastError();
46920 if (mem_base != xmlMemBlocks()) {
46921 printf("Leak of %d blocks found in xmlXPathRegisteredVariablesCleanup",
46922 xmlMemBlocks() - mem_base);
46923 test_ret++;
46924 printf(" %d", n_ctxt);
46925 printf("\n");
46926 }
46927 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046928 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046929#endif
46930
Daniel Veillarda82b1822004-11-08 16:24:57 +000046931 return(test_ret);
46932}
46933
46934
46935static int
46936test_xmlXPathRoot(void) {
46937 int test_ret = 0;
46938
William M. Brack21e4ef22005-01-02 09:53:13 +000046939#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046940 int mem_base;
46941 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46942 int n_ctxt;
46943
46944 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46945 mem_base = xmlMemBlocks();
46946 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46947
46948 xmlXPathRoot(ctxt);
46949 call_tests++;
46950 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46951 xmlResetLastError();
46952 if (mem_base != xmlMemBlocks()) {
46953 printf("Leak of %d blocks found in xmlXPathRoot",
46954 xmlMemBlocks() - mem_base);
46955 test_ret++;
46956 printf(" %d", n_ctxt);
46957 printf("\n");
46958 }
46959 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046960 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046961#endif
46962
Daniel Veillarda82b1822004-11-08 16:24:57 +000046963 return(test_ret);
46964}
46965
46966
46967static int
46968test_xmlXPathRoundFunction(void) {
46969 int test_ret = 0;
46970
William M. Brack21e4ef22005-01-02 09:53:13 +000046971#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046972 int mem_base;
46973 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46974 int n_ctxt;
46975 int nargs; /* the number of arguments */
46976 int n_nargs;
46977
46978 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46979 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46980 mem_base = xmlMemBlocks();
46981 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46982 nargs = gen_int(n_nargs, 1);
46983
46984 xmlXPathRoundFunction(ctxt, nargs);
46985 call_tests++;
46986 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46987 des_int(n_nargs, nargs, 1);
46988 xmlResetLastError();
46989 if (mem_base != xmlMemBlocks()) {
46990 printf("Leak of %d blocks found in xmlXPathRoundFunction",
46991 xmlMemBlocks() - mem_base);
46992 test_ret++;
46993 printf(" %d", n_ctxt);
46994 printf(" %d", n_nargs);
46995 printf("\n");
46996 }
46997 }
46998 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046999 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047000#endif
47001
Daniel Veillarda82b1822004-11-08 16:24:57 +000047002 return(test_ret);
47003}
47004
47005
47006static int
47007test_xmlXPathStartsWithFunction(void) {
47008 int test_ret = 0;
47009
William M. Brack21e4ef22005-01-02 09:53:13 +000047010#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047011 int mem_base;
47012 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47013 int n_ctxt;
47014 int nargs; /* the number of arguments */
47015 int n_nargs;
47016
47017 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47018 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47019 mem_base = xmlMemBlocks();
47020 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47021 nargs = gen_int(n_nargs, 1);
47022
47023 xmlXPathStartsWithFunction(ctxt, nargs);
47024 call_tests++;
47025 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47026 des_int(n_nargs, nargs, 1);
47027 xmlResetLastError();
47028 if (mem_base != xmlMemBlocks()) {
47029 printf("Leak of %d blocks found in xmlXPathStartsWithFunction",
47030 xmlMemBlocks() - mem_base);
47031 test_ret++;
47032 printf(" %d", n_ctxt);
47033 printf(" %d", n_nargs);
47034 printf("\n");
47035 }
47036 }
47037 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047038 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047039#endif
47040
Daniel Veillarda82b1822004-11-08 16:24:57 +000047041 return(test_ret);
47042}
47043
47044
47045static int
47046test_xmlXPathStringEvalNumber(void) {
47047 int test_ret = 0;
47048
William M. Brack21e4ef22005-01-02 09:53:13 +000047049#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047050 int mem_base;
47051 double ret_val;
47052 xmlChar * str; /* A string to scan */
47053 int n_str;
47054
47055 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
47056 mem_base = xmlMemBlocks();
47057 str = gen_const_xmlChar_ptr(n_str, 0);
47058
William M. Brackf13f77f2004-11-12 16:03:48 +000047059 ret_val = xmlXPathStringEvalNumber((const xmlChar *)str);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047060 desret_double(ret_val);
47061 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000047062 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047063 xmlResetLastError();
47064 if (mem_base != xmlMemBlocks()) {
47065 printf("Leak of %d blocks found in xmlXPathStringEvalNumber",
47066 xmlMemBlocks() - mem_base);
47067 test_ret++;
47068 printf(" %d", n_str);
47069 printf("\n");
47070 }
47071 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047072 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047073#endif
47074
Daniel Veillarda82b1822004-11-08 16:24:57 +000047075 return(test_ret);
47076}
47077
47078
47079static int
47080test_xmlXPathStringFunction(void) {
47081 int test_ret = 0;
47082
William M. Brack21e4ef22005-01-02 09:53:13 +000047083#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047084 int mem_base;
47085 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47086 int n_ctxt;
47087 int nargs; /* the number of arguments */
47088 int n_nargs;
47089
47090 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47091 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47092 mem_base = xmlMemBlocks();
47093 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47094 nargs = gen_int(n_nargs, 1);
47095
47096 xmlXPathStringFunction(ctxt, nargs);
47097 call_tests++;
47098 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47099 des_int(n_nargs, nargs, 1);
47100 xmlResetLastError();
47101 if (mem_base != xmlMemBlocks()) {
47102 printf("Leak of %d blocks found in xmlXPathStringFunction",
47103 xmlMemBlocks() - mem_base);
47104 test_ret++;
47105 printf(" %d", n_ctxt);
47106 printf(" %d", n_nargs);
47107 printf("\n");
47108 }
47109 }
47110 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047111 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047112#endif
47113
Daniel Veillarda82b1822004-11-08 16:24:57 +000047114 return(test_ret);
47115}
47116
47117
47118static int
47119test_xmlXPathStringLengthFunction(void) {
47120 int test_ret = 0;
47121
William M. Brack21e4ef22005-01-02 09:53:13 +000047122#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047123 int mem_base;
47124 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47125 int n_ctxt;
47126 int nargs; /* the number of arguments */
47127 int n_nargs;
47128
47129 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47130 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47131 mem_base = xmlMemBlocks();
47132 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47133 nargs = gen_int(n_nargs, 1);
47134
47135 xmlXPathStringLengthFunction(ctxt, nargs);
47136 call_tests++;
47137 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47138 des_int(n_nargs, nargs, 1);
47139 xmlResetLastError();
47140 if (mem_base != xmlMemBlocks()) {
47141 printf("Leak of %d blocks found in xmlXPathStringLengthFunction",
47142 xmlMemBlocks() - mem_base);
47143 test_ret++;
47144 printf(" %d", n_ctxt);
47145 printf(" %d", n_nargs);
47146 printf("\n");
47147 }
47148 }
47149 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047150 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047151#endif
47152
Daniel Veillarda82b1822004-11-08 16:24:57 +000047153 return(test_ret);
47154}
47155
47156
47157static int
47158test_xmlXPathSubValues(void) {
47159 int test_ret = 0;
47160
William M. Brack21e4ef22005-01-02 09:53:13 +000047161#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047162 int mem_base;
47163 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47164 int n_ctxt;
47165
47166 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47167 mem_base = xmlMemBlocks();
47168 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47169
47170 xmlXPathSubValues(ctxt);
47171 call_tests++;
47172 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47173 xmlResetLastError();
47174 if (mem_base != xmlMemBlocks()) {
47175 printf("Leak of %d blocks found in xmlXPathSubValues",
47176 xmlMemBlocks() - mem_base);
47177 test_ret++;
47178 printf(" %d", n_ctxt);
47179 printf("\n");
47180 }
47181 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047182 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047183#endif
47184
Daniel Veillarda82b1822004-11-08 16:24:57 +000047185 return(test_ret);
47186}
47187
47188
47189static int
47190test_xmlXPathSubstringAfterFunction(void) {
47191 int test_ret = 0;
47192
William M. Brack21e4ef22005-01-02 09:53:13 +000047193#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047194 int mem_base;
47195 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47196 int n_ctxt;
47197 int nargs; /* the number of arguments */
47198 int n_nargs;
47199
47200 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47201 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47202 mem_base = xmlMemBlocks();
47203 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47204 nargs = gen_int(n_nargs, 1);
47205
47206 xmlXPathSubstringAfterFunction(ctxt, nargs);
47207 call_tests++;
47208 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47209 des_int(n_nargs, nargs, 1);
47210 xmlResetLastError();
47211 if (mem_base != xmlMemBlocks()) {
47212 printf("Leak of %d blocks found in xmlXPathSubstringAfterFunction",
47213 xmlMemBlocks() - mem_base);
47214 test_ret++;
47215 printf(" %d", n_ctxt);
47216 printf(" %d", n_nargs);
47217 printf("\n");
47218 }
47219 }
47220 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047221 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047222#endif
47223
Daniel Veillarda82b1822004-11-08 16:24:57 +000047224 return(test_ret);
47225}
47226
47227
47228static int
47229test_xmlXPathSubstringBeforeFunction(void) {
47230 int test_ret = 0;
47231
William M. Brack21e4ef22005-01-02 09:53:13 +000047232#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047233 int mem_base;
47234 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47235 int n_ctxt;
47236 int nargs; /* the number of arguments */
47237 int n_nargs;
47238
47239 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47240 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47241 mem_base = xmlMemBlocks();
47242 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47243 nargs = gen_int(n_nargs, 1);
47244
47245 xmlXPathSubstringBeforeFunction(ctxt, nargs);
47246 call_tests++;
47247 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47248 des_int(n_nargs, nargs, 1);
47249 xmlResetLastError();
47250 if (mem_base != xmlMemBlocks()) {
47251 printf("Leak of %d blocks found in xmlXPathSubstringBeforeFunction",
47252 xmlMemBlocks() - mem_base);
47253 test_ret++;
47254 printf(" %d", n_ctxt);
47255 printf(" %d", n_nargs);
47256 printf("\n");
47257 }
47258 }
47259 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047260 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047261#endif
47262
Daniel Veillarda82b1822004-11-08 16:24:57 +000047263 return(test_ret);
47264}
47265
47266
47267static int
47268test_xmlXPathSubstringFunction(void) {
47269 int test_ret = 0;
47270
William M. Brack21e4ef22005-01-02 09:53:13 +000047271#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047272 int mem_base;
47273 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47274 int n_ctxt;
47275 int nargs; /* the number of arguments */
47276 int n_nargs;
47277
47278 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47279 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47280 mem_base = xmlMemBlocks();
47281 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47282 nargs = gen_int(n_nargs, 1);
47283
47284 xmlXPathSubstringFunction(ctxt, nargs);
47285 call_tests++;
47286 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47287 des_int(n_nargs, nargs, 1);
47288 xmlResetLastError();
47289 if (mem_base != xmlMemBlocks()) {
47290 printf("Leak of %d blocks found in xmlXPathSubstringFunction",
47291 xmlMemBlocks() - mem_base);
47292 test_ret++;
47293 printf(" %d", n_ctxt);
47294 printf(" %d", n_nargs);
47295 printf("\n");
47296 }
47297 }
47298 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047299 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047300#endif
47301
Daniel Veillarda82b1822004-11-08 16:24:57 +000047302 return(test_ret);
47303}
47304
47305
47306static int
47307test_xmlXPathSumFunction(void) {
47308 int test_ret = 0;
47309
William M. Brack21e4ef22005-01-02 09:53:13 +000047310#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047311 int mem_base;
47312 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47313 int n_ctxt;
47314 int nargs; /* the number of arguments */
47315 int n_nargs;
47316
47317 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47318 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47319 mem_base = xmlMemBlocks();
47320 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47321 nargs = gen_int(n_nargs, 1);
47322
47323 xmlXPathSumFunction(ctxt, nargs);
47324 call_tests++;
47325 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47326 des_int(n_nargs, nargs, 1);
47327 xmlResetLastError();
47328 if (mem_base != xmlMemBlocks()) {
47329 printf("Leak of %d blocks found in xmlXPathSumFunction",
47330 xmlMemBlocks() - mem_base);
47331 test_ret++;
47332 printf(" %d", n_ctxt);
47333 printf(" %d", n_nargs);
47334 printf("\n");
47335 }
47336 }
47337 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047338 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047339#endif
47340
Daniel Veillarda82b1822004-11-08 16:24:57 +000047341 return(test_ret);
47342}
47343
47344
47345static int
47346test_xmlXPathTrailing(void) {
47347 int test_ret = 0;
47348
William M. Brack21e4ef22005-01-02 09:53:13 +000047349#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047350 int mem_base;
47351 xmlNodeSetPtr ret_val;
47352 xmlNodeSetPtr nodes1; /* a node-set */
47353 int n_nodes1;
47354 xmlNodeSetPtr nodes2; /* a node-set */
47355 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047356
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047357 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
47358 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
47359 mem_base = xmlMemBlocks();
47360 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
47361 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
47362
47363 ret_val = xmlXPathTrailing(nodes1, nodes2);
47364 desret_xmlNodeSetPtr(ret_val);
47365 call_tests++;
47366 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
47367 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
47368 xmlResetLastError();
47369 if (mem_base != xmlMemBlocks()) {
47370 printf("Leak of %d blocks found in xmlXPathTrailing",
47371 xmlMemBlocks() - mem_base);
47372 test_ret++;
47373 printf(" %d", n_nodes1);
47374 printf(" %d", n_nodes2);
47375 printf("\n");
47376 }
47377 }
47378 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047379 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047380#endif
47381
Daniel Veillarda82b1822004-11-08 16:24:57 +000047382 return(test_ret);
47383}
47384
47385
47386static int
47387test_xmlXPathTrailingSorted(void) {
47388 int test_ret = 0;
47389
William M. Brack21e4ef22005-01-02 09:53:13 +000047390#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047391 int mem_base;
47392 xmlNodeSetPtr ret_val;
47393 xmlNodeSetPtr nodes1; /* a node-set, sorted by document order */
47394 int n_nodes1;
47395 xmlNodeSetPtr nodes2; /* a node-set, sorted by document order */
47396 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047397
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047398 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
47399 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
47400 mem_base = xmlMemBlocks();
47401 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
47402 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
47403
47404 ret_val = xmlXPathTrailingSorted(nodes1, nodes2);
47405 desret_xmlNodeSetPtr(ret_val);
47406 call_tests++;
47407 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
47408 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
47409 xmlResetLastError();
47410 if (mem_base != xmlMemBlocks()) {
47411 printf("Leak of %d blocks found in xmlXPathTrailingSorted",
47412 xmlMemBlocks() - mem_base);
47413 test_ret++;
47414 printf(" %d", n_nodes1);
47415 printf(" %d", n_nodes2);
47416 printf("\n");
47417 }
47418 }
47419 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047420 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047421#endif
47422
Daniel Veillarda82b1822004-11-08 16:24:57 +000047423 return(test_ret);
47424}
47425
47426
47427static int
47428test_xmlXPathTranslateFunction(void) {
47429 int test_ret = 0;
47430
William M. Brack21e4ef22005-01-02 09:53:13 +000047431#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047432 int mem_base;
47433 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47434 int n_ctxt;
47435 int nargs; /* the number of arguments */
47436 int n_nargs;
47437
47438 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47439 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47440 mem_base = xmlMemBlocks();
47441 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47442 nargs = gen_int(n_nargs, 1);
47443
47444 xmlXPathTranslateFunction(ctxt, nargs);
47445 call_tests++;
47446 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47447 des_int(n_nargs, nargs, 1);
47448 xmlResetLastError();
47449 if (mem_base != xmlMemBlocks()) {
47450 printf("Leak of %d blocks found in xmlXPathTranslateFunction",
47451 xmlMemBlocks() - mem_base);
47452 test_ret++;
47453 printf(" %d", n_ctxt);
47454 printf(" %d", n_nargs);
47455 printf("\n");
47456 }
47457 }
47458 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047459 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047460#endif
47461
Daniel Veillarda82b1822004-11-08 16:24:57 +000047462 return(test_ret);
47463}
47464
47465
47466static int
47467test_xmlXPathTrueFunction(void) {
47468 int test_ret = 0;
47469
William M. Brack21e4ef22005-01-02 09:53:13 +000047470#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047471 int mem_base;
47472 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47473 int n_ctxt;
47474 int nargs; /* the number of arguments */
47475 int n_nargs;
47476
47477 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47478 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47479 mem_base = xmlMemBlocks();
47480 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47481 nargs = gen_int(n_nargs, 1);
47482
47483 xmlXPathTrueFunction(ctxt, nargs);
47484 call_tests++;
47485 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47486 des_int(n_nargs, nargs, 1);
47487 xmlResetLastError();
47488 if (mem_base != xmlMemBlocks()) {
47489 printf("Leak of %d blocks found in xmlXPathTrueFunction",
47490 xmlMemBlocks() - mem_base);
47491 test_ret++;
47492 printf(" %d", n_ctxt);
47493 printf(" %d", n_nargs);
47494 printf("\n");
47495 }
47496 }
47497 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047498 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047499#endif
47500
Daniel Veillarda82b1822004-11-08 16:24:57 +000047501 return(test_ret);
47502}
47503
47504
47505static int
47506test_xmlXPathValueFlipSign(void) {
47507 int test_ret = 0;
47508
William M. Brack21e4ef22005-01-02 09:53:13 +000047509#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047510 int mem_base;
47511 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47512 int n_ctxt;
47513
47514 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47515 mem_base = xmlMemBlocks();
47516 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47517
47518 xmlXPathValueFlipSign(ctxt);
47519 call_tests++;
47520 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47521 xmlResetLastError();
47522 if (mem_base != xmlMemBlocks()) {
47523 printf("Leak of %d blocks found in xmlXPathValueFlipSign",
47524 xmlMemBlocks() - mem_base);
47525 test_ret++;
47526 printf(" %d", n_ctxt);
47527 printf("\n");
47528 }
47529 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047530 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047531#endif
47532
Daniel Veillarda82b1822004-11-08 16:24:57 +000047533 return(test_ret);
47534}
47535
47536
47537static int
47538test_xmlXPathVariableLookup(void) {
47539 int test_ret = 0;
47540
William M. Brack21e4ef22005-01-02 09:53:13 +000047541#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047542 int mem_base;
47543 xmlXPathObjectPtr ret_val;
47544 xmlXPathContextPtr ctxt; /* the XPath context */
47545 int n_ctxt;
47546 xmlChar * name; /* the variable name */
47547 int n_name;
47548
47549 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47550 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
47551 mem_base = xmlMemBlocks();
47552 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47553 name = gen_const_xmlChar_ptr(n_name, 1);
47554
William M. Brackf13f77f2004-11-12 16:03:48 +000047555 ret_val = xmlXPathVariableLookup(ctxt, (const xmlChar *)name);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047556 desret_xmlXPathObjectPtr(ret_val);
47557 call_tests++;
47558 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000047559 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047560 xmlResetLastError();
47561 if (mem_base != xmlMemBlocks()) {
47562 printf("Leak of %d blocks found in xmlXPathVariableLookup",
47563 xmlMemBlocks() - mem_base);
47564 test_ret++;
47565 printf(" %d", n_ctxt);
47566 printf(" %d", n_name);
47567 printf("\n");
47568 }
47569 }
47570 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047571 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047572#endif
47573
Daniel Veillarda82b1822004-11-08 16:24:57 +000047574 return(test_ret);
47575}
47576
47577
47578static int
47579test_xmlXPathVariableLookupNS(void) {
47580 int test_ret = 0;
47581
William M. Brack21e4ef22005-01-02 09:53:13 +000047582#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047583 int mem_base;
47584 xmlXPathObjectPtr ret_val;
47585 xmlXPathContextPtr ctxt; /* the XPath context */
47586 int n_ctxt;
47587 xmlChar * name; /* the variable name */
47588 int n_name;
47589 xmlChar * ns_uri; /* the variable namespace URI */
47590 int n_ns_uri;
47591
47592 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47593 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
47594 for (n_ns_uri = 0;n_ns_uri < gen_nb_const_xmlChar_ptr;n_ns_uri++) {
47595 mem_base = xmlMemBlocks();
47596 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47597 name = gen_const_xmlChar_ptr(n_name, 1);
47598 ns_uri = gen_const_xmlChar_ptr(n_ns_uri, 2);
47599
William M. Brackf13f77f2004-11-12 16:03:48 +000047600 ret_val = xmlXPathVariableLookupNS(ctxt, (const xmlChar *)name, (const xmlChar *)ns_uri);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047601 desret_xmlXPathObjectPtr(ret_val);
47602 call_tests++;
47603 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000047604 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
47605 des_const_xmlChar_ptr(n_ns_uri, (const xmlChar *)ns_uri, 2);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047606 xmlResetLastError();
47607 if (mem_base != xmlMemBlocks()) {
47608 printf("Leak of %d blocks found in xmlXPathVariableLookupNS",
47609 xmlMemBlocks() - mem_base);
47610 test_ret++;
47611 printf(" %d", n_ctxt);
47612 printf(" %d", n_name);
47613 printf(" %d", n_ns_uri);
47614 printf("\n");
47615 }
47616 }
47617 }
47618 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047619 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047620#endif
47621
Daniel Veillarda82b1822004-11-08 16:24:57 +000047622 return(test_ret);
47623}
47624
47625
47626static int
47627test_xmlXPathWrapCString(void) {
47628 int test_ret = 0;
47629
William M. Brack21e4ef22005-01-02 09:53:13 +000047630#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047631 int mem_base;
47632 xmlXPathObjectPtr ret_val;
47633 char * val; /* the char * value */
47634 int n_val;
47635
47636 for (n_val = 0;n_val < gen_nb_char_ptr;n_val++) {
47637 mem_base = xmlMemBlocks();
47638 val = gen_char_ptr(n_val, 0);
47639
47640 ret_val = xmlXPathWrapCString(val);
47641 desret_xmlXPathObjectPtr(ret_val);
47642 call_tests++;
47643 des_char_ptr(n_val, val, 0);
47644 xmlResetLastError();
47645 if (mem_base != xmlMemBlocks()) {
47646 printf("Leak of %d blocks found in xmlXPathWrapCString",
47647 xmlMemBlocks() - mem_base);
47648 test_ret++;
47649 printf(" %d", n_val);
47650 printf("\n");
47651 }
47652 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047653 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047654#endif
47655
Daniel Veillarda82b1822004-11-08 16:24:57 +000047656 return(test_ret);
47657}
47658
47659
47660static int
47661test_xmlXPathWrapExternal(void) {
47662 int test_ret = 0;
47663
William M. Brack21e4ef22005-01-02 09:53:13 +000047664#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047665 int mem_base;
47666 xmlXPathObjectPtr ret_val;
47667 void * val; /* the user data */
47668 int n_val;
47669
47670 for (n_val = 0;n_val < gen_nb_void_ptr;n_val++) {
47671 mem_base = xmlMemBlocks();
47672 val = gen_void_ptr(n_val, 0);
47673
47674 ret_val = xmlXPathWrapExternal(val);
47675 desret_xmlXPathObjectPtr(ret_val);
47676 call_tests++;
47677 des_void_ptr(n_val, val, 0);
47678 xmlResetLastError();
47679 if (mem_base != xmlMemBlocks()) {
47680 printf("Leak of %d blocks found in xmlXPathWrapExternal",
47681 xmlMemBlocks() - mem_base);
47682 test_ret++;
47683 printf(" %d", n_val);
47684 printf("\n");
47685 }
47686 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047687 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047688#endif
47689
Daniel Veillarda82b1822004-11-08 16:24:57 +000047690 return(test_ret);
47691}
47692
47693
47694static int
47695test_xmlXPathWrapNodeSet(void) {
47696 int test_ret = 0;
47697
William M. Brack21e4ef22005-01-02 09:53:13 +000047698#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047699 int mem_base;
47700 xmlXPathObjectPtr ret_val;
47701 xmlNodeSetPtr val; /* the NodePtr value */
47702 int n_val;
47703
47704 for (n_val = 0;n_val < gen_nb_xmlNodeSetPtr;n_val++) {
47705 mem_base = xmlMemBlocks();
47706 val = gen_xmlNodeSetPtr(n_val, 0);
47707
47708 ret_val = xmlXPathWrapNodeSet(val);
47709 desret_xmlXPathObjectPtr(ret_val);
47710 call_tests++;
47711 des_xmlNodeSetPtr(n_val, val, 0);
47712 xmlResetLastError();
47713 if (mem_base != xmlMemBlocks()) {
47714 printf("Leak of %d blocks found in xmlXPathWrapNodeSet",
47715 xmlMemBlocks() - mem_base);
47716 test_ret++;
47717 printf(" %d", n_val);
47718 printf("\n");
47719 }
47720 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047721 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047722#endif
47723
Daniel Veillarda82b1822004-11-08 16:24:57 +000047724 return(test_ret);
47725}
47726
47727
47728static int
47729test_xmlXPatherror(void) {
47730 int test_ret = 0;
47731
William M. Brack21e4ef22005-01-02 09:53:13 +000047732#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047733 int mem_base;
47734 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47735 int n_ctxt;
47736 const char * file; /* the file name */
47737 int n_file;
47738 int line; /* the line number */
47739 int n_line;
47740 int no; /* the error number */
47741 int n_no;
47742
47743 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47744 for (n_file = 0;n_file < gen_nb_filepath;n_file++) {
47745 for (n_line = 0;n_line < gen_nb_int;n_line++) {
47746 for (n_no = 0;n_no < gen_nb_int;n_no++) {
47747 mem_base = xmlMemBlocks();
47748 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47749 file = gen_filepath(n_file, 1);
47750 line = gen_int(n_line, 2);
47751 no = gen_int(n_no, 3);
47752
47753 xmlXPatherror(ctxt, file, line, no);
47754 call_tests++;
47755 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47756 des_filepath(n_file, file, 1);
47757 des_int(n_line, line, 2);
47758 des_int(n_no, no, 3);
47759 xmlResetLastError();
47760 if (mem_base != xmlMemBlocks()) {
47761 printf("Leak of %d blocks found in xmlXPatherror",
47762 xmlMemBlocks() - mem_base);
47763 test_ret++;
47764 printf(" %d", n_ctxt);
47765 printf(" %d", n_file);
47766 printf(" %d", n_line);
47767 printf(" %d", n_no);
47768 printf("\n");
47769 }
47770 }
47771 }
47772 }
47773 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047774 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047775#endif
47776
Daniel Veillarda82b1822004-11-08 16:24:57 +000047777 return(test_ret);
47778}
47779
47780static int
47781test_xpathInternals(void) {
47782 int test_ret = 0;
47783
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047784 if (quiet == 0) printf("Testing xpathInternals : 106 of 117 functions ...\n");
Daniel Veillarda82b1822004-11-08 16:24:57 +000047785 test_ret += test_valuePop();
47786 test_ret += test_valuePush();
47787 test_ret += test_xmlXPathAddValues();
47788 test_ret += test_xmlXPathBooleanFunction();
47789 test_ret += test_xmlXPathCeilingFunction();
47790 test_ret += test_xmlXPathCompareValues();
47791 test_ret += test_xmlXPathConcatFunction();
47792 test_ret += test_xmlXPathContainsFunction();
47793 test_ret += test_xmlXPathCountFunction();
47794 test_ret += test_xmlXPathDebugDumpCompExpr();
47795 test_ret += test_xmlXPathDebugDumpObject();
47796 test_ret += test_xmlXPathDifference();
47797 test_ret += test_xmlXPathDistinct();
47798 test_ret += test_xmlXPathDistinctSorted();
47799 test_ret += test_xmlXPathDivValues();
47800 test_ret += test_xmlXPathEqualValues();
47801 test_ret += test_xmlXPathErr();
47802 test_ret += test_xmlXPathEvalExpr();
47803 test_ret += test_xmlXPathEvaluatePredicateResult();
47804 test_ret += test_xmlXPathFalseFunction();
47805 test_ret += test_xmlXPathFloorFunction();
47806 test_ret += test_xmlXPathFunctionLookup();
47807 test_ret += test_xmlXPathFunctionLookupNS();
47808 test_ret += test_xmlXPathHasSameNodes();
47809 test_ret += test_xmlXPathIdFunction();
47810 test_ret += test_xmlXPathIntersection();
47811 test_ret += test_xmlXPathIsNodeType();
47812 test_ret += test_xmlXPathLangFunction();
47813 test_ret += test_xmlXPathLastFunction();
47814 test_ret += test_xmlXPathLeading();
47815 test_ret += test_xmlXPathLeadingSorted();
47816 test_ret += test_xmlXPathLocalNameFunction();
47817 test_ret += test_xmlXPathModValues();
47818 test_ret += test_xmlXPathMultValues();
47819 test_ret += test_xmlXPathNamespaceURIFunction();
47820 test_ret += test_xmlXPathNewBoolean();
47821 test_ret += test_xmlXPathNewCString();
47822 test_ret += test_xmlXPathNewFloat();
47823 test_ret += test_xmlXPathNewNodeSet();
47824 test_ret += test_xmlXPathNewNodeSetList();
47825 test_ret += test_xmlXPathNewParserContext();
47826 test_ret += test_xmlXPathNewString();
47827 test_ret += test_xmlXPathNextAncestor();
47828 test_ret += test_xmlXPathNextAncestorOrSelf();
47829 test_ret += test_xmlXPathNextAttribute();
47830 test_ret += test_xmlXPathNextChild();
47831 test_ret += test_xmlXPathNextDescendant();
47832 test_ret += test_xmlXPathNextDescendantOrSelf();
47833 test_ret += test_xmlXPathNextFollowing();
47834 test_ret += test_xmlXPathNextFollowingSibling();
47835 test_ret += test_xmlXPathNextNamespace();
47836 test_ret += test_xmlXPathNextParent();
47837 test_ret += test_xmlXPathNextPreceding();
47838 test_ret += test_xmlXPathNextPrecedingSibling();
47839 test_ret += test_xmlXPathNextSelf();
47840 test_ret += test_xmlXPathNodeLeading();
47841 test_ret += test_xmlXPathNodeLeadingSorted();
47842 test_ret += test_xmlXPathNodeSetAdd();
47843 test_ret += test_xmlXPathNodeSetAddNs();
47844 test_ret += test_xmlXPathNodeSetAddUnique();
47845 test_ret += test_xmlXPathNodeSetContains();
47846 test_ret += test_xmlXPathNodeSetDel();
47847 test_ret += test_xmlXPathNodeSetMerge();
47848 test_ret += test_xmlXPathNodeSetRemove();
47849 test_ret += test_xmlXPathNodeSetSort();
47850 test_ret += test_xmlXPathNodeTrailing();
47851 test_ret += test_xmlXPathNodeTrailingSorted();
47852 test_ret += test_xmlXPathNormalizeFunction();
47853 test_ret += test_xmlXPathNotEqualValues();
47854 test_ret += test_xmlXPathNotFunction();
47855 test_ret += test_xmlXPathNsLookup();
47856 test_ret += test_xmlXPathNumberFunction();
47857 test_ret += test_xmlXPathParseNCName();
47858 test_ret += test_xmlXPathParseName();
47859 test_ret += test_xmlXPathPopBoolean();
47860 test_ret += test_xmlXPathPopExternal();
47861 test_ret += test_xmlXPathPopNodeSet();
47862 test_ret += test_xmlXPathPopNumber();
47863 test_ret += test_xmlXPathPopString();
47864 test_ret += test_xmlXPathPositionFunction();
47865 test_ret += test_xmlXPathRegisterAllFunctions();
47866 test_ret += test_xmlXPathRegisterFunc();
47867 test_ret += test_xmlXPathRegisterFuncLookup();
47868 test_ret += test_xmlXPathRegisterFuncNS();
47869 test_ret += test_xmlXPathRegisterNs();
47870 test_ret += test_xmlXPathRegisterVariable();
47871 test_ret += test_xmlXPathRegisterVariableLookup();
47872 test_ret += test_xmlXPathRegisterVariableNS();
47873 test_ret += test_xmlXPathRegisteredFuncsCleanup();
47874 test_ret += test_xmlXPathRegisteredNsCleanup();
47875 test_ret += test_xmlXPathRegisteredVariablesCleanup();
47876 test_ret += test_xmlXPathRoot();
47877 test_ret += test_xmlXPathRoundFunction();
47878 test_ret += test_xmlXPathStartsWithFunction();
47879 test_ret += test_xmlXPathStringEvalNumber();
47880 test_ret += test_xmlXPathStringFunction();
47881 test_ret += test_xmlXPathStringLengthFunction();
47882 test_ret += test_xmlXPathSubValues();
47883 test_ret += test_xmlXPathSubstringAfterFunction();
47884 test_ret += test_xmlXPathSubstringBeforeFunction();
47885 test_ret += test_xmlXPathSubstringFunction();
47886 test_ret += test_xmlXPathSumFunction();
47887 test_ret += test_xmlXPathTrailing();
47888 test_ret += test_xmlXPathTrailingSorted();
47889 test_ret += test_xmlXPathTranslateFunction();
47890 test_ret += test_xmlXPathTrueFunction();
47891 test_ret += test_xmlXPathValueFlipSign();
47892 test_ret += test_xmlXPathVariableLookup();
47893 test_ret += test_xmlXPathVariableLookupNS();
47894 test_ret += test_xmlXPathWrapCString();
47895 test_ret += test_xmlXPathWrapExternal();
47896 test_ret += test_xmlXPathWrapNodeSet();
47897 test_ret += test_xmlXPatherror();
47898
47899 if (test_ret != 0)
47900 printf("Module xpathInternals: %d errors\n", test_ret);
47901 return(test_ret);
47902}
47903
Daniel Veillardd93f6252004-11-02 15:53:51 +000047904static int
47905test_xmlXPtrBuildNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047906 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047907
William M. Brack21e4ef22005-01-02 09:53:13 +000047908#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000047909 int mem_base;
47910 xmlNodePtr ret_val;
47911 xmlXPathObjectPtr obj; /* the XPointer result from the evaluation. */
47912 int n_obj;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047913
Daniel Veillardd005b9e2004-11-03 17:07:05 +000047914 for (n_obj = 0;n_obj < gen_nb_xmlXPathObjectPtr;n_obj++) {
47915 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000047916 obj = gen_xmlXPathObjectPtr(n_obj, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000047917
47918 ret_val = xmlXPtrBuildNodeList(obj);
47919 desret_xmlNodePtr(ret_val);
47920 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000047921 des_xmlXPathObjectPtr(n_obj, obj, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000047922 xmlResetLastError();
47923 if (mem_base != xmlMemBlocks()) {
47924 printf("Leak of %d blocks found in xmlXPtrBuildNodeList",
47925 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000047926 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000047927 printf(" %d", n_obj);
47928 printf("\n");
47929 }
47930 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047931 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000047932#endif
47933
Daniel Veillard42595322004-11-08 10:52:06 +000047934 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047935}
47936
47937
47938static int
47939test_xmlXPtrEval(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047940 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047941
William M. Brack21e4ef22005-01-02 09:53:13 +000047942#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000047943 int mem_base;
47944 xmlXPathObjectPtr ret_val;
47945 xmlChar * str; /* the XPointer expression */
47946 int n_str;
47947 xmlXPathContextPtr ctx; /* the XPointer context */
47948 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047949
Daniel Veillardce682bc2004-11-05 17:22:25 +000047950 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
47951 for (n_ctx = 0;n_ctx < gen_nb_xmlXPathContextPtr;n_ctx++) {
47952 mem_base = xmlMemBlocks();
47953 str = gen_const_xmlChar_ptr(n_str, 0);
47954 ctx = gen_xmlXPathContextPtr(n_ctx, 1);
47955
William M. Brackf13f77f2004-11-12 16:03:48 +000047956 ret_val = xmlXPtrEval((const xmlChar *)str, ctx);
Daniel Veillardce682bc2004-11-05 17:22:25 +000047957 desret_xmlXPathObjectPtr(ret_val);
47958 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000047959 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000047960 des_xmlXPathContextPtr(n_ctx, ctx, 1);
47961 xmlResetLastError();
47962 if (mem_base != xmlMemBlocks()) {
47963 printf("Leak of %d blocks found in xmlXPtrEval",
47964 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000047965 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000047966 printf(" %d", n_str);
47967 printf(" %d", n_ctx);
47968 printf("\n");
47969 }
47970 }
47971 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047972 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000047973#endif
47974
Daniel Veillard42595322004-11-08 10:52:06 +000047975 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047976}
47977
47978
47979static int
47980test_xmlXPtrEvalRangePredicate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047981 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047982
William M. Brack21e4ef22005-01-02 09:53:13 +000047983#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000047984 int mem_base;
47985 xmlXPathParserContextPtr ctxt; /* the XPointer Parser context */
47986 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047987
Daniel Veillardce682bc2004-11-05 17:22:25 +000047988 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47989 mem_base = xmlMemBlocks();
47990 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47991
47992 xmlXPtrEvalRangePredicate(ctxt);
47993 call_tests++;
47994 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47995 xmlResetLastError();
47996 if (mem_base != xmlMemBlocks()) {
47997 printf("Leak of %d blocks found in xmlXPtrEvalRangePredicate",
47998 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000047999 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048000 printf(" %d", n_ctxt);
48001 printf("\n");
48002 }
48003 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048004 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048005#endif
48006
Daniel Veillard42595322004-11-08 10:52:06 +000048007 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048008}
48009
Daniel Veillarda521d282004-11-09 14:59:59 +000048010#ifdef LIBXML_XPTR_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000048011
Daniel Veillardce682bc2004-11-05 17:22:25 +000048012#define gen_nb_xmlLocationSetPtr 1
48013static xmlLocationSetPtr gen_xmlLocationSetPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
48014 return(NULL);
48015}
48016static void des_xmlLocationSetPtr(int no ATTRIBUTE_UNUSED, xmlLocationSetPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
48017}
Daniel Veillarda521d282004-11-09 14:59:59 +000048018#endif
48019
Daniel Veillardce682bc2004-11-05 17:22:25 +000048020
Daniel Veillardd93f6252004-11-02 15:53:51 +000048021static int
48022test_xmlXPtrLocationSetAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048023 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048024
William M. Brack21e4ef22005-01-02 09:53:13 +000048025#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000048026 int mem_base;
48027 xmlLocationSetPtr cur; /* the initial range set */
48028 int n_cur;
48029 xmlXPathObjectPtr val; /* a new xmlXPathObjectPtr */
48030 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048031
Daniel Veillardce682bc2004-11-05 17:22:25 +000048032 for (n_cur = 0;n_cur < gen_nb_xmlLocationSetPtr;n_cur++) {
48033 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
48034 mem_base = xmlMemBlocks();
48035 cur = gen_xmlLocationSetPtr(n_cur, 0);
48036 val = gen_xmlXPathObjectPtr(n_val, 1);
48037
48038 xmlXPtrLocationSetAdd(cur, val);
48039 call_tests++;
48040 des_xmlLocationSetPtr(n_cur, cur, 0);
48041 des_xmlXPathObjectPtr(n_val, val, 1);
48042 xmlResetLastError();
48043 if (mem_base != xmlMemBlocks()) {
48044 printf("Leak of %d blocks found in xmlXPtrLocationSetAdd",
48045 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048046 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048047 printf(" %d", n_cur);
48048 printf(" %d", n_val);
48049 printf("\n");
48050 }
48051 }
48052 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048053 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048054#endif
48055
Daniel Veillard42595322004-11-08 10:52:06 +000048056 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048057}
48058
48059
48060static int
48061test_xmlXPtrLocationSetCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048062 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048063
48064
48065 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000048066 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048067}
48068
48069
48070static int
48071test_xmlXPtrLocationSetDel(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048072 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048073
William M. Brack21e4ef22005-01-02 09:53:13 +000048074#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000048075 int mem_base;
48076 xmlLocationSetPtr cur; /* the initial range set */
48077 int n_cur;
48078 xmlXPathObjectPtr val; /* an xmlXPathObjectPtr */
48079 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048080
Daniel Veillardce682bc2004-11-05 17:22:25 +000048081 for (n_cur = 0;n_cur < gen_nb_xmlLocationSetPtr;n_cur++) {
48082 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
48083 mem_base = xmlMemBlocks();
48084 cur = gen_xmlLocationSetPtr(n_cur, 0);
48085 val = gen_xmlXPathObjectPtr(n_val, 1);
48086
48087 xmlXPtrLocationSetDel(cur, val);
48088 call_tests++;
48089 des_xmlLocationSetPtr(n_cur, cur, 0);
48090 des_xmlXPathObjectPtr(n_val, val, 1);
48091 xmlResetLastError();
48092 if (mem_base != xmlMemBlocks()) {
48093 printf("Leak of %d blocks found in xmlXPtrLocationSetDel",
48094 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048095 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048096 printf(" %d", n_cur);
48097 printf(" %d", n_val);
48098 printf("\n");
48099 }
48100 }
48101 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048102 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048103#endif
48104
Daniel Veillard42595322004-11-08 10:52:06 +000048105 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048106}
48107
48108
48109static int
48110test_xmlXPtrLocationSetMerge(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048111 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048112
48113
48114 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000048115 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048116}
48117
48118
48119static int
48120test_xmlXPtrLocationSetRemove(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048121 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048122
William M. Brack21e4ef22005-01-02 09:53:13 +000048123#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000048124 int mem_base;
48125 xmlLocationSetPtr cur; /* the initial range set */
48126 int n_cur;
48127 int val; /* the index to remove */
48128 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048129
Daniel Veillardce682bc2004-11-05 17:22:25 +000048130 for (n_cur = 0;n_cur < gen_nb_xmlLocationSetPtr;n_cur++) {
48131 for (n_val = 0;n_val < gen_nb_int;n_val++) {
48132 mem_base = xmlMemBlocks();
48133 cur = gen_xmlLocationSetPtr(n_cur, 0);
48134 val = gen_int(n_val, 1);
48135
48136 xmlXPtrLocationSetRemove(cur, val);
48137 call_tests++;
48138 des_xmlLocationSetPtr(n_cur, cur, 0);
48139 des_int(n_val, val, 1);
48140 xmlResetLastError();
48141 if (mem_base != xmlMemBlocks()) {
48142 printf("Leak of %d blocks found in xmlXPtrLocationSetRemove",
48143 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048144 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048145 printf(" %d", n_cur);
48146 printf(" %d", n_val);
48147 printf("\n");
48148 }
48149 }
48150 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048151 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048152#endif
48153
Daniel Veillard42595322004-11-08 10:52:06 +000048154 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048155}
48156
48157
48158static int
48159test_xmlXPtrNewCollapsedRange(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048160 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048161
William M. Brack21e4ef22005-01-02 09:53:13 +000048162#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000048163 int mem_base;
48164 xmlXPathObjectPtr ret_val;
48165 xmlNodePtr start; /* the starting and ending node */
48166 int n_start;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048167
Daniel Veillard3d97e662004-11-04 10:49:00 +000048168 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48169 mem_base = xmlMemBlocks();
48170 start = gen_xmlNodePtr(n_start, 0);
48171
48172 ret_val = xmlXPtrNewCollapsedRange(start);
48173 desret_xmlXPathObjectPtr(ret_val);
48174 call_tests++;
48175 des_xmlNodePtr(n_start, start, 0);
48176 xmlResetLastError();
48177 if (mem_base != xmlMemBlocks()) {
48178 printf("Leak of %d blocks found in xmlXPtrNewCollapsedRange",
48179 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048180 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048181 printf(" %d", n_start);
48182 printf("\n");
48183 }
48184 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048185 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048186#endif
48187
Daniel Veillard42595322004-11-08 10:52:06 +000048188 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048189}
48190
48191
48192static int
48193test_xmlXPtrNewContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048194 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048195
48196
48197 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000048198 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048199}
48200
48201
48202static int
48203test_xmlXPtrNewLocationSetNodeSet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048204 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048205
William M. Brack21e4ef22005-01-02 09:53:13 +000048206#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000048207 int mem_base;
48208 xmlXPathObjectPtr ret_val;
48209 xmlNodeSetPtr set; /* a node set */
48210 int n_set;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048211
Daniel Veillardce682bc2004-11-05 17:22:25 +000048212 for (n_set = 0;n_set < gen_nb_xmlNodeSetPtr;n_set++) {
48213 mem_base = xmlMemBlocks();
48214 set = gen_xmlNodeSetPtr(n_set, 0);
48215
48216 ret_val = xmlXPtrNewLocationSetNodeSet(set);
48217 desret_xmlXPathObjectPtr(ret_val);
48218 call_tests++;
48219 des_xmlNodeSetPtr(n_set, set, 0);
48220 xmlResetLastError();
48221 if (mem_base != xmlMemBlocks()) {
48222 printf("Leak of %d blocks found in xmlXPtrNewLocationSetNodeSet",
48223 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048224 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048225 printf(" %d", n_set);
48226 printf("\n");
48227 }
48228 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048229 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048230#endif
48231
Daniel Veillard42595322004-11-08 10:52:06 +000048232 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048233}
48234
48235
48236static int
48237test_xmlXPtrNewLocationSetNodes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048238 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048239
William M. Brack21e4ef22005-01-02 09:53:13 +000048240#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000048241 int mem_base;
48242 xmlXPathObjectPtr ret_val;
48243 xmlNodePtr start; /* the start NodePtr value */
48244 int n_start;
48245 xmlNodePtr end; /* the end NodePtr value or NULL */
48246 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048247
Daniel Veillard3d97e662004-11-04 10:49:00 +000048248 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48249 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
48250 mem_base = xmlMemBlocks();
48251 start = gen_xmlNodePtr(n_start, 0);
48252 end = gen_xmlNodePtr(n_end, 1);
48253
48254 ret_val = xmlXPtrNewLocationSetNodes(start, end);
48255 desret_xmlXPathObjectPtr(ret_val);
48256 call_tests++;
48257 des_xmlNodePtr(n_start, start, 0);
48258 des_xmlNodePtr(n_end, end, 1);
48259 xmlResetLastError();
48260 if (mem_base != xmlMemBlocks()) {
48261 printf("Leak of %d blocks found in xmlXPtrNewLocationSetNodes",
48262 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048263 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048264 printf(" %d", n_start);
48265 printf(" %d", n_end);
48266 printf("\n");
48267 }
48268 }
48269 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048270 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048271#endif
48272
Daniel Veillard42595322004-11-08 10:52:06 +000048273 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048274}
48275
48276
48277static int
48278test_xmlXPtrNewRange(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048279 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048280
William M. Brack21e4ef22005-01-02 09:53:13 +000048281#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000048282 int mem_base;
48283 xmlXPathObjectPtr ret_val;
48284 xmlNodePtr start; /* the starting node */
48285 int n_start;
48286 int startindex; /* the start index */
48287 int n_startindex;
48288 xmlNodePtr end; /* the ending point */
48289 int n_end;
48290 int endindex; /* the ending index */
48291 int n_endindex;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048292
Daniel Veillard3d97e662004-11-04 10:49:00 +000048293 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48294 for (n_startindex = 0;n_startindex < gen_nb_int;n_startindex++) {
48295 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
48296 for (n_endindex = 0;n_endindex < gen_nb_int;n_endindex++) {
48297 mem_base = xmlMemBlocks();
48298 start = gen_xmlNodePtr(n_start, 0);
48299 startindex = gen_int(n_startindex, 1);
48300 end = gen_xmlNodePtr(n_end, 2);
48301 endindex = gen_int(n_endindex, 3);
48302
48303 ret_val = xmlXPtrNewRange(start, startindex, end, endindex);
48304 desret_xmlXPathObjectPtr(ret_val);
48305 call_tests++;
48306 des_xmlNodePtr(n_start, start, 0);
48307 des_int(n_startindex, startindex, 1);
48308 des_xmlNodePtr(n_end, end, 2);
48309 des_int(n_endindex, endindex, 3);
48310 xmlResetLastError();
48311 if (mem_base != xmlMemBlocks()) {
48312 printf("Leak of %d blocks found in xmlXPtrNewRange",
48313 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048314 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048315 printf(" %d", n_start);
48316 printf(" %d", n_startindex);
48317 printf(" %d", n_end);
48318 printf(" %d", n_endindex);
48319 printf("\n");
48320 }
48321 }
48322 }
48323 }
48324 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048325 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048326#endif
48327
Daniel Veillard42595322004-11-08 10:52:06 +000048328 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048329}
48330
48331
48332static int
48333test_xmlXPtrNewRangeNodeObject(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048334 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048335
William M. Brack21e4ef22005-01-02 09:53:13 +000048336#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000048337 int mem_base;
48338 xmlXPathObjectPtr ret_val;
48339 xmlNodePtr start; /* the starting node */
48340 int n_start;
48341 xmlXPathObjectPtr end; /* the ending object */
48342 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048343
Daniel Veillard3d97e662004-11-04 10:49:00 +000048344 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48345 for (n_end = 0;n_end < gen_nb_xmlXPathObjectPtr;n_end++) {
48346 mem_base = xmlMemBlocks();
48347 start = gen_xmlNodePtr(n_start, 0);
48348 end = gen_xmlXPathObjectPtr(n_end, 1);
48349
48350 ret_val = xmlXPtrNewRangeNodeObject(start, end);
48351 desret_xmlXPathObjectPtr(ret_val);
48352 call_tests++;
48353 des_xmlNodePtr(n_start, start, 0);
48354 des_xmlXPathObjectPtr(n_end, end, 1);
48355 xmlResetLastError();
48356 if (mem_base != xmlMemBlocks()) {
48357 printf("Leak of %d blocks found in xmlXPtrNewRangeNodeObject",
48358 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048359 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048360 printf(" %d", n_start);
48361 printf(" %d", n_end);
48362 printf("\n");
48363 }
48364 }
48365 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048366 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048367#endif
48368
Daniel Veillard42595322004-11-08 10:52:06 +000048369 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048370}
48371
48372
48373static int
48374test_xmlXPtrNewRangeNodePoint(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048375 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048376
William M. Brack21e4ef22005-01-02 09:53:13 +000048377#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000048378 int mem_base;
48379 xmlXPathObjectPtr ret_val;
48380 xmlNodePtr start; /* the starting node */
48381 int n_start;
48382 xmlXPathObjectPtr end; /* the ending point */
48383 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048384
Daniel Veillard3d97e662004-11-04 10:49:00 +000048385 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48386 for (n_end = 0;n_end < gen_nb_xmlXPathObjectPtr;n_end++) {
48387 mem_base = xmlMemBlocks();
48388 start = gen_xmlNodePtr(n_start, 0);
48389 end = gen_xmlXPathObjectPtr(n_end, 1);
48390
48391 ret_val = xmlXPtrNewRangeNodePoint(start, end);
48392 desret_xmlXPathObjectPtr(ret_val);
48393 call_tests++;
48394 des_xmlNodePtr(n_start, start, 0);
48395 des_xmlXPathObjectPtr(n_end, end, 1);
48396 xmlResetLastError();
48397 if (mem_base != xmlMemBlocks()) {
48398 printf("Leak of %d blocks found in xmlXPtrNewRangeNodePoint",
48399 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048400 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048401 printf(" %d", n_start);
48402 printf(" %d", n_end);
48403 printf("\n");
48404 }
48405 }
48406 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048407 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048408#endif
48409
Daniel Veillard42595322004-11-08 10:52:06 +000048410 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048411}
48412
48413
48414static int
48415test_xmlXPtrNewRangeNodes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048416 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048417
William M. Brack21e4ef22005-01-02 09:53:13 +000048418#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000048419 int mem_base;
48420 xmlXPathObjectPtr ret_val;
48421 xmlNodePtr start; /* the starting node */
48422 int n_start;
48423 xmlNodePtr end; /* the ending node */
48424 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048425
Daniel Veillard3d97e662004-11-04 10:49:00 +000048426 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48427 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
48428 mem_base = xmlMemBlocks();
48429 start = gen_xmlNodePtr(n_start, 0);
48430 end = gen_xmlNodePtr(n_end, 1);
48431
48432 ret_val = xmlXPtrNewRangeNodes(start, end);
48433 desret_xmlXPathObjectPtr(ret_val);
48434 call_tests++;
48435 des_xmlNodePtr(n_start, start, 0);
48436 des_xmlNodePtr(n_end, end, 1);
48437 xmlResetLastError();
48438 if (mem_base != xmlMemBlocks()) {
48439 printf("Leak of %d blocks found in xmlXPtrNewRangeNodes",
48440 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048441 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048442 printf(" %d", n_start);
48443 printf(" %d", n_end);
48444 printf("\n");
48445 }
48446 }
48447 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048448 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048449#endif
48450
Daniel Veillard42595322004-11-08 10:52:06 +000048451 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048452}
48453
48454
48455static int
48456test_xmlXPtrNewRangePointNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048457 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048458
William M. Brack21e4ef22005-01-02 09:53:13 +000048459#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000048460 int mem_base;
48461 xmlXPathObjectPtr ret_val;
48462 xmlXPathObjectPtr start; /* the starting point */
48463 int n_start;
48464 xmlNodePtr end; /* the ending node */
48465 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048466
Daniel Veillard3d97e662004-11-04 10:49:00 +000048467 for (n_start = 0;n_start < gen_nb_xmlXPathObjectPtr;n_start++) {
48468 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
48469 mem_base = xmlMemBlocks();
48470 start = gen_xmlXPathObjectPtr(n_start, 0);
48471 end = gen_xmlNodePtr(n_end, 1);
48472
48473 ret_val = xmlXPtrNewRangePointNode(start, end);
48474 desret_xmlXPathObjectPtr(ret_val);
48475 call_tests++;
48476 des_xmlXPathObjectPtr(n_start, start, 0);
48477 des_xmlNodePtr(n_end, end, 1);
48478 xmlResetLastError();
48479 if (mem_base != xmlMemBlocks()) {
48480 printf("Leak of %d blocks found in xmlXPtrNewRangePointNode",
48481 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048482 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048483 printf(" %d", n_start);
48484 printf(" %d", n_end);
48485 printf("\n");
48486 }
48487 }
48488 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048489 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048490#endif
48491
Daniel Veillard42595322004-11-08 10:52:06 +000048492 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048493}
48494
48495
48496static int
48497test_xmlXPtrNewRangePoints(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048498 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048499
William M. Brack21e4ef22005-01-02 09:53:13 +000048500#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000048501 int mem_base;
48502 xmlXPathObjectPtr ret_val;
48503 xmlXPathObjectPtr start; /* the starting point */
48504 int n_start;
48505 xmlXPathObjectPtr end; /* the ending point */
48506 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048507
Daniel Veillard3d97e662004-11-04 10:49:00 +000048508 for (n_start = 0;n_start < gen_nb_xmlXPathObjectPtr;n_start++) {
48509 for (n_end = 0;n_end < gen_nb_xmlXPathObjectPtr;n_end++) {
48510 mem_base = xmlMemBlocks();
48511 start = gen_xmlXPathObjectPtr(n_start, 0);
48512 end = gen_xmlXPathObjectPtr(n_end, 1);
48513
48514 ret_val = xmlXPtrNewRangePoints(start, end);
48515 desret_xmlXPathObjectPtr(ret_val);
48516 call_tests++;
48517 des_xmlXPathObjectPtr(n_start, start, 0);
48518 des_xmlXPathObjectPtr(n_end, end, 1);
48519 xmlResetLastError();
48520 if (mem_base != xmlMemBlocks()) {
48521 printf("Leak of %d blocks found in xmlXPtrNewRangePoints",
48522 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048523 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048524 printf(" %d", n_start);
48525 printf(" %d", n_end);
48526 printf("\n");
48527 }
48528 }
48529 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048530 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048531#endif
48532
Daniel Veillard42595322004-11-08 10:52:06 +000048533 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048534}
48535
48536
48537static int
48538test_xmlXPtrRangeToFunction(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048539 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048540
William M. Brack21e4ef22005-01-02 09:53:13 +000048541#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000048542 int mem_base;
48543 xmlXPathParserContextPtr ctxt; /* the XPointer Parser context */
48544 int n_ctxt;
48545 int nargs; /* the number of args */
48546 int n_nargs;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048547
Daniel Veillardce682bc2004-11-05 17:22:25 +000048548 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
48549 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
48550 mem_base = xmlMemBlocks();
48551 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
48552 nargs = gen_int(n_nargs, 1);
48553
48554 xmlXPtrRangeToFunction(ctxt, nargs);
48555 call_tests++;
48556 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
48557 des_int(n_nargs, nargs, 1);
48558 xmlResetLastError();
48559 if (mem_base != xmlMemBlocks()) {
48560 printf("Leak of %d blocks found in xmlXPtrRangeToFunction",
48561 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048562 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048563 printf(" %d", n_ctxt);
48564 printf(" %d", n_nargs);
48565 printf("\n");
48566 }
48567 }
48568 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048569 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048570#endif
48571
Daniel Veillard42595322004-11-08 10:52:06 +000048572 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048573}
48574
48575
48576static int
48577test_xmlXPtrWrapLocationSet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048578 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048579
William M. Brack21e4ef22005-01-02 09:53:13 +000048580#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000048581 int mem_base;
48582 xmlXPathObjectPtr ret_val;
48583 xmlLocationSetPtr val; /* the LocationSet value */
48584 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048585
Daniel Veillardce682bc2004-11-05 17:22:25 +000048586 for (n_val = 0;n_val < gen_nb_xmlLocationSetPtr;n_val++) {
48587 mem_base = xmlMemBlocks();
48588 val = gen_xmlLocationSetPtr(n_val, 0);
48589
48590 ret_val = xmlXPtrWrapLocationSet(val);
48591 desret_xmlXPathObjectPtr(ret_val);
48592 call_tests++;
48593 des_xmlLocationSetPtr(n_val, val, 0);
48594 xmlResetLastError();
48595 if (mem_base != xmlMemBlocks()) {
48596 printf("Leak of %d blocks found in xmlXPtrWrapLocationSet",
48597 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048598 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048599 printf(" %d", n_val);
48600 printf("\n");
48601 }
48602 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048603 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048604#endif
48605
Daniel Veillard42595322004-11-08 10:52:06 +000048606 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048607}
48608
48609static int
48610test_xpointer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048611 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048612
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048613 if (quiet == 0) printf("Testing xpointer : 17 of 21 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000048614 test_ret += test_xmlXPtrBuildNodeList();
48615 test_ret += test_xmlXPtrEval();
48616 test_ret += test_xmlXPtrEvalRangePredicate();
48617 test_ret += test_xmlXPtrLocationSetAdd();
48618 test_ret += test_xmlXPtrLocationSetCreate();
48619 test_ret += test_xmlXPtrLocationSetDel();
48620 test_ret += test_xmlXPtrLocationSetMerge();
48621 test_ret += test_xmlXPtrLocationSetRemove();
48622 test_ret += test_xmlXPtrNewCollapsedRange();
48623 test_ret += test_xmlXPtrNewContext();
48624 test_ret += test_xmlXPtrNewLocationSetNodeSet();
48625 test_ret += test_xmlXPtrNewLocationSetNodes();
48626 test_ret += test_xmlXPtrNewRange();
48627 test_ret += test_xmlXPtrNewRangeNodeObject();
48628 test_ret += test_xmlXPtrNewRangeNodePoint();
48629 test_ret += test_xmlXPtrNewRangeNodes();
48630 test_ret += test_xmlXPtrNewRangePointNode();
48631 test_ret += test_xmlXPtrNewRangePoints();
48632 test_ret += test_xmlXPtrRangeToFunction();
48633 test_ret += test_xmlXPtrWrapLocationSet();
Daniel Veillardd93f6252004-11-02 15:53:51 +000048634
Daniel Veillard42595322004-11-08 10:52:06 +000048635 if (test_ret != 0)
48636 printf("Module xpointer: %d errors\n", test_ret);
48637 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048638}
Daniel Veillardce244ad2004-11-05 10:03:46 +000048639static int
48640test_module(const char *module) {
48641 if (!strcmp(module, "HTMLparser")) return(test_HTMLparser());
48642 if (!strcmp(module, "HTMLtree")) return(test_HTMLtree());
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000048643 if (!strcmp(module, "SAX2")) return(test_SAX2());
Daniel Veillarda82b1822004-11-08 16:24:57 +000048644 if (!strcmp(module, "c14n")) return(test_c14n());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048645 if (!strcmp(module, "catalog")) return(test_catalog());
48646 if (!strcmp(module, "chvalid")) return(test_chvalid());
Daniel Veillarda82b1822004-11-08 16:24:57 +000048647 if (!strcmp(module, "debugXML")) return(test_debugXML());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048648 if (!strcmp(module, "dict")) return(test_dict());
48649 if (!strcmp(module, "encoding")) return(test_encoding());
48650 if (!strcmp(module, "entities")) return(test_entities());
48651 if (!strcmp(module, "hash")) return(test_hash());
48652 if (!strcmp(module, "list")) return(test_list());
48653 if (!strcmp(module, "nanoftp")) return(test_nanoftp());
48654 if (!strcmp(module, "nanohttp")) return(test_nanohttp());
48655 if (!strcmp(module, "parser")) return(test_parser());
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000048656 if (!strcmp(module, "parserInternals")) return(test_parserInternals());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048657 if (!strcmp(module, "pattern")) return(test_pattern());
48658 if (!strcmp(module, "relaxng")) return(test_relaxng());
48659 if (!strcmp(module, "schemasInternals")) return(test_schemasInternals());
48660 if (!strcmp(module, "tree")) return(test_tree());
48661 if (!strcmp(module, "uri")) return(test_uri());
48662 if (!strcmp(module, "valid")) return(test_valid());
48663 if (!strcmp(module, "xinclude")) return(test_xinclude());
48664 if (!strcmp(module, "xmlIO")) return(test_xmlIO());
Daniel Veillarda82b1822004-11-08 16:24:57 +000048665 if (!strcmp(module, "xmlautomata")) return(test_xmlautomata());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048666 if (!strcmp(module, "xmlerror")) return(test_xmlerror());
Daniel Veillardf6b71bd2005-01-04 17:50:14 +000048667 if (!strcmp(module, "xmlmodule")) return(test_xmlmodule());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048668 if (!strcmp(module, "xmlreader")) return(test_xmlreader());
Daniel Veillarda82b1822004-11-08 16:24:57 +000048669 if (!strcmp(module, "xmlregexp")) return(test_xmlregexp());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048670 if (!strcmp(module, "xmlsave")) return(test_xmlsave());
48671 if (!strcmp(module, "xmlschemas")) return(test_xmlschemas());
48672 if (!strcmp(module, "xmlschemastypes")) return(test_xmlschemastypes());
48673 if (!strcmp(module, "xmlstring")) return(test_xmlstring());
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000048674 if (!strcmp(module, "xmlunicode")) return(test_xmlunicode());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048675 if (!strcmp(module, "xmlwriter")) return(test_xmlwriter());
48676 if (!strcmp(module, "xpath")) return(test_xpath());
Daniel Veillarda82b1822004-11-08 16:24:57 +000048677 if (!strcmp(module, "xpathInternals")) return(test_xpathInternals());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048678 if (!strcmp(module, "xpointer")) return(test_xpointer());
48679 return(0);
48680}