blob: 0cb305b5aee57b857de140cd288731f218ea8d07 [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>
1074#include <libxml/xmlreader.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001075#include <libxml/xmlregexp.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001076#include <libxml/xmlsave.h>
1077#include <libxml/xmlschemas.h>
1078#include <libxml/xmlschemastypes.h>
1079#include <libxml/xmlstring.h>
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +00001080#include <libxml/xmlunicode.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001081#include <libxml/xmlwriter.h>
1082#include <libxml/xpath.h>
Daniel Veillarda82b1822004-11-08 16:24:57 +00001083#include <libxml/xpathInternals.h>
Daniel Veillard34099b42004-11-04 17:34:35 +00001084#include <libxml/xpointer.h>
1085static int test_HTMLparser(void);
1086static int test_HTMLtree(void);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001087static int test_SAX2(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001088static int test_c14n(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001089static int test_catalog(void);
1090static int test_chvalid(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001091static int test_debugXML(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001092static int test_dict(void);
1093static int test_encoding(void);
1094static int test_entities(void);
1095static int test_hash(void);
1096static int test_list(void);
1097static int test_nanoftp(void);
1098static int test_nanohttp(void);
1099static int test_parser(void);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001100static int test_parserInternals(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001101static int test_pattern(void);
1102static int test_relaxng(void);
1103static int test_schemasInternals(void);
1104static int test_tree(void);
1105static int test_uri(void);
1106static int test_valid(void);
1107static int test_xinclude(void);
1108static int test_xmlIO(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001109static int test_xmlautomata(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001110static int test_xmlerror(void);
1111static int test_xmlreader(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001112static int test_xmlregexp(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001113static int test_xmlsave(void);
1114static int test_xmlschemas(void);
1115static int test_xmlschemastypes(void);
1116static int test_xmlstring(void);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +00001117static int test_xmlunicode(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001118static int test_xmlwriter(void);
1119static int test_xpath(void);
Daniel Veillarda82b1822004-11-08 16:24:57 +00001120static int test_xpathInternals(void);
Daniel Veillard34099b42004-11-04 17:34:35 +00001121static int test_xpointer(void);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001122
1123/**
1124 * testlibxml2:
1125 *
1126 * Main entry point of the tester for the full libxml2 module,
1127 * it calls all the tester entry point for each module.
1128 *
1129 * Returns the number of error found
1130 */
1131static int
1132testlibxml2(void)
1133{
Daniel Veillard42595322004-11-08 10:52:06 +00001134 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001135
Daniel Veillard42595322004-11-08 10:52:06 +00001136 test_ret += test_HTMLparser();
1137 test_ret += test_HTMLtree();
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001138 test_ret += test_SAX2();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001139 test_ret += test_c14n();
Daniel Veillard42595322004-11-08 10:52:06 +00001140 test_ret += test_catalog();
1141 test_ret += test_chvalid();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001142 test_ret += test_debugXML();
Daniel Veillard42595322004-11-08 10:52:06 +00001143 test_ret += test_dict();
1144 test_ret += test_encoding();
1145 test_ret += test_entities();
1146 test_ret += test_hash();
1147 test_ret += test_list();
1148 test_ret += test_nanoftp();
1149 test_ret += test_nanohttp();
1150 test_ret += test_parser();
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00001151 test_ret += test_parserInternals();
Daniel Veillard42595322004-11-08 10:52:06 +00001152 test_ret += test_pattern();
1153 test_ret += test_relaxng();
1154 test_ret += test_schemasInternals();
1155 test_ret += test_tree();
1156 test_ret += test_uri();
1157 test_ret += test_valid();
1158 test_ret += test_xinclude();
1159 test_ret += test_xmlIO();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001160 test_ret += test_xmlautomata();
Daniel Veillard42595322004-11-08 10:52:06 +00001161 test_ret += test_xmlerror();
1162 test_ret += test_xmlreader();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001163 test_ret += test_xmlregexp();
Daniel Veillard42595322004-11-08 10:52:06 +00001164 test_ret += test_xmlsave();
1165 test_ret += test_xmlschemas();
1166 test_ret += test_xmlschemastypes();
1167 test_ret += test_xmlstring();
1168 test_ret += test_xmlunicode();
1169 test_ret += test_xmlwriter();
1170 test_ret += test_xpath();
Daniel Veillarda82b1822004-11-08 16:24:57 +00001171 test_ret += test_xpathInternals();
Daniel Veillard42595322004-11-08 10:52:06 +00001172 test_ret += test_xpointer();
Daniel Veillardd93f6252004-11-02 15:53:51 +00001173
Daniel Veillard3d97e662004-11-04 10:49:00 +00001174 printf("Total: %d functions, %d tests, %d errors\n",
Daniel Veillard42595322004-11-08 10:52:06 +00001175 function_tests, call_tests, test_ret);
1176 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001177}
1178
1179
1180static int
1181test_UTF8ToHtml(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001182 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001183
William M. Brack21e4ef22005-01-02 09:53:13 +00001184#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00001185 int mem_base;
1186 int ret_val;
1187 unsigned char * out; /* a pointer to an array of bytes to store the result */
1188 int n_out;
1189 int * outlen; /* the length of @out */
1190 int n_outlen;
1191 unsigned char * in; /* a pointer to an array of UTF-8 chars */
1192 int n_in;
1193 int * inlen; /* the length of @in */
1194 int n_inlen;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001195
Daniel Veillardce682bc2004-11-05 17:22:25 +00001196 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
1197 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
1198 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
1199 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
1200 mem_base = xmlMemBlocks();
1201 out = gen_unsigned_char_ptr(n_out, 0);
1202 outlen = gen_int_ptr(n_outlen, 1);
1203 in = gen_const_unsigned_char_ptr(n_in, 2);
1204 inlen = gen_int_ptr(n_inlen, 3);
1205
William M. Brackf13f77f2004-11-12 16:03:48 +00001206 ret_val = UTF8ToHtml(out, outlen, (const unsigned char *)in, inlen);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001207 desret_int(ret_val);
1208 call_tests++;
1209 des_unsigned_char_ptr(n_out, out, 0);
1210 des_int_ptr(n_outlen, outlen, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00001211 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001212 des_int_ptr(n_inlen, inlen, 3);
1213 xmlResetLastError();
1214 if (mem_base != xmlMemBlocks()) {
1215 printf("Leak of %d blocks found in UTF8ToHtml",
1216 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001217 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001218 printf(" %d", n_out);
1219 printf(" %d", n_outlen);
1220 printf(" %d", n_in);
1221 printf(" %d", n_inlen);
1222 printf("\n");
1223 }
1224 }
1225 }
1226 }
1227 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001228 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001229#endif
1230
Daniel Veillard42595322004-11-08 10:52:06 +00001231 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001232}
1233
Daniel Veillarda521d282004-11-09 14:59:59 +00001234#ifdef LIBXML_HTML_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +00001235
Daniel Veillardce682bc2004-11-05 17:22:25 +00001236#define gen_nb_const_htmlElemDesc_ptr 1
1237static htmlElemDesc * gen_const_htmlElemDesc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1238 return(NULL);
1239}
1240static void des_const_htmlElemDesc_ptr(int no ATTRIBUTE_UNUSED, const htmlElemDesc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1241}
Daniel Veillarda521d282004-11-09 14:59:59 +00001242#endif
1243
Daniel Veillardce682bc2004-11-05 17:22:25 +00001244
Daniel Veillardd93f6252004-11-02 15:53:51 +00001245static int
1246test_htmlAttrAllowed(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001247 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001248
William M. Brack21e4ef22005-01-02 09:53:13 +00001249#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +00001250 int mem_base;
1251 htmlStatus ret_val;
1252 htmlElemDesc * elt; /* HTML element */
1253 int n_elt;
1254 xmlChar * attr; /* HTML attribute */
1255 int n_attr;
1256 int legacy; /* whether to allow deprecated attributes */
1257 int n_legacy;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001258
Daniel Veillard57b25162004-11-06 14:50:18 +00001259 for (n_elt = 0;n_elt < gen_nb_const_htmlElemDesc_ptr;n_elt++) {
1260 for (n_attr = 0;n_attr < gen_nb_const_xmlChar_ptr;n_attr++) {
1261 for (n_legacy = 0;n_legacy < gen_nb_int;n_legacy++) {
1262 mem_base = xmlMemBlocks();
1263 elt = gen_const_htmlElemDesc_ptr(n_elt, 0);
1264 attr = gen_const_xmlChar_ptr(n_attr, 1);
1265 legacy = gen_int(n_legacy, 2);
1266
William M. Brackf13f77f2004-11-12 16:03:48 +00001267 ret_val = htmlAttrAllowed((const htmlElemDesc *)elt, (const xmlChar *)attr, legacy);
Daniel Veillard57b25162004-11-06 14:50:18 +00001268 desret_htmlStatus(ret_val);
1269 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00001270 des_const_htmlElemDesc_ptr(n_elt, (const htmlElemDesc *)elt, 0);
1271 des_const_xmlChar_ptr(n_attr, (const xmlChar *)attr, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +00001272 des_int(n_legacy, legacy, 2);
1273 xmlResetLastError();
1274 if (mem_base != xmlMemBlocks()) {
1275 printf("Leak of %d blocks found in htmlAttrAllowed",
1276 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001277 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00001278 printf(" %d", n_elt);
1279 printf(" %d", n_attr);
1280 printf(" %d", n_legacy);
1281 printf("\n");
1282 }
1283 }
1284 }
1285 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001286 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00001287#endif
1288
Daniel Veillard42595322004-11-08 10:52:06 +00001289 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001290}
1291
Daniel Veillarda521d282004-11-09 14:59:59 +00001292#ifdef LIBXML_HTML_ENABLED
1293
1294#define gen_nb_htmlNodePtr 1
1295static htmlNodePtr gen_htmlNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1296 return(NULL);
1297}
1298static void des_htmlNodePtr(int no ATTRIBUTE_UNUSED, htmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1299}
1300#endif
1301
Daniel Veillardd93f6252004-11-02 15:53:51 +00001302
1303static int
1304test_htmlAutoCloseTag(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001305 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001306
William M. Brack21e4ef22005-01-02 09:53:13 +00001307#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00001308 int mem_base;
1309 int ret_val;
1310 htmlDocPtr doc; /* the HTML document */
1311 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001312 xmlChar * name; /* The tag name */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001313 int n_name;
1314 htmlNodePtr elem; /* the HTML element */
1315 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001316
Daniel Veillarda521d282004-11-09 14:59:59 +00001317 for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001318 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
Daniel Veillarda521d282004-11-09 14:59:59 +00001319 for (n_elem = 0;n_elem < gen_nb_htmlNodePtr;n_elem++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001320 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001321 doc = gen_htmlDocPtr(n_doc, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001322 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarda521d282004-11-09 14:59:59 +00001323 elem = gen_htmlNodePtr(n_elem, 2);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001324
William M. Brackf13f77f2004-11-12 16:03:48 +00001325 ret_val = htmlAutoCloseTag(doc, (const xmlChar *)name, elem);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001326 desret_int(ret_val);
1327 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001328 des_htmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00001329 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarda521d282004-11-09 14:59:59 +00001330 des_htmlNodePtr(n_elem, elem, 2);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001331 xmlResetLastError();
1332 if (mem_base != xmlMemBlocks()) {
1333 printf("Leak of %d blocks found in htmlAutoCloseTag",
1334 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001335 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001336 printf(" %d", n_doc);
1337 printf(" %d", n_name);
1338 printf(" %d", n_elem);
1339 printf("\n");
1340 }
1341 }
1342 }
1343 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001344 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001345#endif
1346
Daniel Veillard42595322004-11-08 10:52:06 +00001347 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001348}
1349
1350
1351static int
1352test_htmlCreateMemoryParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001353 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001354
William M. Brack21e4ef22005-01-02 09:53:13 +00001355#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard34099b42004-11-04 17:34:35 +00001356 int mem_base;
1357 htmlParserCtxtPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001358 char * buffer; /* a pointer to a char array */
Daniel Veillard34099b42004-11-04 17:34:35 +00001359 int n_buffer;
1360 int size; /* the size of the array */
1361 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001362
Daniel Veillard34099b42004-11-04 17:34:35 +00001363 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
1364 for (n_size = 0;n_size < gen_nb_int;n_size++) {
1365 mem_base = xmlMemBlocks();
1366 buffer = gen_const_char_ptr(n_buffer, 0);
1367 size = gen_int(n_size, 1);
1368
William M. Brackf13f77f2004-11-12 16:03:48 +00001369 ret_val = htmlCreateMemoryParserCtxt((const char *)buffer, size);
Daniel Veillarda521d282004-11-09 14:59:59 +00001370 desret_htmlParserCtxtPtr(ret_val);
Daniel Veillard34099b42004-11-04 17:34:35 +00001371 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00001372 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard34099b42004-11-04 17:34:35 +00001373 des_int(n_size, size, 1);
1374 xmlResetLastError();
1375 if (mem_base != xmlMemBlocks()) {
1376 printf("Leak of %d blocks found in htmlCreateMemoryParserCtxt",
1377 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001378 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +00001379 printf(" %d", n_buffer);
1380 printf(" %d", n_size);
1381 printf("\n");
1382 }
1383 }
1384 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001385 function_tests++;
Daniel Veillard34099b42004-11-04 17:34:35 +00001386#endif
1387
Daniel Veillard42595322004-11-08 10:52:06 +00001388 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001389}
1390
Daniel Veillarda521d282004-11-09 14:59:59 +00001391#ifdef LIBXML_HTML_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +00001392
Daniel Veillardce682bc2004-11-05 17:22:25 +00001393#define gen_nb_htmlSAXHandlerPtr 1
1394static htmlSAXHandlerPtr gen_htmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1395 return(NULL);
1396}
1397static void des_htmlSAXHandlerPtr(int no ATTRIBUTE_UNUSED, htmlSAXHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
1398}
Daniel Veillarda521d282004-11-09 14:59:59 +00001399#endif
1400
Daniel Veillardce682bc2004-11-05 17:22:25 +00001401
Daniel Veillardd93f6252004-11-02 15:53:51 +00001402static int
1403test_htmlCreatePushParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001404 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001405
William M. Brack21e4ef22005-01-02 09:53:13 +00001406#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_PUSH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00001407 int mem_base;
1408 htmlParserCtxtPtr ret_val;
1409 htmlSAXHandlerPtr sax; /* a SAX handler */
1410 int n_sax;
1411 void * user_data; /* The user data returned on SAX callbacks */
1412 int n_user_data;
1413 char * chunk; /* a pointer to an array of chars */
1414 int n_chunk;
1415 int size; /* number of chars in the array */
1416 int n_size;
1417 const char * filename; /* an optional file name or URI */
1418 int n_filename;
1419 xmlCharEncoding enc; /* an optional encoding */
1420 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001421
Daniel Veillardce682bc2004-11-05 17:22:25 +00001422 for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) {
1423 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
1424 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
1425 for (n_size = 0;n_size < gen_nb_int;n_size++) {
Daniel Veillard42595322004-11-08 10:52:06 +00001426 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
Daniel Veillardce682bc2004-11-05 17:22:25 +00001427 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
1428 mem_base = xmlMemBlocks();
1429 sax = gen_htmlSAXHandlerPtr(n_sax, 0);
1430 user_data = gen_userdata(n_user_data, 1);
1431 chunk = gen_const_char_ptr(n_chunk, 2);
1432 size = gen_int(n_size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +00001433 filename = gen_fileoutput(n_filename, 4);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001434 enc = gen_xmlCharEncoding(n_enc, 5);
1435
William M. Brackf13f77f2004-11-12 16:03:48 +00001436 ret_val = htmlCreatePushParserCtxt(sax, user_data, (const char *)chunk, size, filename, enc);
Daniel Veillarda521d282004-11-09 14:59:59 +00001437 desret_htmlParserCtxtPtr(ret_val);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001438 call_tests++;
1439 des_htmlSAXHandlerPtr(n_sax, sax, 0);
1440 des_userdata(n_user_data, user_data, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00001441 des_const_char_ptr(n_chunk, (const char *)chunk, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001442 des_int(n_size, size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +00001443 des_fileoutput(n_filename, filename, 4);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001444 des_xmlCharEncoding(n_enc, enc, 5);
1445 xmlResetLastError();
1446 if (mem_base != xmlMemBlocks()) {
1447 printf("Leak of %d blocks found in htmlCreatePushParserCtxt",
1448 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001449 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001450 printf(" %d", n_sax);
1451 printf(" %d", n_user_data);
1452 printf(" %d", n_chunk);
1453 printf(" %d", n_size);
1454 printf(" %d", n_filename);
1455 printf(" %d", n_enc);
1456 printf("\n");
1457 }
1458 }
1459 }
1460 }
1461 }
1462 }
1463 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001464 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001465#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +00001466
Daniel Veillard42595322004-11-08 10:52:06 +00001467 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001468}
1469
1470
1471static int
1472test_htmlCtxtReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001473 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001474
William M. Brack21e4ef22005-01-02 09:53:13 +00001475#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00001476 int mem_base;
1477 htmlDocPtr ret_val;
1478 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1479 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001480 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001481 int n_cur;
1482 const char * URL; /* the base URL to use for the document */
1483 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001484 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001485 int n_encoding;
1486 int options; /* a combination of htmlParserOption(s) */
1487 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001488
Daniel Veillarda521d282004-11-09 14:59:59 +00001489 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001490 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
1491 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
1492 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
1493 for (n_options = 0;n_options < gen_nb_int;n_options++) {
1494 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001495 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001496 cur = gen_const_xmlChar_ptr(n_cur, 1);
1497 URL = gen_filepath(n_URL, 2);
1498 encoding = gen_const_char_ptr(n_encoding, 3);
1499 options = gen_int(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001500
William M. Brackf13f77f2004-11-12 16:03:48 +00001501 ret_val = htmlCtxtReadDoc(ctxt, (const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00001502 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001503 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001504 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00001505 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001506 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00001507 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001508 des_int(n_options, options, 4);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001509 xmlResetLastError();
1510 if (mem_base != xmlMemBlocks()) {
1511 printf("Leak of %d blocks found in htmlCtxtReadDoc",
1512 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001513 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001514 printf(" %d", n_ctxt);
1515 printf(" %d", n_cur);
1516 printf(" %d", n_URL);
1517 printf(" %d", n_encoding);
1518 printf(" %d", n_options);
1519 printf("\n");
1520 }
1521 }
1522 }
1523 }
1524 }
1525 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001526 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001527#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00001528
Daniel Veillard42595322004-11-08 10:52:06 +00001529 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001530}
1531
1532
1533static int
1534test_htmlCtxtReadFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001535 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001536
William M. Brack21e4ef22005-01-02 09:53:13 +00001537#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00001538 htmlDocPtr ret_val;
1539 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1540 int n_ctxt;
1541 const char * filename; /* a file or URL */
1542 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001543 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001544 int n_encoding;
1545 int options; /* a combination of htmlParserOption(s) */
1546 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001547
Daniel Veillarda521d282004-11-09 14:59:59 +00001548 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001549 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
1550 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
1551 for (n_options = 0;n_options < gen_nb_int;n_options++) {
Daniel Veillarda521d282004-11-09 14:59:59 +00001552 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001553 filename = gen_filepath(n_filename, 1);
1554 encoding = gen_const_char_ptr(n_encoding, 2);
1555 options = gen_int(n_options, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001556
William M. Brackf13f77f2004-11-12 16:03:48 +00001557 ret_val = htmlCtxtReadFile(ctxt, filename, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00001558 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001559 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001560 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001561 des_filepath(n_filename, filename, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00001562 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001563 des_int(n_options, options, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001564 xmlResetLastError();
Daniel Veillarda03e3652004-11-02 18:45:30 +00001565 }
1566 }
1567 }
1568 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001569 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001570#endif
1571
Daniel Veillard42595322004-11-08 10:52:06 +00001572 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001573}
1574
1575
1576static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00001577test_htmlCtxtReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001578 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001579
William M. Brack21e4ef22005-01-02 09:53:13 +00001580#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00001581 int mem_base;
1582 htmlDocPtr ret_val;
1583 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1584 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001585 char * buffer; /* a pointer to a char array */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001586 int n_buffer;
1587 int size; /* the size of the array */
1588 int n_size;
1589 const char * URL; /* the base URL to use for the document */
1590 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001591 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00001592 int n_encoding;
1593 int options; /* a combination of htmlParserOption(s) */
1594 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001595
Daniel Veillarda521d282004-11-09 14:59:59 +00001596 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001597 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
1598 for (n_size = 0;n_size < gen_nb_int;n_size++) {
1599 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
1600 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
1601 for (n_options = 0;n_options < gen_nb_int;n_options++) {
1602 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001603 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001604 buffer = gen_const_char_ptr(n_buffer, 1);
1605 size = gen_int(n_size, 2);
1606 URL = gen_filepath(n_URL, 3);
1607 encoding = gen_const_char_ptr(n_encoding, 4);
1608 options = gen_int(n_options, 5);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001609
William M. Brackf13f77f2004-11-12 16:03:48 +00001610 ret_val = htmlCtxtReadMemory(ctxt, (const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00001611 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001612 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001613 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00001614 des_const_char_ptr(n_buffer, (const char *)buffer, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001615 des_int(n_size, size, 2);
1616 des_filepath(n_URL, URL, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +00001617 des_const_char_ptr(n_encoding, (const char *)encoding, 4);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001618 des_int(n_options, options, 5);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001619 xmlResetLastError();
1620 if (mem_base != xmlMemBlocks()) {
1621 printf("Leak of %d blocks found in htmlCtxtReadMemory",
1622 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001623 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001624 printf(" %d", n_ctxt);
1625 printf(" %d", n_buffer);
1626 printf(" %d", n_size);
1627 printf(" %d", n_URL);
1628 printf(" %d", n_encoding);
1629 printf(" %d", n_options);
1630 printf("\n");
1631 }
1632 }
1633 }
1634 }
1635 }
1636 }
1637 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001638 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001639#endif
1640
Daniel Veillard42595322004-11-08 10:52:06 +00001641 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001642}
1643
1644
1645static int
1646test_htmlCtxtReset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001647 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001648
William M. Brack21e4ef22005-01-02 09:53:13 +00001649#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00001650 int mem_base;
1651 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1652 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001653
Daniel Veillarda521d282004-11-09 14:59:59 +00001654 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001655 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001656 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001657
1658 htmlCtxtReset(ctxt);
1659 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001660 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001661 xmlResetLastError();
1662 if (mem_base != xmlMemBlocks()) {
1663 printf("Leak of %d blocks found in htmlCtxtReset",
1664 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001665 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001666 printf(" %d", n_ctxt);
1667 printf("\n");
1668 }
1669 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001670 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001671#endif
1672
Daniel Veillard42595322004-11-08 10:52:06 +00001673 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001674}
1675
1676
1677static int
1678test_htmlCtxtUseOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001679 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001680
William M. Brack21e4ef22005-01-02 09:53:13 +00001681#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00001682 int mem_base;
1683 int ret_val;
1684 htmlParserCtxtPtr ctxt; /* an HTML parser context */
1685 int n_ctxt;
1686 int options; /* a combination of htmlParserOption(s) */
1687 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001688
Daniel Veillarda521d282004-11-09 14:59:59 +00001689 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001690 for (n_options = 0;n_options < gen_nb_int;n_options++) {
1691 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001692 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001693 options = gen_int(n_options, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001694
1695 ret_val = htmlCtxtUseOptions(ctxt, options);
1696 desret_int(ret_val);
1697 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001698 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00001699 des_int(n_options, options, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001700 xmlResetLastError();
1701 if (mem_base != xmlMemBlocks()) {
1702 printf("Leak of %d blocks found in htmlCtxtUseOptions",
1703 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001704 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001705 printf(" %d", n_ctxt);
1706 printf(" %d", n_options);
1707 printf("\n");
1708 }
1709 }
1710 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001711 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001712#endif
1713
Daniel Veillard42595322004-11-08 10:52:06 +00001714 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001715}
1716
1717
1718static int
1719test_htmlElementAllowedHere(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001720 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001721
William M. Brack21e4ef22005-01-02 09:53:13 +00001722#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00001723 int mem_base;
1724 int ret_val;
1725 htmlElemDesc * parent; /* HTML parent element */
1726 int n_parent;
1727 xmlChar * elt; /* HTML element */
1728 int n_elt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001729
Daniel Veillardce682bc2004-11-05 17:22:25 +00001730 for (n_parent = 0;n_parent < gen_nb_const_htmlElemDesc_ptr;n_parent++) {
1731 for (n_elt = 0;n_elt < gen_nb_const_xmlChar_ptr;n_elt++) {
1732 mem_base = xmlMemBlocks();
1733 parent = gen_const_htmlElemDesc_ptr(n_parent, 0);
1734 elt = gen_const_xmlChar_ptr(n_elt, 1);
1735
William M. Brackf13f77f2004-11-12 16:03:48 +00001736 ret_val = htmlElementAllowedHere((const htmlElemDesc *)parent, (const xmlChar *)elt);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001737 desret_int(ret_val);
1738 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00001739 des_const_htmlElemDesc_ptr(n_parent, (const htmlElemDesc *)parent, 0);
1740 des_const_xmlChar_ptr(n_elt, (const xmlChar *)elt, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001741 xmlResetLastError();
1742 if (mem_base != xmlMemBlocks()) {
1743 printf("Leak of %d blocks found in htmlElementAllowedHere",
1744 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001745 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001746 printf(" %d", n_parent);
1747 printf(" %d", n_elt);
1748 printf("\n");
1749 }
1750 }
1751 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001752 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001753#endif
1754
Daniel Veillard42595322004-11-08 10:52:06 +00001755 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001756}
1757
1758
1759static int
1760test_htmlElementStatusHere(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001761 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001762
William M. Brack21e4ef22005-01-02 09:53:13 +00001763#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +00001764 int mem_base;
1765 htmlStatus ret_val;
1766 htmlElemDesc * parent; /* HTML parent element */
1767 int n_parent;
1768 htmlElemDesc * elt; /* HTML element */
1769 int n_elt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001770
Daniel Veillard57b25162004-11-06 14:50:18 +00001771 for (n_parent = 0;n_parent < gen_nb_const_htmlElemDesc_ptr;n_parent++) {
1772 for (n_elt = 0;n_elt < gen_nb_const_htmlElemDesc_ptr;n_elt++) {
1773 mem_base = xmlMemBlocks();
1774 parent = gen_const_htmlElemDesc_ptr(n_parent, 0);
1775 elt = gen_const_htmlElemDesc_ptr(n_elt, 1);
1776
William M. Brackf13f77f2004-11-12 16:03:48 +00001777 ret_val = htmlElementStatusHere((const htmlElemDesc *)parent, (const htmlElemDesc *)elt);
Daniel Veillard57b25162004-11-06 14:50:18 +00001778 desret_htmlStatus(ret_val);
1779 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00001780 des_const_htmlElemDesc_ptr(n_parent, (const htmlElemDesc *)parent, 0);
1781 des_const_htmlElemDesc_ptr(n_elt, (const htmlElemDesc *)elt, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +00001782 xmlResetLastError();
1783 if (mem_base != xmlMemBlocks()) {
1784 printf("Leak of %d blocks found in htmlElementStatusHere",
1785 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001786 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00001787 printf(" %d", n_parent);
1788 printf(" %d", n_elt);
1789 printf("\n");
1790 }
1791 }
1792 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001793 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00001794#endif
1795
Daniel Veillard42595322004-11-08 10:52:06 +00001796 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001797}
1798
1799
1800static int
1801test_htmlEncodeEntities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001802 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001803
William M. Brack21e4ef22005-01-02 09:53:13 +00001804#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00001805 int mem_base;
1806 int ret_val;
1807 unsigned char * out; /* a pointer to an array of bytes to store the result */
1808 int n_out;
1809 int * outlen; /* the length of @out */
1810 int n_outlen;
1811 unsigned char * in; /* a pointer to an array of UTF-8 chars */
1812 int n_in;
1813 int * inlen; /* the length of @in */
1814 int n_inlen;
1815 int quoteChar; /* the quote character to escape (' or ") or zero. */
1816 int n_quoteChar;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001817
Daniel Veillardce682bc2004-11-05 17:22:25 +00001818 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
1819 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
1820 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
1821 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
1822 for (n_quoteChar = 0;n_quoteChar < gen_nb_int;n_quoteChar++) {
1823 mem_base = xmlMemBlocks();
1824 out = gen_unsigned_char_ptr(n_out, 0);
1825 outlen = gen_int_ptr(n_outlen, 1);
1826 in = gen_const_unsigned_char_ptr(n_in, 2);
1827 inlen = gen_int_ptr(n_inlen, 3);
1828 quoteChar = gen_int(n_quoteChar, 4);
1829
William M. Brackf13f77f2004-11-12 16:03:48 +00001830 ret_val = htmlEncodeEntities(out, outlen, (const unsigned char *)in, inlen, quoteChar);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001831 desret_int(ret_val);
1832 call_tests++;
1833 des_unsigned_char_ptr(n_out, out, 0);
1834 des_int_ptr(n_outlen, outlen, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00001835 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00001836 des_int_ptr(n_inlen, inlen, 3);
1837 des_int(n_quoteChar, quoteChar, 4);
1838 xmlResetLastError();
1839 if (mem_base != xmlMemBlocks()) {
1840 printf("Leak of %d blocks found in htmlEncodeEntities",
1841 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001842 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001843 printf(" %d", n_out);
1844 printf(" %d", n_outlen);
1845 printf(" %d", n_in);
1846 printf(" %d", n_inlen);
1847 printf(" %d", n_quoteChar);
1848 printf("\n");
1849 }
1850 }
1851 }
1852 }
1853 }
1854 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001855 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00001856#endif
1857
Daniel Veillard42595322004-11-08 10:52:06 +00001858 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001859}
1860
1861
1862static int
1863test_htmlEntityLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001864 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001865
William M. Brack21e4ef22005-01-02 09:53:13 +00001866#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +00001867 int mem_base;
1868 const htmlEntityDesc * ret_val;
1869 xmlChar * name; /* the entity name */
1870 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001871
Daniel Veillard42595322004-11-08 10:52:06 +00001872 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
1873 mem_base = xmlMemBlocks();
1874 name = gen_const_xmlChar_ptr(n_name, 0);
1875
William M. Brackf13f77f2004-11-12 16:03:48 +00001876 ret_val = htmlEntityLookup((const xmlChar *)name);
Daniel Veillard42595322004-11-08 10:52:06 +00001877 desret_const_htmlEntityDesc_ptr(ret_val);
1878 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00001879 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillard42595322004-11-08 10:52:06 +00001880 xmlResetLastError();
1881 if (mem_base != xmlMemBlocks()) {
1882 printf("Leak of %d blocks found in htmlEntityLookup",
1883 xmlMemBlocks() - mem_base);
1884 test_ret++;
1885 printf(" %d", n_name);
1886 printf("\n");
1887 }
1888 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001889 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00001890#endif
1891
Daniel Veillard42595322004-11-08 10:52:06 +00001892 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001893}
1894
1895
1896static int
1897test_htmlEntityValueLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001898 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001899
William M. Brack21e4ef22005-01-02 09:53:13 +00001900#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +00001901 int mem_base;
1902 const htmlEntityDesc * ret_val;
1903 unsigned int value; /* the entity's unicode value */
1904 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001905
Daniel Veillard42595322004-11-08 10:52:06 +00001906 for (n_value = 0;n_value < gen_nb_unsigned_int;n_value++) {
1907 mem_base = xmlMemBlocks();
1908 value = gen_unsigned_int(n_value, 0);
1909
1910 ret_val = htmlEntityValueLookup(value);
1911 desret_const_htmlEntityDesc_ptr(ret_val);
1912 call_tests++;
1913 des_unsigned_int(n_value, value, 0);
1914 xmlResetLastError();
1915 if (mem_base != xmlMemBlocks()) {
1916 printf("Leak of %d blocks found in htmlEntityValueLookup",
1917 xmlMemBlocks() - mem_base);
1918 test_ret++;
1919 printf(" %d", n_value);
1920 printf("\n");
1921 }
1922 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001923 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00001924#endif
1925
Daniel Veillard42595322004-11-08 10:52:06 +00001926 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001927}
1928
1929
1930static int
1931test_htmlHandleOmittedElem(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001932 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001933
William M. Brack21e4ef22005-01-02 09:53:13 +00001934#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00001935 int mem_base;
1936 int ret_val;
1937 int val; /* int 0 or 1 */
1938 int n_val;
1939
1940 for (n_val = 0;n_val < gen_nb_int;n_val++) {
1941 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00001942 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001943
1944 ret_val = htmlHandleOmittedElem(val);
1945 desret_int(ret_val);
1946 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00001947 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001948 xmlResetLastError();
1949 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001950 printf("Leak of %d blocks found in htmlHandleOmittedElem",
Daniel Veillardd93f6252004-11-02 15:53:51 +00001951 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001952 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001953 printf(" %d", n_val);
1954 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00001955 }
1956 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001957 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001958#endif
1959
Daniel Veillard42595322004-11-08 10:52:06 +00001960 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00001961}
1962
1963
1964static int
1965test_htmlIsAutoClosed(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00001966 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001967
William M. Brack21e4ef22005-01-02 09:53:13 +00001968#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00001969 int mem_base;
1970 int ret_val;
1971 htmlDocPtr doc; /* the HTML document */
1972 int n_doc;
1973 htmlNodePtr elem; /* the HTML element */
1974 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +00001975
Daniel Veillarda521d282004-11-09 14:59:59 +00001976 for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) {
1977 for (n_elem = 0;n_elem < gen_nb_htmlNodePtr;n_elem++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00001978 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00001979 doc = gen_htmlDocPtr(n_doc, 0);
1980 elem = gen_htmlNodePtr(n_elem, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001981
1982 ret_val = htmlIsAutoClosed(doc, elem);
1983 desret_int(ret_val);
1984 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00001985 des_htmlDocPtr(n_doc, doc, 0);
1986 des_htmlNodePtr(n_elem, elem, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00001987 xmlResetLastError();
1988 if (mem_base != xmlMemBlocks()) {
1989 printf("Leak of %d blocks found in htmlIsAutoClosed",
1990 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00001991 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001992 printf(" %d", n_doc);
1993 printf(" %d", n_elem);
1994 printf("\n");
1995 }
1996 }
1997 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00001998 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00001999#endif
2000
Daniel Veillard42595322004-11-08 10:52:06 +00002001 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002002}
2003
2004
2005static int
2006test_htmlIsScriptAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002007 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002008
William M. Brack21e4ef22005-01-02 09:53:13 +00002009#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00002010 int mem_base;
2011 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002012 xmlChar * name; /* an attribute name */
Daniel Veillardd93f6252004-11-02 15:53:51 +00002013 int n_name;
2014
2015 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
2016 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002017 name = gen_const_xmlChar_ptr(n_name, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002018
William M. Brackf13f77f2004-11-12 16:03:48 +00002019 ret_val = htmlIsScriptAttribute((const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002020 desret_int(ret_val);
2021 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002022 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002023 xmlResetLastError();
2024 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002025 printf("Leak of %d blocks found in htmlIsScriptAttribute",
Daniel Veillardd93f6252004-11-02 15:53:51 +00002026 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002027 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002028 printf(" %d", n_name);
2029 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00002030 }
2031 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002032 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002033#endif
2034
Daniel Veillard42595322004-11-08 10:52:06 +00002035 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002036}
2037
2038
2039static int
2040test_htmlNodeStatus(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002041 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002042
William M. Brack21e4ef22005-01-02 09:53:13 +00002043#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +00002044 int mem_base;
2045 htmlStatus ret_val;
2046 htmlNodePtr node; /* an htmlNodePtr in a tree */
2047 int n_node;
2048 int legacy; /* whether to allow deprecated elements (YES is faster here for Element nodes) */
2049 int n_legacy;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002050
Daniel Veillarda521d282004-11-09 14:59:59 +00002051 for (n_node = 0;n_node < gen_nb_const_htmlNodePtr;n_node++) {
Daniel Veillard57b25162004-11-06 14:50:18 +00002052 for (n_legacy = 0;n_legacy < gen_nb_int;n_legacy++) {
2053 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002054 node = gen_const_htmlNodePtr(n_node, 0);
Daniel Veillard57b25162004-11-06 14:50:18 +00002055 legacy = gen_int(n_legacy, 1);
2056
William M. Brackf13f77f2004-11-12 16:03:48 +00002057 ret_val = htmlNodeStatus((const htmlNodePtr)node, legacy);
Daniel Veillard57b25162004-11-06 14:50:18 +00002058 desret_htmlStatus(ret_val);
2059 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002060 des_const_htmlNodePtr(n_node, (const htmlNodePtr)node, 0);
Daniel Veillard57b25162004-11-06 14:50:18 +00002061 des_int(n_legacy, legacy, 1);
2062 xmlResetLastError();
2063 if (mem_base != xmlMemBlocks()) {
2064 printf("Leak of %d blocks found in htmlNodeStatus",
2065 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002066 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00002067 printf(" %d", n_node);
2068 printf(" %d", n_legacy);
2069 printf("\n");
2070 }
2071 }
2072 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002073 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00002074#endif
2075
Daniel Veillard42595322004-11-08 10:52:06 +00002076 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002077}
2078
2079
2080static int
2081test_htmlParseCharRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002082 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002083
William M. Brack21e4ef22005-01-02 09:53:13 +00002084#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002085 int mem_base;
2086 int ret_val;
2087 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2088 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002089
Daniel Veillarda521d282004-11-09 14:59:59 +00002090 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002091 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002092 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002093
2094 ret_val = htmlParseCharRef(ctxt);
2095 desret_int(ret_val);
2096 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002097 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002098 xmlResetLastError();
2099 if (mem_base != xmlMemBlocks()) {
2100 printf("Leak of %d blocks found in htmlParseCharRef",
2101 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002102 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002103 printf(" %d", n_ctxt);
2104 printf("\n");
2105 }
2106 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002107 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002108#endif
2109
Daniel Veillard42595322004-11-08 10:52:06 +00002110 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002111}
2112
2113
2114static int
2115test_htmlParseChunk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002116 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002117
William M. Brack21e4ef22005-01-02 09:53:13 +00002118#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_PUSH_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002119 int mem_base;
2120 int ret_val;
2121 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2122 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002123 char * chunk; /* an char array */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002124 int n_chunk;
2125 int size; /* the size in byte of the chunk */
2126 int n_size;
2127 int terminate; /* last chunk indicator */
2128 int n_terminate;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002129
Daniel Veillarda521d282004-11-09 14:59:59 +00002130 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002131 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
2132 for (n_size = 0;n_size < gen_nb_int;n_size++) {
2133 for (n_terminate = 0;n_terminate < gen_nb_int;n_terminate++) {
2134 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002135 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002136 chunk = gen_const_char_ptr(n_chunk, 1);
2137 size = gen_int(n_size, 2);
2138 terminate = gen_int(n_terminate, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002139
William M. Brackf13f77f2004-11-12 16:03:48 +00002140 ret_val = htmlParseChunk(ctxt, (const char *)chunk, size, terminate);
Daniel Veillarda521d282004-11-09 14:59:59 +00002141 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillarda03e3652004-11-02 18:45:30 +00002142 desret_int(ret_val);
2143 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002144 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002145 des_const_char_ptr(n_chunk, (const char *)chunk, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002146 des_int(n_size, size, 2);
2147 des_int(n_terminate, terminate, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002148 xmlResetLastError();
2149 if (mem_base != xmlMemBlocks()) {
2150 printf("Leak of %d blocks found in htmlParseChunk",
2151 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002152 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002153 printf(" %d", n_ctxt);
2154 printf(" %d", n_chunk);
2155 printf(" %d", n_size);
2156 printf(" %d", n_terminate);
2157 printf("\n");
2158 }
2159 }
2160 }
2161 }
2162 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002163 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002164#endif
Daniel Veillarda03e3652004-11-02 18:45:30 +00002165
Daniel Veillard42595322004-11-08 10:52:06 +00002166 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002167}
2168
2169
2170static int
2171test_htmlParseDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002172 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002173
William M. Brack21e4ef22005-01-02 09:53:13 +00002174#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002175 int mem_base;
2176 htmlDocPtr ret_val;
2177 xmlChar * cur; /* a pointer to an array of xmlChar */
2178 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002179 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002180 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002181
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002182 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
2183 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2184 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002185 cur = gen_xmlChar_ptr(n_cur, 0);
2186 encoding = gen_const_char_ptr(n_encoding, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002187
William M. Brackf13f77f2004-11-12 16:03:48 +00002188 ret_val = htmlParseDoc(cur, (const char *)encoding);
Daniel Veillarda521d282004-11-09 14:59:59 +00002189 desret_htmlDocPtr(ret_val);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002190 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002191 des_xmlChar_ptr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002192 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002193 xmlResetLastError();
2194 if (mem_base != xmlMemBlocks()) {
2195 printf("Leak of %d blocks found in htmlParseDoc",
2196 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002197 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002198 printf(" %d", n_cur);
2199 printf(" %d", n_encoding);
2200 printf("\n");
2201 }
2202 }
2203 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002204 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00002205#endif
2206
Daniel Veillard42595322004-11-08 10:52:06 +00002207 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002208}
2209
2210
2211static int
2212test_htmlParseDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002213 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002214
William M. Brack21e4ef22005-01-02 09:53:13 +00002215#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002216 int mem_base;
2217 int ret_val;
2218 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2219 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002220
Daniel Veillarda521d282004-11-09 14:59:59 +00002221 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002222 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002223 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002224
2225 ret_val = htmlParseDocument(ctxt);
Daniel Veillarda521d282004-11-09 14:59:59 +00002226 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillarda03e3652004-11-02 18:45:30 +00002227 desret_int(ret_val);
2228 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002229 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002230 xmlResetLastError();
2231 if (mem_base != xmlMemBlocks()) {
2232 printf("Leak of %d blocks found in htmlParseDocument",
2233 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002234 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002235 printf(" %d", n_ctxt);
2236 printf("\n");
2237 }
2238 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002239 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002240#endif
2241
Daniel Veillard42595322004-11-08 10:52:06 +00002242 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002243}
2244
2245
2246static int
2247test_htmlParseElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002248 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002249
William M. Brack21e4ef22005-01-02 09:53:13 +00002250#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002251 int mem_base;
2252 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2253 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002254
Daniel Veillarda521d282004-11-09 14:59:59 +00002255 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002256 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002257 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002258
2259 htmlParseElement(ctxt);
2260 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002261 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002262 xmlResetLastError();
2263 if (mem_base != xmlMemBlocks()) {
2264 printf("Leak of %d blocks found in htmlParseElement",
2265 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002266 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002267 printf(" %d", n_ctxt);
2268 printf("\n");
2269 }
2270 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002271 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002272#endif
2273
Daniel Veillard42595322004-11-08 10:52:06 +00002274 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002275}
2276
2277
2278static int
2279test_htmlParseEntityRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002280 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002281
William M. Brack21e4ef22005-01-02 09:53:13 +00002282#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +00002283 int mem_base;
2284 const htmlEntityDesc * ret_val;
2285 htmlParserCtxtPtr ctxt; /* an HTML parser context */
2286 int n_ctxt;
2287 xmlChar ** str; /* location to store the entity name */
2288 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002289
Daniel Veillarda521d282004-11-09 14:59:59 +00002290 for (n_ctxt = 0;n_ctxt < gen_nb_htmlParserCtxtPtr;n_ctxt++) {
Daniel Veillard42595322004-11-08 10:52:06 +00002291 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr_ptr;n_str++) {
2292 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002293 ctxt = gen_htmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard42595322004-11-08 10:52:06 +00002294 str = gen_const_xmlChar_ptr_ptr(n_str, 1);
2295
William M. Brackf13f77f2004-11-12 16:03:48 +00002296 ret_val = htmlParseEntityRef(ctxt, (const xmlChar **)str);
Daniel Veillard42595322004-11-08 10:52:06 +00002297 desret_const_htmlEntityDesc_ptr(ret_val);
2298 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002299 des_htmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002300 des_const_xmlChar_ptr_ptr(n_str, (const xmlChar **)str, 1);
Daniel Veillard42595322004-11-08 10:52:06 +00002301 xmlResetLastError();
2302 if (mem_base != xmlMemBlocks()) {
2303 printf("Leak of %d blocks found in htmlParseEntityRef",
2304 xmlMemBlocks() - mem_base);
2305 test_ret++;
2306 printf(" %d", n_ctxt);
2307 printf(" %d", n_str);
2308 printf("\n");
2309 }
2310 }
2311 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002312 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +00002313#endif
2314
Daniel Veillard42595322004-11-08 10:52:06 +00002315 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002316}
2317
2318
2319static int
2320test_htmlParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002321 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002322
William M. Brack21e4ef22005-01-02 09:53:13 +00002323#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002324 htmlDocPtr ret_val;
2325 const char * filename; /* the filename */
2326 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002327 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002328 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002329
Daniel Veillarda03e3652004-11-02 18:45:30 +00002330 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
2331 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00002332 filename = gen_filepath(n_filename, 0);
2333 encoding = gen_const_char_ptr(n_encoding, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002334
William M. Brackf13f77f2004-11-12 16:03:48 +00002335 ret_val = htmlParseFile(filename, (const char *)encoding);
Daniel Veillarda521d282004-11-09 14:59:59 +00002336 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002337 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002338 des_filepath(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002339 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002340 xmlResetLastError();
2341 }
2342 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002343 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002344#endif
2345
Daniel Veillard42595322004-11-08 10:52:06 +00002346 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002347}
2348
2349
2350static int
2351test_htmlReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002352 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002353
William M. Brack21e4ef22005-01-02 09:53:13 +00002354#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002355 int mem_base;
2356 htmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002357 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002358 int n_cur;
2359 const char * URL; /* the base URL to use for the document */
2360 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002361 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002362 int n_encoding;
2363 int options; /* a combination of htmlParserOption(s) */
2364 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002365
Daniel Veillarda03e3652004-11-02 18:45:30 +00002366 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
2367 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
2368 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2369 for (n_options = 0;n_options < gen_nb_int;n_options++) {
2370 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002371 cur = gen_const_xmlChar_ptr(n_cur, 0);
2372 URL = gen_filepath(n_URL, 1);
2373 encoding = gen_const_char_ptr(n_encoding, 2);
2374 options = gen_int(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002375
William M. Brackf13f77f2004-11-12 16:03:48 +00002376 ret_val = htmlReadDoc((const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00002377 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002378 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002379 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002380 des_filepath(n_URL, URL, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00002381 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002382 des_int(n_options, options, 3);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002383 xmlResetLastError();
2384 if (mem_base != xmlMemBlocks()) {
2385 printf("Leak of %d blocks found in htmlReadDoc",
2386 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002387 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002388 printf(" %d", n_cur);
2389 printf(" %d", n_URL);
2390 printf(" %d", n_encoding);
2391 printf(" %d", n_options);
2392 printf("\n");
2393 }
2394 }
2395 }
2396 }
2397 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002398 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002399#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00002400
Daniel Veillard42595322004-11-08 10:52:06 +00002401 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002402}
2403
2404
2405static int
2406test_htmlReadFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002407 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002408
William M. Brack21e4ef22005-01-02 09:53:13 +00002409#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002410 int mem_base;
2411 htmlDocPtr ret_val;
2412 const char * filename; /* a file or URL */
2413 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002414 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002415 int n_encoding;
2416 int options; /* a combination of htmlParserOption(s) */
2417 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002418
Daniel Veillarda03e3652004-11-02 18:45:30 +00002419 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
2420 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2421 for (n_options = 0;n_options < gen_nb_int;n_options++) {
2422 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002423 filename = gen_filepath(n_filename, 0);
2424 encoding = gen_const_char_ptr(n_encoding, 1);
2425 options = gen_int(n_options, 2);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002426
William M. Brackf13f77f2004-11-12 16:03:48 +00002427 ret_val = htmlReadFile(filename, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00002428 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002429 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002430 des_filepath(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002431 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002432 des_int(n_options, options, 2);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002433 xmlResetLastError();
2434 if (mem_base != xmlMemBlocks()) {
2435 printf("Leak of %d blocks found in htmlReadFile",
2436 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002437 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002438 printf(" %d", n_filename);
2439 printf(" %d", n_encoding);
2440 printf(" %d", n_options);
2441 printf("\n");
2442 }
2443 }
2444 }
2445 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002446 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002447#endif
2448
Daniel Veillard42595322004-11-08 10:52:06 +00002449 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002450}
2451
2452
2453static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00002454test_htmlReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002455 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002456
William M. Brack21e4ef22005-01-02 09:53:13 +00002457#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002458 int mem_base;
2459 htmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002460 char * buffer; /* a pointer to a char array */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002461 int n_buffer;
2462 int size; /* the size of the array */
2463 int n_size;
2464 const char * URL; /* the base URL to use for the document */
2465 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002466 char * encoding; /* the document encoding, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002467 int n_encoding;
2468 int options; /* a combination of htmlParserOption(s) */
2469 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002470
Daniel Veillarda03e3652004-11-02 18:45:30 +00002471 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
2472 for (n_size = 0;n_size < gen_nb_int;n_size++) {
2473 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
2474 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2475 for (n_options = 0;n_options < gen_nb_int;n_options++) {
2476 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002477 buffer = gen_const_char_ptr(n_buffer, 0);
2478 size = gen_int(n_size, 1);
2479 URL = gen_filepath(n_URL, 2);
2480 encoding = gen_const_char_ptr(n_encoding, 3);
2481 options = gen_int(n_options, 4);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002482
William M. Brackf13f77f2004-11-12 16:03:48 +00002483 ret_val = htmlReadMemory((const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillarda521d282004-11-09 14:59:59 +00002484 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002485 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002486 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002487 des_int(n_size, size, 1);
2488 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00002489 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002490 des_int(n_options, options, 4);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002491 xmlResetLastError();
2492 if (mem_base != xmlMemBlocks()) {
2493 printf("Leak of %d blocks found in htmlReadMemory",
2494 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002495 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002496 printf(" %d", n_buffer);
2497 printf(" %d", n_size);
2498 printf(" %d", n_URL);
2499 printf(" %d", n_encoding);
2500 printf(" %d", n_options);
2501 printf("\n");
2502 }
2503 }
2504 }
2505 }
2506 }
2507 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002508 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002509#endif
2510
Daniel Veillard42595322004-11-08 10:52:06 +00002511 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002512}
2513
2514
2515static int
2516test_htmlSAXParseDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002517 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002518
William M. Brack21e4ef22005-01-02 09:53:13 +00002519#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00002520 int mem_base;
2521 htmlDocPtr ret_val;
2522 xmlChar * cur; /* a pointer to an array of xmlChar */
2523 int n_cur;
2524 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
2525 int n_encoding;
2526 htmlSAXHandlerPtr sax; /* the SAX handler block */
2527 int n_sax;
2528 void * userData; /* if using SAX, this pointer will be provided on callbacks. */
2529 int n_userData;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002530
Daniel Veillardce682bc2004-11-05 17:22:25 +00002531 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
2532 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2533 for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) {
2534 for (n_userData = 0;n_userData < gen_nb_userdata;n_userData++) {
2535 mem_base = xmlMemBlocks();
2536 cur = gen_xmlChar_ptr(n_cur, 0);
2537 encoding = gen_const_char_ptr(n_encoding, 1);
2538 sax = gen_htmlSAXHandlerPtr(n_sax, 2);
2539 userData = gen_userdata(n_userData, 3);
2540
William M. Brackf13f77f2004-11-12 16:03:48 +00002541 ret_val = htmlSAXParseDoc(cur, (const char *)encoding, sax, userData);
Daniel Veillarda521d282004-11-09 14:59:59 +00002542 desret_htmlDocPtr(ret_val);
Daniel Veillardce682bc2004-11-05 17:22:25 +00002543 call_tests++;
2544 des_xmlChar_ptr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002545 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00002546 des_htmlSAXHandlerPtr(n_sax, sax, 2);
2547 des_userdata(n_userData, userData, 3);
2548 xmlResetLastError();
2549 if (mem_base != xmlMemBlocks()) {
2550 printf("Leak of %d blocks found in htmlSAXParseDoc",
2551 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002552 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002553 printf(" %d", n_cur);
2554 printf(" %d", n_encoding);
2555 printf(" %d", n_sax);
2556 printf(" %d", n_userData);
2557 printf("\n");
2558 }
2559 }
2560 }
2561 }
2562 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002563 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002564#endif
2565
Daniel Veillard42595322004-11-08 10:52:06 +00002566 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002567}
2568
2569
2570static int
2571test_htmlSAXParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002572 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002573
William M. Brack21e4ef22005-01-02 09:53:13 +00002574#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00002575 int mem_base;
2576 htmlDocPtr ret_val;
2577 const char * filename; /* the filename */
2578 int n_filename;
2579 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
2580 int n_encoding;
2581 htmlSAXHandlerPtr sax; /* the SAX handler block */
2582 int n_sax;
2583 void * userData; /* if using SAX, this pointer will be provided on callbacks. */
2584 int n_userData;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002585
Daniel Veillardce682bc2004-11-05 17:22:25 +00002586 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
2587 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2588 for (n_sax = 0;n_sax < gen_nb_htmlSAXHandlerPtr;n_sax++) {
2589 for (n_userData = 0;n_userData < gen_nb_userdata;n_userData++) {
2590 mem_base = xmlMemBlocks();
2591 filename = gen_filepath(n_filename, 0);
2592 encoding = gen_const_char_ptr(n_encoding, 1);
2593 sax = gen_htmlSAXHandlerPtr(n_sax, 2);
2594 userData = gen_userdata(n_userData, 3);
2595
William M. Brackf13f77f2004-11-12 16:03:48 +00002596 ret_val = htmlSAXParseFile(filename, (const char *)encoding, sax, userData);
Daniel Veillarda521d282004-11-09 14:59:59 +00002597 desret_htmlDocPtr(ret_val);
Daniel Veillardce682bc2004-11-05 17:22:25 +00002598 call_tests++;
2599 des_filepath(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00002600 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00002601 des_htmlSAXHandlerPtr(n_sax, sax, 2);
2602 des_userdata(n_userData, userData, 3);
2603 xmlResetLastError();
2604 if (mem_base != xmlMemBlocks()) {
2605 printf("Leak of %d blocks found in htmlSAXParseFile",
2606 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002607 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002608 printf(" %d", n_filename);
2609 printf(" %d", n_encoding);
2610 printf(" %d", n_sax);
2611 printf(" %d", n_userData);
2612 printf("\n");
2613 }
2614 }
2615 }
2616 }
2617 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002618 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002619#endif
2620
Daniel Veillard42595322004-11-08 10:52:06 +00002621 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002622}
2623
2624
2625static int
2626test_htmlTagLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002627 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002628
2629
2630 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00002631 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002632}
2633
2634static int
2635test_HTMLparser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002636 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002637
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002638 if (quiet == 0) printf("Testing HTMLparser : 31 of 37 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00002639 test_ret += test_UTF8ToHtml();
2640 test_ret += test_htmlAttrAllowed();
2641 test_ret += test_htmlAutoCloseTag();
2642 test_ret += test_htmlCreateMemoryParserCtxt();
2643 test_ret += test_htmlCreatePushParserCtxt();
2644 test_ret += test_htmlCtxtReadDoc();
2645 test_ret += test_htmlCtxtReadFile();
2646 test_ret += test_htmlCtxtReadMemory();
2647 test_ret += test_htmlCtxtReset();
2648 test_ret += test_htmlCtxtUseOptions();
2649 test_ret += test_htmlElementAllowedHere();
2650 test_ret += test_htmlElementStatusHere();
2651 test_ret += test_htmlEncodeEntities();
2652 test_ret += test_htmlEntityLookup();
2653 test_ret += test_htmlEntityValueLookup();
2654 test_ret += test_htmlHandleOmittedElem();
2655 test_ret += test_htmlIsAutoClosed();
2656 test_ret += test_htmlIsScriptAttribute();
2657 test_ret += test_htmlNodeStatus();
2658 test_ret += test_htmlParseCharRef();
2659 test_ret += test_htmlParseChunk();
2660 test_ret += test_htmlParseDoc();
2661 test_ret += test_htmlParseDocument();
2662 test_ret += test_htmlParseElement();
2663 test_ret += test_htmlParseEntityRef();
2664 test_ret += test_htmlParseFile();
2665 test_ret += test_htmlReadDoc();
2666 test_ret += test_htmlReadFile();
2667 test_ret += test_htmlReadMemory();
2668 test_ret += test_htmlSAXParseDoc();
2669 test_ret += test_htmlSAXParseFile();
2670 test_ret += test_htmlTagLookup();
Daniel Veillardd93f6252004-11-02 15:53:51 +00002671
Daniel Veillard42595322004-11-08 10:52:06 +00002672 if (test_ret != 0)
2673 printf("Module HTMLparser: %d errors\n", test_ret);
2674 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002675}
2676
2677static int
2678test_htmlDocContentDumpFormatOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002679 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002680
William M. Brack21e4ef22005-01-02 09:53:13 +00002681#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +00002682 int mem_base;
2683 xmlOutputBufferPtr buf; /* the HTML buffer output */
2684 int n_buf;
2685 xmlDocPtr cur; /* the document */
2686 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002687 char * encoding; /* the encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +00002688 int n_encoding;
2689 int format; /* should formatting spaces been added */
2690 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002691
Daniel Veillard3d97e662004-11-04 10:49:00 +00002692 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
2693 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
2694 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2695 for (n_format = 0;n_format < gen_nb_int;n_format++) {
2696 mem_base = xmlMemBlocks();
2697 buf = gen_xmlOutputBufferPtr(n_buf, 0);
2698 cur = gen_xmlDocPtr(n_cur, 1);
2699 encoding = gen_const_char_ptr(n_encoding, 2);
2700 format = gen_int(n_format, 3);
2701
William M. Brackf13f77f2004-11-12 16:03:48 +00002702 htmlDocContentDumpFormatOutput(buf, cur, (const char *)encoding, format);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002703 call_tests++;
2704 des_xmlOutputBufferPtr(n_buf, buf, 0);
2705 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00002706 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002707 des_int(n_format, format, 3);
2708 xmlResetLastError();
2709 if (mem_base != xmlMemBlocks()) {
2710 printf("Leak of %d blocks found in htmlDocContentDumpFormatOutput",
2711 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002712 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002713 printf(" %d", n_buf);
2714 printf(" %d", n_cur);
2715 printf(" %d", n_encoding);
2716 printf(" %d", n_format);
2717 printf("\n");
2718 }
2719 }
2720 }
2721 }
2722 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002723 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002724#endif
Daniel Veillard3d97e662004-11-04 10:49:00 +00002725
Daniel Veillard42595322004-11-08 10:52:06 +00002726 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002727}
2728
2729
2730static int
2731test_htmlDocContentDumpOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002732 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002733
William M. Brack21e4ef22005-01-02 09:53:13 +00002734#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +00002735 int mem_base;
2736 xmlOutputBufferPtr buf; /* the HTML buffer output */
2737 int n_buf;
2738 xmlDocPtr cur; /* the document */
2739 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002740 char * encoding; /* the encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +00002741 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002742
Daniel Veillard3d97e662004-11-04 10:49:00 +00002743 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
2744 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
2745 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
2746 mem_base = xmlMemBlocks();
2747 buf = gen_xmlOutputBufferPtr(n_buf, 0);
2748 cur = gen_xmlDocPtr(n_cur, 1);
2749 encoding = gen_const_char_ptr(n_encoding, 2);
2750
William M. Brackf13f77f2004-11-12 16:03:48 +00002751 htmlDocContentDumpOutput(buf, cur, (const char *)encoding);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002752 call_tests++;
2753 des_xmlOutputBufferPtr(n_buf, buf, 0);
2754 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00002755 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00002756 xmlResetLastError();
2757 if (mem_base != xmlMemBlocks()) {
2758 printf("Leak of %d blocks found in htmlDocContentDumpOutput",
2759 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002760 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002761 printf(" %d", n_buf);
2762 printf(" %d", n_cur);
2763 printf(" %d", n_encoding);
2764 printf("\n");
2765 }
2766 }
2767 }
2768 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002769 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00002770#endif
Daniel Veillard3d97e662004-11-04 10:49:00 +00002771
Daniel Veillard42595322004-11-08 10:52:06 +00002772 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002773}
2774
2775
2776static int
2777test_htmlDocDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002778 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002779
William M. Brack21e4ef22005-01-02 09:53:13 +00002780#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00002781 int mem_base;
2782 int ret_val;
2783 FILE * f; /* the FILE* */
2784 int n_f;
2785 xmlDocPtr cur; /* the document */
2786 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002787
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00002788 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
2789 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
2790 mem_base = xmlMemBlocks();
2791 f = gen_FILE_ptr(n_f, 0);
2792 cur = gen_xmlDocPtr(n_cur, 1);
2793
2794 ret_val = htmlDocDump(f, cur);
2795 desret_int(ret_val);
2796 call_tests++;
2797 des_FILE_ptr(n_f, f, 0);
2798 des_xmlDocPtr(n_cur, cur, 1);
2799 xmlResetLastError();
2800 if (mem_base != xmlMemBlocks()) {
2801 printf("Leak of %d blocks found in htmlDocDump",
2802 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002803 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00002804 printf(" %d", n_f);
2805 printf(" %d", n_cur);
2806 printf("\n");
2807 }
2808 }
2809 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002810 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00002811#endif
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00002812
Daniel Veillard42595322004-11-08 10:52:06 +00002813 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002814}
2815
2816
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002817#define gen_nb_xmlChar_ptr_ptr 1
2818static xmlChar ** gen_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
2819 return(NULL);
2820}
2821static void des_xmlChar_ptr_ptr(int no ATTRIBUTE_UNUSED, xmlChar ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
2822}
2823
Daniel Veillardd93f6252004-11-02 15:53:51 +00002824static int
2825test_htmlDocDumpMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002826 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002827
William M. Brack21e4ef22005-01-02 09:53:13 +00002828#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002829 int mem_base;
2830 xmlDocPtr cur; /* the document */
2831 int n_cur;
2832 xmlChar ** mem; /* OUT: the memory pointer */
2833 int n_mem;
2834 int * size; /* OUT: the memory length */
2835 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002836
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002837 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
2838 for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) {
2839 for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) {
2840 mem_base = xmlMemBlocks();
2841 cur = gen_xmlDocPtr(n_cur, 0);
2842 mem = gen_xmlChar_ptr_ptr(n_mem, 1);
2843 size = gen_int_ptr(n_size, 2);
2844
2845 htmlDocDumpMemory(cur, mem, size);
2846 call_tests++;
2847 des_xmlDocPtr(n_cur, cur, 0);
2848 des_xmlChar_ptr_ptr(n_mem, mem, 1);
2849 des_int_ptr(n_size, size, 2);
2850 xmlResetLastError();
2851 if (mem_base != xmlMemBlocks()) {
2852 printf("Leak of %d blocks found in htmlDocDumpMemory",
2853 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002854 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002855 printf(" %d", n_cur);
2856 printf(" %d", n_mem);
2857 printf(" %d", n_size);
2858 printf("\n");
2859 }
2860 }
2861 }
2862 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002863 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002864#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00002865
Daniel Veillard42595322004-11-08 10:52:06 +00002866 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002867}
2868
2869
2870static int
2871test_htmlGetMetaEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002872 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002873
William M. Brack21e4ef22005-01-02 09:53:13 +00002874#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002875 int mem_base;
2876 const xmlChar * ret_val;
2877 htmlDocPtr doc; /* the document */
2878 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002879
Daniel Veillarda521d282004-11-09 14:59:59 +00002880 for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) {
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002881 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00002882 doc = gen_htmlDocPtr(n_doc, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002883
2884 ret_val = htmlGetMetaEncoding(doc);
2885 desret_const_xmlChar_ptr(ret_val);
2886 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00002887 des_htmlDocPtr(n_doc, doc, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002888 xmlResetLastError();
2889 if (mem_base != xmlMemBlocks()) {
2890 printf("Leak of %d blocks found in htmlGetMetaEncoding",
2891 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002892 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002893 printf(" %d", n_doc);
2894 printf("\n");
2895 }
2896 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002897 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00002898#endif
2899
Daniel Veillard42595322004-11-08 10:52:06 +00002900 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002901}
2902
2903
2904static int
2905test_htmlIsBooleanAttr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002906 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002907
William M. Brack21e4ef22005-01-02 09:53:13 +00002908#if defined(LIBXML_HTML_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00002909 int mem_base;
2910 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002911 xmlChar * name; /* the name of the attribute to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +00002912 int n_name;
2913
2914 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
2915 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002916 name = gen_const_xmlChar_ptr(n_name, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002917
William M. Brackf13f77f2004-11-12 16:03:48 +00002918 ret_val = htmlIsBooleanAttr((const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002919 desret_int(ret_val);
2920 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002921 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002922 xmlResetLastError();
2923 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00002924 printf("Leak of %d blocks found in htmlIsBooleanAttr",
Daniel Veillardd93f6252004-11-02 15:53:51 +00002925 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002926 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002927 printf(" %d", n_name);
2928 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00002929 }
2930 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002931 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002932#endif
2933
Daniel Veillard42595322004-11-08 10:52:06 +00002934 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002935}
2936
2937
2938static int
2939test_htmlNewDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002940 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002941
William M. Brack21e4ef22005-01-02 09:53:13 +00002942#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002943 int mem_base;
2944 htmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002945 xmlChar * URI; /* URI for the dtd, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002946 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002947 xmlChar * ExternalID; /* the external ID of the DTD, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002948 int n_ExternalID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002949
Daniel Veillarda03e3652004-11-02 18:45:30 +00002950 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
2951 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
2952 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002953 URI = gen_const_xmlChar_ptr(n_URI, 0);
2954 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002955
William M. Brackf13f77f2004-11-12 16:03:48 +00002956 ret_val = htmlNewDoc((const xmlChar *)URI, (const xmlChar *)ExternalID);
Daniel Veillarda521d282004-11-09 14:59:59 +00002957 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002958 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00002959 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0);
2960 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002961 xmlResetLastError();
2962 if (mem_base != xmlMemBlocks()) {
2963 printf("Leak of %d blocks found in htmlNewDoc",
2964 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00002965 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002966 printf(" %d", n_URI);
2967 printf(" %d", n_ExternalID);
2968 printf("\n");
2969 }
2970 }
2971 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00002972 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00002973#endif
2974
Daniel Veillard42595322004-11-08 10:52:06 +00002975 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00002976}
2977
2978
2979static int
2980test_htmlNewDocNoDtD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00002981 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002982
William M. Brack21e4ef22005-01-02 09:53:13 +00002983#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00002984 int mem_base;
2985 htmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002986 xmlChar * URI; /* URI for the dtd, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002987 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +00002988 xmlChar * ExternalID; /* the external ID of the DTD, or NULL */
Daniel Veillarda03e3652004-11-02 18:45:30 +00002989 int n_ExternalID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00002990
Daniel Veillarda03e3652004-11-02 18:45:30 +00002991 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
2992 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
2993 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00002994 URI = gen_const_xmlChar_ptr(n_URI, 0);
2995 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002996
William M. Brackf13f77f2004-11-12 16:03:48 +00002997 ret_val = htmlNewDocNoDtD((const xmlChar *)URI, (const xmlChar *)ExternalID);
Daniel Veillarda521d282004-11-09 14:59:59 +00002998 desret_htmlDocPtr(ret_val);
Daniel Veillarda03e3652004-11-02 18:45:30 +00002999 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00003000 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0);
3001 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003002 xmlResetLastError();
3003 if (mem_base != xmlMemBlocks()) {
3004 printf("Leak of %d blocks found in htmlNewDocNoDtD",
3005 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003006 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003007 printf(" %d", n_URI);
3008 printf(" %d", n_ExternalID);
3009 printf("\n");
3010 }
3011 }
3012 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003013 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003014#endif
3015
Daniel Veillard42595322004-11-08 10:52:06 +00003016 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003017}
3018
3019
3020static int
3021test_htmlNodeDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003022 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003023
William M. Brack21e4ef22005-01-02 09:53:13 +00003024#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003025 int mem_base;
3026 int ret_val;
3027 xmlBufferPtr buf; /* the HTML buffer output */
3028 int n_buf;
3029 xmlDocPtr doc; /* the document */
3030 int n_doc;
3031 xmlNodePtr cur; /* the current node */
3032 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003033
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003034 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
3035 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3036 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3037 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003038 buf = gen_xmlBufferPtr(n_buf, 0);
3039 doc = gen_xmlDocPtr(n_doc, 1);
3040 cur = gen_xmlNodePtr(n_cur, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003041
3042 ret_val = htmlNodeDump(buf, doc, cur);
3043 desret_int(ret_val);
3044 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003045 des_xmlBufferPtr(n_buf, buf, 0);
3046 des_xmlDocPtr(n_doc, doc, 1);
3047 des_xmlNodePtr(n_cur, cur, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003048 xmlResetLastError();
3049 if (mem_base != xmlMemBlocks()) {
3050 printf("Leak of %d blocks found in htmlNodeDump",
3051 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003052 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003053 printf(" %d", n_buf);
3054 printf(" %d", n_doc);
3055 printf(" %d", n_cur);
3056 printf("\n");
3057 }
3058 }
3059 }
3060 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003061 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003062#endif
Daniel Veillardd005b9e2004-11-03 17:07:05 +00003063
Daniel Veillard42595322004-11-08 10:52:06 +00003064 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003065}
3066
3067
3068static int
3069test_htmlNodeDumpFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003070 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003071
William M. Brack21e4ef22005-01-02 09:53:13 +00003072#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003073 int mem_base;
3074 FILE * out; /* the FILE pointer */
3075 int n_out;
3076 xmlDocPtr doc; /* the document */
3077 int n_doc;
3078 xmlNodePtr cur; /* the current node */
3079 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003080
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003081 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
3082 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3083 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3084 mem_base = xmlMemBlocks();
3085 out = gen_FILE_ptr(n_out, 0);
3086 doc = gen_xmlDocPtr(n_doc, 1);
3087 cur = gen_xmlNodePtr(n_cur, 2);
3088
3089 htmlNodeDumpFile(out, doc, cur);
3090 call_tests++;
3091 des_FILE_ptr(n_out, out, 0);
3092 des_xmlDocPtr(n_doc, doc, 1);
3093 des_xmlNodePtr(n_cur, cur, 2);
3094 xmlResetLastError();
3095 if (mem_base != xmlMemBlocks()) {
3096 printf("Leak of %d blocks found in htmlNodeDumpFile",
3097 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003098 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003099 printf(" %d", n_out);
3100 printf(" %d", n_doc);
3101 printf(" %d", n_cur);
3102 printf("\n");
3103 }
3104 }
3105 }
3106 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003107 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003108#endif
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003109
Daniel Veillard42595322004-11-08 10:52:06 +00003110 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003111}
3112
3113
3114static int
3115test_htmlNodeDumpFileFormat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003116 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003117
William M. Brack21e4ef22005-01-02 09:53:13 +00003118#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003119 int mem_base;
3120 int ret_val;
3121 FILE * out; /* the FILE pointer */
3122 int n_out;
3123 xmlDocPtr doc; /* the document */
3124 int n_doc;
3125 xmlNodePtr cur; /* the current node */
3126 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003127 char * encoding; /* the document encoding */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003128 int n_encoding;
3129 int format; /* should formatting spaces been added */
3130 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003131
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003132 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
3133 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3134 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3135 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3136 for (n_format = 0;n_format < gen_nb_int;n_format++) {
3137 mem_base = xmlMemBlocks();
3138 out = gen_FILE_ptr(n_out, 0);
3139 doc = gen_xmlDocPtr(n_doc, 1);
3140 cur = gen_xmlNodePtr(n_cur, 2);
3141 encoding = gen_const_char_ptr(n_encoding, 3);
3142 format = gen_int(n_format, 4);
3143
William M. Brackf13f77f2004-11-12 16:03:48 +00003144 ret_val = htmlNodeDumpFileFormat(out, doc, cur, (const char *)encoding, format);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003145 desret_int(ret_val);
3146 call_tests++;
3147 des_FILE_ptr(n_out, out, 0);
3148 des_xmlDocPtr(n_doc, doc, 1);
3149 des_xmlNodePtr(n_cur, cur, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00003150 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003151 des_int(n_format, format, 4);
3152 xmlResetLastError();
3153 if (mem_base != xmlMemBlocks()) {
3154 printf("Leak of %d blocks found in htmlNodeDumpFileFormat",
3155 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003156 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003157 printf(" %d", n_out);
3158 printf(" %d", n_doc);
3159 printf(" %d", n_cur);
3160 printf(" %d", n_encoding);
3161 printf(" %d", n_format);
3162 printf("\n");
3163 }
3164 }
3165 }
3166 }
3167 }
3168 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003169 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003170#endif
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00003171
Daniel Veillard42595322004-11-08 10:52:06 +00003172 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003173}
3174
3175
3176static int
3177test_htmlNodeDumpFormatOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003178 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003179
William M. Brack21e4ef22005-01-02 09:53:13 +00003180#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +00003181 int mem_base;
3182 xmlOutputBufferPtr buf; /* the HTML buffer output */
3183 int n_buf;
3184 xmlDocPtr doc; /* the document */
3185 int n_doc;
3186 xmlNodePtr cur; /* the current node */
3187 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003188 char * encoding; /* the encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +00003189 int n_encoding;
3190 int format; /* should formatting spaces been added */
3191 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003192
Daniel Veillard3d97e662004-11-04 10:49:00 +00003193 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
3194 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3195 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3196 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3197 for (n_format = 0;n_format < gen_nb_int;n_format++) {
3198 mem_base = xmlMemBlocks();
3199 buf = gen_xmlOutputBufferPtr(n_buf, 0);
3200 doc = gen_xmlDocPtr(n_doc, 1);
3201 cur = gen_xmlNodePtr(n_cur, 2);
3202 encoding = gen_const_char_ptr(n_encoding, 3);
3203 format = gen_int(n_format, 4);
3204
William M. Brackf13f77f2004-11-12 16:03:48 +00003205 htmlNodeDumpFormatOutput(buf, doc, cur, (const char *)encoding, format);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003206 call_tests++;
3207 des_xmlOutputBufferPtr(n_buf, buf, 0);
3208 des_xmlDocPtr(n_doc, doc, 1);
3209 des_xmlNodePtr(n_cur, cur, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00003210 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003211 des_int(n_format, format, 4);
3212 xmlResetLastError();
3213 if (mem_base != xmlMemBlocks()) {
3214 printf("Leak of %d blocks found in htmlNodeDumpFormatOutput",
3215 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003216 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003217 printf(" %d", n_buf);
3218 printf(" %d", n_doc);
3219 printf(" %d", n_cur);
3220 printf(" %d", n_encoding);
3221 printf(" %d", n_format);
3222 printf("\n");
3223 }
3224 }
3225 }
3226 }
3227 }
3228 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003229 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003230#endif
Daniel Veillard3d97e662004-11-04 10:49:00 +00003231
Daniel Veillard42595322004-11-08 10:52:06 +00003232 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003233}
3234
3235
3236static int
3237test_htmlNodeDumpOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003238 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003239
William M. Brack21e4ef22005-01-02 09:53:13 +00003240#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +00003241 int mem_base;
3242 xmlOutputBufferPtr buf; /* the HTML buffer output */
3243 int n_buf;
3244 xmlDocPtr doc; /* the document */
3245 int n_doc;
3246 xmlNodePtr cur; /* the current node */
3247 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003248 char * encoding; /* the encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +00003249 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003250
Daniel Veillard3d97e662004-11-04 10:49:00 +00003251 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
3252 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
3253 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
3254 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3255 mem_base = xmlMemBlocks();
3256 buf = gen_xmlOutputBufferPtr(n_buf, 0);
3257 doc = gen_xmlDocPtr(n_doc, 1);
3258 cur = gen_xmlNodePtr(n_cur, 2);
3259 encoding = gen_const_char_ptr(n_encoding, 3);
3260
William M. Brackf13f77f2004-11-12 16:03:48 +00003261 htmlNodeDumpOutput(buf, doc, cur, (const char *)encoding);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003262 call_tests++;
3263 des_xmlOutputBufferPtr(n_buf, buf, 0);
3264 des_xmlDocPtr(n_doc, doc, 1);
3265 des_xmlNodePtr(n_cur, cur, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00003266 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003267 xmlResetLastError();
3268 if (mem_base != xmlMemBlocks()) {
3269 printf("Leak of %d blocks found in htmlNodeDumpOutput",
3270 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003271 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003272 printf(" %d", n_buf);
3273 printf(" %d", n_doc);
3274 printf(" %d", n_cur);
3275 printf(" %d", n_encoding);
3276 printf("\n");
3277 }
3278 }
3279 }
3280 }
3281 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003282 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003283#endif
Daniel Veillard3d97e662004-11-04 10:49:00 +00003284
Daniel Veillard42595322004-11-08 10:52:06 +00003285 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003286}
3287
3288
3289static int
3290test_htmlSaveFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003291 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003292
William M. Brack21e4ef22005-01-02 09:53:13 +00003293#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00003294 int mem_base;
3295 int ret_val;
3296 const char * filename; /* the filename (or URL) */
3297 int n_filename;
3298 xmlDocPtr cur; /* the document */
3299 int n_cur;
3300
3301 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
3302 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3303 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003304 filename = gen_fileoutput(n_filename, 0);
3305 cur = gen_xmlDocPtr(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003306
3307 ret_val = htmlSaveFile(filename, cur);
3308 desret_int(ret_val);
3309 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003310 des_fileoutput(n_filename, filename, 0);
3311 des_xmlDocPtr(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003312 xmlResetLastError();
3313 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003314 printf("Leak of %d blocks found in htmlSaveFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +00003315 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003316 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003317 printf(" %d", n_filename);
3318 printf(" %d", n_cur);
3319 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00003320 }
3321 }
3322 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003323 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003324#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00003325
Daniel Veillard42595322004-11-08 10:52:06 +00003326 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003327}
3328
3329
3330static int
3331test_htmlSaveFileEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003332 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003333
William M. Brack21e4ef22005-01-02 09:53:13 +00003334#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00003335 int mem_base;
3336 int ret_val;
3337 const char * filename; /* the filename */
3338 int n_filename;
3339 xmlDocPtr cur; /* the document */
3340 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003341 char * encoding; /* the document encoding */
Daniel Veillardd93f6252004-11-02 15:53:51 +00003342 int n_encoding;
3343
3344 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
3345 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3346 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3347 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003348 filename = gen_fileoutput(n_filename, 0);
3349 cur = gen_xmlDocPtr(n_cur, 1);
3350 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003351
William M. Brackf13f77f2004-11-12 16:03:48 +00003352 ret_val = htmlSaveFileEnc(filename, cur, (const char *)encoding);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003353 desret_int(ret_val);
3354 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003355 des_fileoutput(n_filename, filename, 0);
3356 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00003357 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003358 xmlResetLastError();
3359 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003360 printf("Leak of %d blocks found in htmlSaveFileEnc",
Daniel Veillardd93f6252004-11-02 15:53:51 +00003361 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003362 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003363 printf(" %d", n_filename);
3364 printf(" %d", n_cur);
3365 printf(" %d", n_encoding);
3366 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00003367 }
3368 }
3369 }
3370 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003371 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003372#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00003373
Daniel Veillard42595322004-11-08 10:52:06 +00003374 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003375}
3376
3377
3378static int
3379test_htmlSaveFileFormat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003380 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003381
William M. Brack21e4ef22005-01-02 09:53:13 +00003382#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00003383 int mem_base;
3384 int ret_val;
3385 const char * filename; /* the filename */
3386 int n_filename;
3387 xmlDocPtr cur; /* the document */
3388 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003389 char * encoding; /* the document encoding */
Daniel Veillardd93f6252004-11-02 15:53:51 +00003390 int n_encoding;
3391 int format; /* should formatting spaces been added */
3392 int n_format;
3393
3394 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
3395 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
3396 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
3397 for (n_format = 0;n_format < gen_nb_int;n_format++) {
3398 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00003399 filename = gen_fileoutput(n_filename, 0);
3400 cur = gen_xmlDocPtr(n_cur, 1);
3401 encoding = gen_const_char_ptr(n_encoding, 2);
3402 format = gen_int(n_format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003403
William M. Brackf13f77f2004-11-12 16:03:48 +00003404 ret_val = htmlSaveFileFormat(filename, cur, (const char *)encoding, format);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003405 desret_int(ret_val);
3406 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00003407 des_fileoutput(n_filename, filename, 0);
3408 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00003409 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003410 des_int(n_format, format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003411 xmlResetLastError();
3412 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003413 printf("Leak of %d blocks found in htmlSaveFileFormat",
Daniel Veillardd93f6252004-11-02 15:53:51 +00003414 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003415 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003416 printf(" %d", n_filename);
3417 printf(" %d", n_cur);
3418 printf(" %d", n_encoding);
3419 printf(" %d", n_format);
3420 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00003421 }
3422 }
3423 }
3424 }
3425 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003426 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003427#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00003428
Daniel Veillard42595322004-11-08 10:52:06 +00003429 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003430}
3431
3432
3433static int
3434test_htmlSetMetaEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003435 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003436
William M. Brack21e4ef22005-01-02 09:53:13 +00003437#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda03e3652004-11-02 18:45:30 +00003438 int mem_base;
3439 int ret_val;
3440 htmlDocPtr doc; /* the document */
3441 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00003442 xmlChar * encoding; /* the encoding string */
Daniel Veillarda03e3652004-11-02 18:45:30 +00003443 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003444
Daniel Veillarda521d282004-11-09 14:59:59 +00003445 for (n_doc = 0;n_doc < gen_nb_htmlDocPtr;n_doc++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00003446 for (n_encoding = 0;n_encoding < gen_nb_const_xmlChar_ptr;n_encoding++) {
3447 mem_base = xmlMemBlocks();
Daniel Veillarda521d282004-11-09 14:59:59 +00003448 doc = gen_htmlDocPtr(n_doc, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00003449 encoding = gen_const_xmlChar_ptr(n_encoding, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003450
William M. Brackf13f77f2004-11-12 16:03:48 +00003451 ret_val = htmlSetMetaEncoding(doc, (const xmlChar *)encoding);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003452 desret_int(ret_val);
3453 call_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00003454 des_htmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003455 des_const_xmlChar_ptr(n_encoding, (const xmlChar *)encoding, 1);
Daniel Veillarda03e3652004-11-02 18:45:30 +00003456 xmlResetLastError();
3457 if (mem_base != xmlMemBlocks()) {
3458 printf("Leak of %d blocks found in htmlSetMetaEncoding",
3459 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00003460 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003461 printf(" %d", n_doc);
3462 printf(" %d", n_encoding);
3463 printf("\n");
3464 }
3465 }
3466 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003467 function_tests++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00003468#endif
3469
Daniel Veillard42595322004-11-08 10:52:06 +00003470 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003471}
3472
3473static int
3474test_HTMLtree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00003475 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00003476
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003477 if (quiet == 0) printf("Testing HTMLtree : 17 of 17 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00003478 test_ret += test_htmlDocContentDumpFormatOutput();
3479 test_ret += test_htmlDocContentDumpOutput();
3480 test_ret += test_htmlDocDump();
3481 test_ret += test_htmlDocDumpMemory();
3482 test_ret += test_htmlGetMetaEncoding();
3483 test_ret += test_htmlIsBooleanAttr();
3484 test_ret += test_htmlNewDoc();
3485 test_ret += test_htmlNewDocNoDtD();
3486 test_ret += test_htmlNodeDump();
3487 test_ret += test_htmlNodeDumpFile();
3488 test_ret += test_htmlNodeDumpFileFormat();
3489 test_ret += test_htmlNodeDumpFormatOutput();
3490 test_ret += test_htmlNodeDumpOutput();
3491 test_ret += test_htmlSaveFile();
3492 test_ret += test_htmlSaveFileEnc();
3493 test_ret += test_htmlSaveFileFormat();
3494 test_ret += test_htmlSetMetaEncoding();
Daniel Veillardd93f6252004-11-02 15:53:51 +00003495
Daniel Veillard42595322004-11-08 10:52:06 +00003496 if (test_ret != 0)
3497 printf("Module HTMLtree: %d errors\n", test_ret);
3498 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00003499}
3500
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003501static int
3502test_docbDefaultSAXHandlerInit(void) {
3503 int test_ret = 0;
3504
William M. Brack21e4ef22005-01-02 09:53:13 +00003505#if defined(LIBXML_DOCB_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00003506#ifdef LIBXML_DOCB_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003507 int mem_base;
3508
3509 mem_base = xmlMemBlocks();
3510
3511 docbDefaultSAXHandlerInit();
3512 call_tests++;
3513 xmlResetLastError();
3514 if (mem_base != xmlMemBlocks()) {
3515 printf("Leak of %d blocks found in docbDefaultSAXHandlerInit",
3516 xmlMemBlocks() - mem_base);
3517 test_ret++;
3518 printf("\n");
3519 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003520 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00003521#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00003522#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003523
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003524 return(test_ret);
3525}
3526
3527
3528static int
3529test_htmlDefaultSAXHandlerInit(void) {
3530 int test_ret = 0;
3531
William M. Brack21e4ef22005-01-02 09:53:13 +00003532#if defined(LIBXML_HTML_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00003533#ifdef LIBXML_HTML_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003534 int mem_base;
3535
3536 mem_base = xmlMemBlocks();
3537
3538 htmlDefaultSAXHandlerInit();
3539 call_tests++;
3540 xmlResetLastError();
3541 if (mem_base != xmlMemBlocks()) {
3542 printf("Leak of %d blocks found in htmlDefaultSAXHandlerInit",
3543 xmlMemBlocks() - mem_base);
3544 test_ret++;
3545 printf("\n");
3546 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003547 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00003548#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00003549#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003550
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003551 return(test_ret);
3552}
3553
3554
3555static int
3556test_xmlDefaultSAXHandlerInit(void) {
3557 int test_ret = 0;
3558
3559 int mem_base;
3560
3561 mem_base = xmlMemBlocks();
3562
3563 xmlDefaultSAXHandlerInit();
3564 call_tests++;
3565 xmlResetLastError();
3566 if (mem_base != xmlMemBlocks()) {
3567 printf("Leak of %d blocks found in xmlDefaultSAXHandlerInit",
3568 xmlMemBlocks() - mem_base);
3569 test_ret++;
3570 printf("\n");
3571 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003572 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003573
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003574 return(test_ret);
3575}
3576
3577
3578#define gen_nb_xmlEnumerationPtr 1
3579static xmlEnumerationPtr gen_xmlEnumerationPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
3580 return(NULL);
3581}
3582static void des_xmlEnumerationPtr(int no ATTRIBUTE_UNUSED, xmlEnumerationPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
3583}
3584
3585static int
3586test_xmlSAX2AttributeDecl(void) {
3587 int test_ret = 0;
3588
3589 int mem_base;
3590 void * ctx; /* the user data (XML parser context) */
3591 int n_ctx;
3592 xmlChar * elem; /* the name of the element */
3593 int n_elem;
3594 xmlChar * fullname; /* the attribute name */
3595 int n_fullname;
3596 int type; /* the attribute type */
3597 int n_type;
3598 int def; /* the type of default value */
3599 int n_def;
3600 xmlChar * defaultValue; /* the attribute default value */
3601 int n_defaultValue;
3602 xmlEnumerationPtr tree; /* the tree of enumerated value set */
3603 int n_tree;
3604
3605 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3606 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
3607 for (n_fullname = 0;n_fullname < gen_nb_const_xmlChar_ptr;n_fullname++) {
3608 for (n_type = 0;n_type < gen_nb_int;n_type++) {
3609 for (n_def = 0;n_def < gen_nb_int;n_def++) {
3610 for (n_defaultValue = 0;n_defaultValue < gen_nb_const_xmlChar_ptr;n_defaultValue++) {
3611 for (n_tree = 0;n_tree < gen_nb_xmlEnumerationPtr;n_tree++) {
3612 mem_base = xmlMemBlocks();
3613 ctx = gen_void_ptr(n_ctx, 0);
3614 elem = gen_const_xmlChar_ptr(n_elem, 1);
3615 fullname = gen_const_xmlChar_ptr(n_fullname, 2);
3616 type = gen_int(n_type, 3);
3617 def = gen_int(n_def, 4);
3618 defaultValue = gen_const_xmlChar_ptr(n_defaultValue, 5);
3619 tree = gen_xmlEnumerationPtr(n_tree, 6);
3620
William M. Brackf13f77f2004-11-12 16:03:48 +00003621 xmlSAX2AttributeDecl(ctx, (const xmlChar *)elem, (const xmlChar *)fullname, type, def, (const xmlChar *)defaultValue, tree);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003622 call_tests++;
3623 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003624 des_const_xmlChar_ptr(n_elem, (const xmlChar *)elem, 1);
3625 des_const_xmlChar_ptr(n_fullname, (const xmlChar *)fullname, 2);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003626 des_int(n_type, type, 3);
3627 des_int(n_def, def, 4);
William M. Brackf13f77f2004-11-12 16:03:48 +00003628 des_const_xmlChar_ptr(n_defaultValue, (const xmlChar *)defaultValue, 5);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003629 des_xmlEnumerationPtr(n_tree, tree, 6);
3630 xmlResetLastError();
3631 if (mem_base != xmlMemBlocks()) {
3632 printf("Leak of %d blocks found in xmlSAX2AttributeDecl",
3633 xmlMemBlocks() - mem_base);
3634 test_ret++;
3635 printf(" %d", n_ctx);
3636 printf(" %d", n_elem);
3637 printf(" %d", n_fullname);
3638 printf(" %d", n_type);
3639 printf(" %d", n_def);
3640 printf(" %d", n_defaultValue);
3641 printf(" %d", n_tree);
3642 printf("\n");
3643 }
3644 }
3645 }
3646 }
3647 }
3648 }
3649 }
3650 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003651 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003652
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003653 return(test_ret);
3654}
3655
3656
3657static int
3658test_xmlSAX2CDataBlock(void) {
3659 int test_ret = 0;
3660
3661 int mem_base;
3662 void * ctx; /* the user data (XML parser context) */
3663 int n_ctx;
3664 xmlChar * value; /* The pcdata content */
3665 int n_value;
3666 int len; /* the block length */
3667 int n_len;
3668
3669 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3670 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
3671 for (n_len = 0;n_len < gen_nb_int;n_len++) {
3672 mem_base = xmlMemBlocks();
3673 ctx = gen_void_ptr(n_ctx, 0);
3674 value = gen_const_xmlChar_ptr(n_value, 1);
3675 len = gen_int(n_len, 2);
3676
William M. Brackf13f77f2004-11-12 16:03:48 +00003677 xmlSAX2CDataBlock(ctx, (const xmlChar *)value, len);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003678 call_tests++;
3679 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003680 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003681 des_int(n_len, len, 2);
3682 xmlResetLastError();
3683 if (mem_base != xmlMemBlocks()) {
3684 printf("Leak of %d blocks found in xmlSAX2CDataBlock",
3685 xmlMemBlocks() - mem_base);
3686 test_ret++;
3687 printf(" %d", n_ctx);
3688 printf(" %d", n_value);
3689 printf(" %d", n_len);
3690 printf("\n");
3691 }
3692 }
3693 }
3694 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003695 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003696
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003697 return(test_ret);
3698}
3699
3700
3701static int
3702test_xmlSAX2Characters(void) {
3703 int test_ret = 0;
3704
3705 int mem_base;
3706 void * ctx; /* the user data (XML parser context) */
3707 int n_ctx;
3708 xmlChar * ch; /* a xmlChar string */
3709 int n_ch;
3710 int len; /* the number of xmlChar */
3711 int n_len;
3712
3713 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3714 for (n_ch = 0;n_ch < gen_nb_const_xmlChar_ptr;n_ch++) {
3715 for (n_len = 0;n_len < gen_nb_int;n_len++) {
3716 mem_base = xmlMemBlocks();
3717 ctx = gen_void_ptr(n_ctx, 0);
3718 ch = gen_const_xmlChar_ptr(n_ch, 1);
3719 len = gen_int(n_len, 2);
3720
William M. Brackf13f77f2004-11-12 16:03:48 +00003721 xmlSAX2Characters(ctx, (const xmlChar *)ch, len);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003722 call_tests++;
3723 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003724 des_const_xmlChar_ptr(n_ch, (const xmlChar *)ch, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003725 des_int(n_len, len, 2);
3726 xmlResetLastError();
3727 if (mem_base != xmlMemBlocks()) {
3728 printf("Leak of %d blocks found in xmlSAX2Characters",
3729 xmlMemBlocks() - mem_base);
3730 test_ret++;
3731 printf(" %d", n_ctx);
3732 printf(" %d", n_ch);
3733 printf(" %d", n_len);
3734 printf("\n");
3735 }
3736 }
3737 }
3738 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003739 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003740
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003741 return(test_ret);
3742}
3743
3744
3745static int
3746test_xmlSAX2Comment(void) {
3747 int test_ret = 0;
3748
3749 int mem_base;
3750 void * ctx; /* the user data (XML parser context) */
3751 int n_ctx;
3752 xmlChar * value; /* the xmlSAX2Comment content */
3753 int n_value;
3754
3755 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3756 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
3757 mem_base = xmlMemBlocks();
3758 ctx = gen_void_ptr(n_ctx, 0);
3759 value = gen_const_xmlChar_ptr(n_value, 1);
3760
William M. Brackf13f77f2004-11-12 16:03:48 +00003761 xmlSAX2Comment(ctx, (const xmlChar *)value);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003762 call_tests++;
3763 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003764 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003765 xmlResetLastError();
3766 if (mem_base != xmlMemBlocks()) {
3767 printf("Leak of %d blocks found in xmlSAX2Comment",
3768 xmlMemBlocks() - mem_base);
3769 test_ret++;
3770 printf(" %d", n_ctx);
3771 printf(" %d", n_value);
3772 printf("\n");
3773 }
3774 }
3775 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003776 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003777
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003778 return(test_ret);
3779}
3780
3781
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003782static int
3783test_xmlSAX2ElementDecl(void) {
3784 int test_ret = 0;
3785
3786 int mem_base;
3787 void * ctx; /* the user data (XML parser context) */
3788 int n_ctx;
3789 xmlChar * name; /* the element name */
3790 int n_name;
3791 int type; /* the element type */
3792 int n_type;
3793 xmlElementContentPtr content; /* the element value tree */
3794 int n_content;
3795
3796 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3797 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
3798 for (n_type = 0;n_type < gen_nb_int;n_type++) {
3799 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
3800 mem_base = xmlMemBlocks();
3801 ctx = gen_void_ptr(n_ctx, 0);
3802 name = gen_const_xmlChar_ptr(n_name, 1);
3803 type = gen_int(n_type, 2);
3804 content = gen_xmlElementContentPtr(n_content, 3);
3805
William M. Brackf13f77f2004-11-12 16:03:48 +00003806 xmlSAX2ElementDecl(ctx, (const xmlChar *)name, type, content);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003807 call_tests++;
3808 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003809 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003810 des_int(n_type, type, 2);
3811 des_xmlElementContentPtr(n_content, content, 3);
3812 xmlResetLastError();
3813 if (mem_base != xmlMemBlocks()) {
3814 printf("Leak of %d blocks found in xmlSAX2ElementDecl",
3815 xmlMemBlocks() - mem_base);
3816 test_ret++;
3817 printf(" %d", n_ctx);
3818 printf(" %d", n_name);
3819 printf(" %d", n_type);
3820 printf(" %d", n_content);
3821 printf("\n");
3822 }
3823 }
3824 }
3825 }
3826 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003827 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003828
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003829 return(test_ret);
3830}
3831
3832
3833static int
3834test_xmlSAX2EndDocument(void) {
3835 int test_ret = 0;
3836
3837 int mem_base;
3838 void * ctx; /* the user data (XML parser context) */
3839 int n_ctx;
3840
3841 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3842 mem_base = xmlMemBlocks();
3843 ctx = gen_void_ptr(n_ctx, 0);
3844
3845 xmlSAX2EndDocument(ctx);
3846 call_tests++;
3847 des_void_ptr(n_ctx, ctx, 0);
3848 xmlResetLastError();
3849 if (mem_base != xmlMemBlocks()) {
3850 printf("Leak of %d blocks found in xmlSAX2EndDocument",
3851 xmlMemBlocks() - mem_base);
3852 test_ret++;
3853 printf(" %d", n_ctx);
3854 printf("\n");
3855 }
3856 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003857 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003858
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003859 return(test_ret);
3860}
3861
3862
3863static int
3864test_xmlSAX2EndElement(void) {
3865 int test_ret = 0;
3866
William M. Brack21e4ef22005-01-02 09:53:13 +00003867#if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00003868#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003869 int mem_base;
3870 void * ctx; /* the user data (XML parser context) */
3871 int n_ctx;
3872 xmlChar * name; /* The element name */
3873 int n_name;
3874
3875 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3876 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
3877 mem_base = xmlMemBlocks();
3878 ctx = gen_void_ptr(n_ctx, 0);
3879 name = gen_const_xmlChar_ptr(n_name, 1);
3880
William M. Brackf13f77f2004-11-12 16:03:48 +00003881 xmlSAX2EndElement(ctx, (const xmlChar *)name);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003882 call_tests++;
3883 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003884 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003885 xmlResetLastError();
3886 if (mem_base != xmlMemBlocks()) {
3887 printf("Leak of %d blocks found in xmlSAX2EndElement",
3888 xmlMemBlocks() - mem_base);
3889 test_ret++;
3890 printf(" %d", n_ctx);
3891 printf(" %d", n_name);
3892 printf("\n");
3893 }
3894 }
3895 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003896 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00003897#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00003898#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003899
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003900 return(test_ret);
3901}
3902
3903
3904static int
3905test_xmlSAX2EndElementNs(void) {
3906 int test_ret = 0;
3907
3908 int mem_base;
3909 void * ctx; /* the user data (XML parser context) */
3910 int n_ctx;
3911 xmlChar * localname; /* the local name of the element */
3912 int n_localname;
3913 xmlChar * prefix; /* the element namespace prefix if available */
3914 int n_prefix;
3915 xmlChar * URI; /* the element namespace name if available */
3916 int n_URI;
3917
3918 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3919 for (n_localname = 0;n_localname < gen_nb_const_xmlChar_ptr;n_localname++) {
3920 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
3921 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
3922 mem_base = xmlMemBlocks();
3923 ctx = gen_void_ptr(n_ctx, 0);
3924 localname = gen_const_xmlChar_ptr(n_localname, 1);
3925 prefix = gen_const_xmlChar_ptr(n_prefix, 2);
3926 URI = gen_const_xmlChar_ptr(n_URI, 3);
3927
William M. Brackf13f77f2004-11-12 16:03:48 +00003928 xmlSAX2EndElementNs(ctx, (const xmlChar *)localname, (const xmlChar *)prefix, (const xmlChar *)URI);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003929 call_tests++;
3930 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003931 des_const_xmlChar_ptr(n_localname, (const xmlChar *)localname, 1);
3932 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 2);
3933 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 3);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003934 xmlResetLastError();
3935 if (mem_base != xmlMemBlocks()) {
3936 printf("Leak of %d blocks found in xmlSAX2EndElementNs",
3937 xmlMemBlocks() - mem_base);
3938 test_ret++;
3939 printf(" %d", n_ctx);
3940 printf(" %d", n_localname);
3941 printf(" %d", n_prefix);
3942 printf(" %d", n_URI);
3943 printf("\n");
3944 }
3945 }
3946 }
3947 }
3948 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003949 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00003950
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003951 return(test_ret);
3952}
3953
3954
3955static int
3956test_xmlSAX2EntityDecl(void) {
3957 int test_ret = 0;
3958
3959 int mem_base;
3960 void * ctx; /* the user data (XML parser context) */
3961 int n_ctx;
3962 xmlChar * name; /* the entity name */
3963 int n_name;
3964 int type; /* the entity type */
3965 int n_type;
3966 xmlChar * publicId; /* The public ID of the entity */
3967 int n_publicId;
3968 xmlChar * systemId; /* The system ID of the entity */
3969 int n_systemId;
3970 xmlChar * content; /* the entity value (without processing). */
3971 int n_content;
3972
3973 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
3974 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
3975 for (n_type = 0;n_type < gen_nb_int;n_type++) {
3976 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
3977 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
3978 for (n_content = 0;n_content < gen_nb_xmlChar_ptr;n_content++) {
3979 mem_base = xmlMemBlocks();
3980 ctx = gen_void_ptr(n_ctx, 0);
3981 name = gen_const_xmlChar_ptr(n_name, 1);
3982 type = gen_int(n_type, 2);
3983 publicId = gen_const_xmlChar_ptr(n_publicId, 3);
3984 systemId = gen_const_xmlChar_ptr(n_systemId, 4);
3985 content = gen_xmlChar_ptr(n_content, 5);
3986
William M. Brackf13f77f2004-11-12 16:03:48 +00003987 xmlSAX2EntityDecl(ctx, (const xmlChar *)name, type, (const xmlChar *)publicId, (const xmlChar *)systemId, content);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003988 call_tests++;
3989 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00003990 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003991 des_int(n_type, type, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00003992 des_const_xmlChar_ptr(n_publicId, (const xmlChar *)publicId, 3);
3993 des_const_xmlChar_ptr(n_systemId, (const xmlChar *)systemId, 4);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00003994 des_xmlChar_ptr(n_content, content, 5);
3995 xmlResetLastError();
3996 if (mem_base != xmlMemBlocks()) {
3997 printf("Leak of %d blocks found in xmlSAX2EntityDecl",
3998 xmlMemBlocks() - mem_base);
3999 test_ret++;
4000 printf(" %d", n_ctx);
4001 printf(" %d", n_name);
4002 printf(" %d", n_type);
4003 printf(" %d", n_publicId);
4004 printf(" %d", n_systemId);
4005 printf(" %d", n_content);
4006 printf("\n");
4007 }
4008 }
4009 }
4010 }
4011 }
4012 }
4013 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004014 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004015
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004016 return(test_ret);
4017}
4018
4019
4020static int
4021test_xmlSAX2ExternalSubset(void) {
4022 int test_ret = 0;
4023
4024 int mem_base;
4025 void * ctx; /* the user data (XML parser context) */
4026 int n_ctx;
4027 xmlChar * name; /* the root element name */
4028 int n_name;
4029 xmlChar * ExternalID; /* the external ID */
4030 int n_ExternalID;
4031 xmlChar * SystemID; /* the SYSTEM ID (e.g. filename or URL) */
4032 int n_SystemID;
4033
4034 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4035 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4036 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
4037 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
4038 mem_base = xmlMemBlocks();
4039 ctx = gen_void_ptr(n_ctx, 0);
4040 name = gen_const_xmlChar_ptr(n_name, 1);
4041 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
4042 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
4043
William M. Brackf13f77f2004-11-12 16:03:48 +00004044 xmlSAX2ExternalSubset(ctx, (const xmlChar *)name, (const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004045 call_tests++;
4046 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004047 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
4048 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 2);
4049 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 3);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004050 xmlResetLastError();
4051 if (mem_base != xmlMemBlocks()) {
4052 printf("Leak of %d blocks found in xmlSAX2ExternalSubset",
4053 xmlMemBlocks() - mem_base);
4054 test_ret++;
4055 printf(" %d", n_ctx);
4056 printf(" %d", n_name);
4057 printf(" %d", n_ExternalID);
4058 printf(" %d", n_SystemID);
4059 printf("\n");
4060 }
4061 }
4062 }
4063 }
4064 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004065 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004066
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004067 return(test_ret);
4068}
4069
4070
4071static int
4072test_xmlSAX2GetColumnNumber(void) {
4073 int test_ret = 0;
4074
4075 int mem_base;
4076 int ret_val;
4077 void * ctx; /* the user data (XML parser context) */
4078 int n_ctx;
4079
4080 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4081 mem_base = xmlMemBlocks();
4082 ctx = gen_void_ptr(n_ctx, 0);
4083
4084 ret_val = xmlSAX2GetColumnNumber(ctx);
4085 desret_int(ret_val);
4086 call_tests++;
4087 des_void_ptr(n_ctx, ctx, 0);
4088 xmlResetLastError();
4089 if (mem_base != xmlMemBlocks()) {
4090 printf("Leak of %d blocks found in xmlSAX2GetColumnNumber",
4091 xmlMemBlocks() - mem_base);
4092 test_ret++;
4093 printf(" %d", n_ctx);
4094 printf("\n");
4095 }
4096 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004097 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004098
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004099 return(test_ret);
4100}
4101
4102
4103static int
4104test_xmlSAX2GetEntity(void) {
4105 int test_ret = 0;
4106
4107 int mem_base;
4108 xmlEntityPtr ret_val;
4109 void * ctx; /* the user data (XML parser context) */
4110 int n_ctx;
4111 xmlChar * name; /* The entity name */
4112 int n_name;
4113
4114 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4115 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4116 mem_base = xmlMemBlocks();
4117 ctx = gen_void_ptr(n_ctx, 0);
4118 name = gen_const_xmlChar_ptr(n_name, 1);
4119
William M. Brackf13f77f2004-11-12 16:03:48 +00004120 ret_val = xmlSAX2GetEntity(ctx, (const xmlChar *)name);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004121 desret_xmlEntityPtr(ret_val);
4122 call_tests++;
4123 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004124 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004125 xmlResetLastError();
4126 if (mem_base != xmlMemBlocks()) {
4127 printf("Leak of %d blocks found in xmlSAX2GetEntity",
4128 xmlMemBlocks() - mem_base);
4129 test_ret++;
4130 printf(" %d", n_ctx);
4131 printf(" %d", n_name);
4132 printf("\n");
4133 }
4134 }
4135 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004136 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004137
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004138 return(test_ret);
4139}
4140
4141
4142static int
4143test_xmlSAX2GetLineNumber(void) {
4144 int test_ret = 0;
4145
4146 int mem_base;
4147 int ret_val;
4148 void * ctx; /* the user data (XML parser context) */
4149 int n_ctx;
4150
4151 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4152 mem_base = xmlMemBlocks();
4153 ctx = gen_void_ptr(n_ctx, 0);
4154
4155 ret_val = xmlSAX2GetLineNumber(ctx);
4156 desret_int(ret_val);
4157 call_tests++;
4158 des_void_ptr(n_ctx, ctx, 0);
4159 xmlResetLastError();
4160 if (mem_base != xmlMemBlocks()) {
4161 printf("Leak of %d blocks found in xmlSAX2GetLineNumber",
4162 xmlMemBlocks() - mem_base);
4163 test_ret++;
4164 printf(" %d", n_ctx);
4165 printf("\n");
4166 }
4167 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004168 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004169
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004170 return(test_ret);
4171}
4172
4173
4174static int
4175test_xmlSAX2GetParameterEntity(void) {
4176 int test_ret = 0;
4177
4178 int mem_base;
4179 xmlEntityPtr ret_val;
4180 void * ctx; /* the user data (XML parser context) */
4181 int n_ctx;
4182 xmlChar * name; /* The entity name */
4183 int n_name;
4184
4185 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4186 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4187 mem_base = xmlMemBlocks();
4188 ctx = gen_void_ptr(n_ctx, 0);
4189 name = gen_const_xmlChar_ptr(n_name, 1);
4190
William M. Brackf13f77f2004-11-12 16:03:48 +00004191 ret_val = xmlSAX2GetParameterEntity(ctx, (const xmlChar *)name);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004192 desret_xmlEntityPtr(ret_val);
4193 call_tests++;
4194 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004195 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004196 xmlResetLastError();
4197 if (mem_base != xmlMemBlocks()) {
4198 printf("Leak of %d blocks found in xmlSAX2GetParameterEntity",
4199 xmlMemBlocks() - mem_base);
4200 test_ret++;
4201 printf(" %d", n_ctx);
4202 printf(" %d", n_name);
4203 printf("\n");
4204 }
4205 }
4206 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004207 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004208
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004209 return(test_ret);
4210}
4211
4212
4213static int
4214test_xmlSAX2GetPublicId(void) {
4215 int test_ret = 0;
4216
4217 int mem_base;
4218 const xmlChar * ret_val;
4219 void * ctx; /* the user data (XML parser context) */
4220 int n_ctx;
4221
4222 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4223 mem_base = xmlMemBlocks();
4224 ctx = gen_void_ptr(n_ctx, 0);
4225
4226 ret_val = xmlSAX2GetPublicId(ctx);
4227 desret_const_xmlChar_ptr(ret_val);
4228 call_tests++;
4229 des_void_ptr(n_ctx, ctx, 0);
4230 xmlResetLastError();
4231 if (mem_base != xmlMemBlocks()) {
4232 printf("Leak of %d blocks found in xmlSAX2GetPublicId",
4233 xmlMemBlocks() - mem_base);
4234 test_ret++;
4235 printf(" %d", n_ctx);
4236 printf("\n");
4237 }
4238 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004239 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004240
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004241 return(test_ret);
4242}
4243
4244
4245static int
4246test_xmlSAX2GetSystemId(void) {
4247 int test_ret = 0;
4248
4249 int mem_base;
4250 const xmlChar * ret_val;
4251 void * ctx; /* the user data (XML parser context) */
4252 int n_ctx;
4253
4254 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4255 mem_base = xmlMemBlocks();
4256 ctx = gen_void_ptr(n_ctx, 0);
4257
4258 ret_val = xmlSAX2GetSystemId(ctx);
4259 desret_const_xmlChar_ptr(ret_val);
4260 call_tests++;
4261 des_void_ptr(n_ctx, ctx, 0);
4262 xmlResetLastError();
4263 if (mem_base != xmlMemBlocks()) {
4264 printf("Leak of %d blocks found in xmlSAX2GetSystemId",
4265 xmlMemBlocks() - mem_base);
4266 test_ret++;
4267 printf(" %d", n_ctx);
4268 printf("\n");
4269 }
4270 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004271 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004272
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004273 return(test_ret);
4274}
4275
4276
4277static int
4278test_xmlSAX2HasExternalSubset(void) {
4279 int test_ret = 0;
4280
4281 int mem_base;
4282 int ret_val;
4283 void * ctx; /* the user data (XML parser context) */
4284 int n_ctx;
4285
4286 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4287 mem_base = xmlMemBlocks();
4288 ctx = gen_void_ptr(n_ctx, 0);
4289
4290 ret_val = xmlSAX2HasExternalSubset(ctx);
4291 desret_int(ret_val);
4292 call_tests++;
4293 des_void_ptr(n_ctx, ctx, 0);
4294 xmlResetLastError();
4295 if (mem_base != xmlMemBlocks()) {
4296 printf("Leak of %d blocks found in xmlSAX2HasExternalSubset",
4297 xmlMemBlocks() - mem_base);
4298 test_ret++;
4299 printf(" %d", n_ctx);
4300 printf("\n");
4301 }
4302 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004303 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004304
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004305 return(test_ret);
4306}
4307
4308
4309static int
4310test_xmlSAX2HasInternalSubset(void) {
4311 int test_ret = 0;
4312
4313 int mem_base;
4314 int ret_val;
4315 void * ctx; /* the user data (XML parser context) */
4316 int n_ctx;
4317
4318 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4319 mem_base = xmlMemBlocks();
4320 ctx = gen_void_ptr(n_ctx, 0);
4321
4322 ret_val = xmlSAX2HasInternalSubset(ctx);
4323 desret_int(ret_val);
4324 call_tests++;
4325 des_void_ptr(n_ctx, ctx, 0);
4326 xmlResetLastError();
4327 if (mem_base != xmlMemBlocks()) {
4328 printf("Leak of %d blocks found in xmlSAX2HasInternalSubset",
4329 xmlMemBlocks() - mem_base);
4330 test_ret++;
4331 printf(" %d", n_ctx);
4332 printf("\n");
4333 }
4334 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004335 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004336
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004337 return(test_ret);
4338}
4339
4340
4341static int
4342test_xmlSAX2IgnorableWhitespace(void) {
4343 int test_ret = 0;
4344
4345 int mem_base;
4346 void * ctx; /* the user data (XML parser context) */
4347 int n_ctx;
4348 xmlChar * ch; /* a xmlChar string */
4349 int n_ch;
4350 int len; /* the number of xmlChar */
4351 int n_len;
4352
4353 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4354 for (n_ch = 0;n_ch < gen_nb_const_xmlChar_ptr;n_ch++) {
4355 for (n_len = 0;n_len < gen_nb_int;n_len++) {
4356 mem_base = xmlMemBlocks();
4357 ctx = gen_void_ptr(n_ctx, 0);
4358 ch = gen_const_xmlChar_ptr(n_ch, 1);
4359 len = gen_int(n_len, 2);
4360
William M. Brackf13f77f2004-11-12 16:03:48 +00004361 xmlSAX2IgnorableWhitespace(ctx, (const xmlChar *)ch, len);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004362 call_tests++;
4363 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004364 des_const_xmlChar_ptr(n_ch, (const xmlChar *)ch, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004365 des_int(n_len, len, 2);
4366 xmlResetLastError();
4367 if (mem_base != xmlMemBlocks()) {
4368 printf("Leak of %d blocks found in xmlSAX2IgnorableWhitespace",
4369 xmlMemBlocks() - mem_base);
4370 test_ret++;
4371 printf(" %d", n_ctx);
4372 printf(" %d", n_ch);
4373 printf(" %d", n_len);
4374 printf("\n");
4375 }
4376 }
4377 }
4378 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004379 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004380
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004381 return(test_ret);
4382}
4383
4384
4385#define gen_nb_xmlSAXHandler_ptr 1
4386static xmlSAXHandler * gen_xmlSAXHandler_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
4387 return(NULL);
4388}
4389static void des_xmlSAXHandler_ptr(int no ATTRIBUTE_UNUSED, xmlSAXHandler * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
4390}
4391
4392static int
4393test_xmlSAX2InitDefaultSAXHandler(void) {
4394 int test_ret = 0;
4395
4396 int mem_base;
4397 xmlSAXHandler * hdlr; /* the SAX handler */
4398 int n_hdlr;
4399 int warning; /* flag if non-zero sets the handler warning procedure */
4400 int n_warning;
4401
4402 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
4403 for (n_warning = 0;n_warning < gen_nb_int;n_warning++) {
4404 mem_base = xmlMemBlocks();
4405 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
4406 warning = gen_int(n_warning, 1);
4407
4408 xmlSAX2InitDefaultSAXHandler(hdlr, warning);
4409 call_tests++;
4410 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
4411 des_int(n_warning, warning, 1);
4412 xmlResetLastError();
4413 if (mem_base != xmlMemBlocks()) {
4414 printf("Leak of %d blocks found in xmlSAX2InitDefaultSAXHandler",
4415 xmlMemBlocks() - mem_base);
4416 test_ret++;
4417 printf(" %d", n_hdlr);
4418 printf(" %d", n_warning);
4419 printf("\n");
4420 }
4421 }
4422 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004423 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004424
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004425 return(test_ret);
4426}
4427
4428
4429static int
4430test_xmlSAX2InitDocbDefaultSAXHandler(void) {
4431 int test_ret = 0;
4432
William M. Brack21e4ef22005-01-02 09:53:13 +00004433#if defined(LIBXML_DOCB_ENABLED)
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004434 int mem_base;
4435 xmlSAXHandler * hdlr; /* the SAX handler */
4436 int n_hdlr;
4437
4438 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
4439 mem_base = xmlMemBlocks();
4440 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
4441
4442 xmlSAX2InitDocbDefaultSAXHandler(hdlr);
4443 call_tests++;
4444 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
4445 xmlResetLastError();
4446 if (mem_base != xmlMemBlocks()) {
4447 printf("Leak of %d blocks found in xmlSAX2InitDocbDefaultSAXHandler",
4448 xmlMemBlocks() - mem_base);
4449 test_ret++;
4450 printf(" %d", n_hdlr);
4451 printf("\n");
4452 }
4453 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004454 function_tests++;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004455#endif
4456
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004457 return(test_ret);
4458}
4459
4460
4461static int
4462test_xmlSAX2InitHtmlDefaultSAXHandler(void) {
4463 int test_ret = 0;
4464
William M. Brack21e4ef22005-01-02 09:53:13 +00004465#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004466 int mem_base;
4467 xmlSAXHandler * hdlr; /* the SAX handler */
4468 int n_hdlr;
4469
4470 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
4471 mem_base = xmlMemBlocks();
4472 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
4473
4474 xmlSAX2InitHtmlDefaultSAXHandler(hdlr);
4475 call_tests++;
4476 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
4477 xmlResetLastError();
4478 if (mem_base != xmlMemBlocks()) {
4479 printf("Leak of %d blocks found in xmlSAX2InitHtmlDefaultSAXHandler",
4480 xmlMemBlocks() - mem_base);
4481 test_ret++;
4482 printf(" %d", n_hdlr);
4483 printf("\n");
4484 }
4485 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004486 function_tests++;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004487#endif
4488
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004489 return(test_ret);
4490}
4491
4492
4493static int
4494test_xmlSAX2InternalSubset(void) {
4495 int test_ret = 0;
4496
4497 int mem_base;
4498 void * ctx; /* the user data (XML parser context) */
4499 int n_ctx;
4500 xmlChar * name; /* the root element name */
4501 int n_name;
4502 xmlChar * ExternalID; /* the external ID */
4503 int n_ExternalID;
4504 xmlChar * SystemID; /* the SYSTEM ID (e.g. filename or URL) */
4505 int n_SystemID;
4506
4507 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4508 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4509 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
4510 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
4511 mem_base = xmlMemBlocks();
4512 ctx = gen_void_ptr(n_ctx, 0);
4513 name = gen_const_xmlChar_ptr(n_name, 1);
4514 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
4515 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
4516
William M. Brackf13f77f2004-11-12 16:03:48 +00004517 xmlSAX2InternalSubset(ctx, (const xmlChar *)name, (const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004518 call_tests++;
4519 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004520 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
4521 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 2);
4522 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 3);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004523 xmlResetLastError();
4524 if (mem_base != xmlMemBlocks()) {
4525 printf("Leak of %d blocks found in xmlSAX2InternalSubset",
4526 xmlMemBlocks() - mem_base);
4527 test_ret++;
4528 printf(" %d", n_ctx);
4529 printf(" %d", n_name);
4530 printf(" %d", n_ExternalID);
4531 printf(" %d", n_SystemID);
4532 printf("\n");
4533 }
4534 }
4535 }
4536 }
4537 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004538 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004539
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004540 return(test_ret);
4541}
4542
4543
4544static int
4545test_xmlSAX2IsStandalone(void) {
4546 int test_ret = 0;
4547
4548 int mem_base;
4549 int ret_val;
4550 void * ctx; /* the user data (XML parser context) */
4551 int n_ctx;
4552
4553 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4554 mem_base = xmlMemBlocks();
4555 ctx = gen_void_ptr(n_ctx, 0);
4556
4557 ret_val = xmlSAX2IsStandalone(ctx);
4558 desret_int(ret_val);
4559 call_tests++;
4560 des_void_ptr(n_ctx, ctx, 0);
4561 xmlResetLastError();
4562 if (mem_base != xmlMemBlocks()) {
4563 printf("Leak of %d blocks found in xmlSAX2IsStandalone",
4564 xmlMemBlocks() - mem_base);
4565 test_ret++;
4566 printf(" %d", n_ctx);
4567 printf("\n");
4568 }
4569 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004570 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004571
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004572 return(test_ret);
4573}
4574
4575
4576static int
4577test_xmlSAX2NotationDecl(void) {
4578 int test_ret = 0;
4579
4580 int mem_base;
4581 void * ctx; /* the user data (XML parser context) */
4582 int n_ctx;
4583 xmlChar * name; /* The name of the notation */
4584 int n_name;
4585 xmlChar * publicId; /* The public ID of the entity */
4586 int n_publicId;
4587 xmlChar * systemId; /* The system ID of the entity */
4588 int n_systemId;
4589
4590 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4591 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4592 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
4593 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
4594 mem_base = xmlMemBlocks();
4595 ctx = gen_void_ptr(n_ctx, 0);
4596 name = gen_const_xmlChar_ptr(n_name, 1);
4597 publicId = gen_const_xmlChar_ptr(n_publicId, 2);
4598 systemId = gen_const_xmlChar_ptr(n_systemId, 3);
4599
William M. Brackf13f77f2004-11-12 16:03:48 +00004600 xmlSAX2NotationDecl(ctx, (const xmlChar *)name, (const xmlChar *)publicId, (const xmlChar *)systemId);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004601 call_tests++;
4602 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004603 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
4604 des_const_xmlChar_ptr(n_publicId, (const xmlChar *)publicId, 2);
4605 des_const_xmlChar_ptr(n_systemId, (const xmlChar *)systemId, 3);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004606 xmlResetLastError();
4607 if (mem_base != xmlMemBlocks()) {
4608 printf("Leak of %d blocks found in xmlSAX2NotationDecl",
4609 xmlMemBlocks() - mem_base);
4610 test_ret++;
4611 printf(" %d", n_ctx);
4612 printf(" %d", n_name);
4613 printf(" %d", n_publicId);
4614 printf(" %d", n_systemId);
4615 printf("\n");
4616 }
4617 }
4618 }
4619 }
4620 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004621 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004622
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004623 return(test_ret);
4624}
4625
4626
4627static int
4628test_xmlSAX2ProcessingInstruction(void) {
4629 int test_ret = 0;
4630
4631 int mem_base;
4632 void * ctx; /* the user data (XML parser context) */
4633 int n_ctx;
4634 xmlChar * target; /* the target name */
4635 int n_target;
4636 xmlChar * data; /* the PI data's */
4637 int n_data;
4638
4639 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4640 for (n_target = 0;n_target < gen_nb_const_xmlChar_ptr;n_target++) {
4641 for (n_data = 0;n_data < gen_nb_const_xmlChar_ptr;n_data++) {
4642 mem_base = xmlMemBlocks();
4643 ctx = gen_void_ptr(n_ctx, 0);
4644 target = gen_const_xmlChar_ptr(n_target, 1);
4645 data = gen_const_xmlChar_ptr(n_data, 2);
4646
William M. Brackf13f77f2004-11-12 16:03:48 +00004647 xmlSAX2ProcessingInstruction(ctx, (const xmlChar *)target, (const xmlChar *)data);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004648 call_tests++;
4649 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004650 des_const_xmlChar_ptr(n_target, (const xmlChar *)target, 1);
4651 des_const_xmlChar_ptr(n_data, (const xmlChar *)data, 2);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004652 xmlResetLastError();
4653 if (mem_base != xmlMemBlocks()) {
4654 printf("Leak of %d blocks found in xmlSAX2ProcessingInstruction",
4655 xmlMemBlocks() - mem_base);
4656 test_ret++;
4657 printf(" %d", n_ctx);
4658 printf(" %d", n_target);
4659 printf(" %d", n_data);
4660 printf("\n");
4661 }
4662 }
4663 }
4664 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004665 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004666
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004667 return(test_ret);
4668}
4669
4670
4671static int
4672test_xmlSAX2Reference(void) {
4673 int test_ret = 0;
4674
4675 int mem_base;
4676 void * ctx; /* the user data (XML parser context) */
4677 int n_ctx;
4678 xmlChar * name; /* The entity name */
4679 int n_name;
4680
4681 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4682 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4683 mem_base = xmlMemBlocks();
4684 ctx = gen_void_ptr(n_ctx, 0);
4685 name = gen_const_xmlChar_ptr(n_name, 1);
4686
William M. Brackf13f77f2004-11-12 16:03:48 +00004687 xmlSAX2Reference(ctx, (const xmlChar *)name);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004688 call_tests++;
4689 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004690 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004691 xmlResetLastError();
4692 if (mem_base != xmlMemBlocks()) {
4693 printf("Leak of %d blocks found in xmlSAX2Reference",
4694 xmlMemBlocks() - mem_base);
4695 test_ret++;
4696 printf(" %d", n_ctx);
4697 printf(" %d", n_name);
4698 printf("\n");
4699 }
4700 }
4701 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004702 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004703
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004704 return(test_ret);
4705}
4706
4707
4708static int
4709test_xmlSAX2ResolveEntity(void) {
4710 int test_ret = 0;
4711
4712 int mem_base;
4713 xmlParserInputPtr ret_val;
4714 void * ctx; /* the user data (XML parser context) */
4715 int n_ctx;
4716 xmlChar * publicId; /* The public ID of the entity */
4717 int n_publicId;
4718 xmlChar * systemId; /* The system ID of the entity */
4719 int n_systemId;
4720
4721 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4722 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
4723 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
4724 mem_base = xmlMemBlocks();
4725 ctx = gen_void_ptr(n_ctx, 0);
4726 publicId = gen_const_xmlChar_ptr(n_publicId, 1);
4727 systemId = gen_const_xmlChar_ptr(n_systemId, 2);
4728
William M. Brackf13f77f2004-11-12 16:03:48 +00004729 ret_val = xmlSAX2ResolveEntity(ctx, (const xmlChar *)publicId, (const xmlChar *)systemId);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004730 desret_xmlParserInputPtr(ret_val);
4731 call_tests++;
4732 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004733 des_const_xmlChar_ptr(n_publicId, (const xmlChar *)publicId, 1);
4734 des_const_xmlChar_ptr(n_systemId, (const xmlChar *)systemId, 2);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004735 xmlResetLastError();
4736 if (mem_base != xmlMemBlocks()) {
4737 printf("Leak of %d blocks found in xmlSAX2ResolveEntity",
4738 xmlMemBlocks() - mem_base);
4739 test_ret++;
4740 printf(" %d", n_ctx);
4741 printf(" %d", n_publicId);
4742 printf(" %d", n_systemId);
4743 printf("\n");
4744 }
4745 }
4746 }
4747 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004748 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004749
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004750 return(test_ret);
4751}
4752
4753
4754#define gen_nb_xmlSAXLocatorPtr 1
4755static xmlSAXLocatorPtr gen_xmlSAXLocatorPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
4756 return(NULL);
4757}
4758static void des_xmlSAXLocatorPtr(int no ATTRIBUTE_UNUSED, xmlSAXLocatorPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
4759}
4760
4761static int
4762test_xmlSAX2SetDocumentLocator(void) {
4763 int test_ret = 0;
4764
4765 int mem_base;
4766 void * ctx; /* the user data (XML parser context) */
4767 int n_ctx;
4768 xmlSAXLocatorPtr loc; /* A SAX Locator */
4769 int n_loc;
4770
4771 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4772 for (n_loc = 0;n_loc < gen_nb_xmlSAXLocatorPtr;n_loc++) {
4773 mem_base = xmlMemBlocks();
4774 ctx = gen_void_ptr(n_ctx, 0);
4775 loc = gen_xmlSAXLocatorPtr(n_loc, 1);
4776
4777 xmlSAX2SetDocumentLocator(ctx, loc);
4778 call_tests++;
4779 des_void_ptr(n_ctx, ctx, 0);
4780 des_xmlSAXLocatorPtr(n_loc, loc, 1);
4781 xmlResetLastError();
4782 if (mem_base != xmlMemBlocks()) {
4783 printf("Leak of %d blocks found in xmlSAX2SetDocumentLocator",
4784 xmlMemBlocks() - mem_base);
4785 test_ret++;
4786 printf(" %d", n_ctx);
4787 printf(" %d", n_loc);
4788 printf("\n");
4789 }
4790 }
4791 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004792 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004793
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004794 return(test_ret);
4795}
4796
4797
4798static int
4799test_xmlSAX2StartDocument(void) {
4800 int test_ret = 0;
4801
4802 int mem_base;
4803 void * ctx; /* the user data (XML parser context) */
4804 int n_ctx;
4805
4806 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4807 mem_base = xmlMemBlocks();
4808 ctx = gen_void_ptr(n_ctx, 0);
4809
4810 xmlSAX2StartDocument(ctx);
4811 call_tests++;
4812 des_void_ptr(n_ctx, ctx, 0);
4813 xmlResetLastError();
4814 if (mem_base != xmlMemBlocks()) {
4815 printf("Leak of %d blocks found in xmlSAX2StartDocument",
4816 xmlMemBlocks() - mem_base);
4817 test_ret++;
4818 printf(" %d", n_ctx);
4819 printf("\n");
4820 }
4821 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004822 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004823
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004824 return(test_ret);
4825}
4826
4827
4828static int
4829test_xmlSAX2StartElement(void) {
4830 int test_ret = 0;
4831
William M. Brack21e4ef22005-01-02 09:53:13 +00004832#if defined(LIBXML_SAX1_ENABLED) || defined(LIBXML_HTML_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00004833#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004834 int mem_base;
4835 void * ctx; /* the user data (XML parser context) */
4836 int n_ctx;
4837 xmlChar * fullname; /* The element name, including namespace prefix */
4838 int n_fullname;
4839 xmlChar ** atts; /* An array of name/value attributes pairs, NULL terminated */
4840 int n_atts;
4841
4842 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4843 for (n_fullname = 0;n_fullname < gen_nb_const_xmlChar_ptr;n_fullname++) {
4844 for (n_atts = 0;n_atts < gen_nb_const_xmlChar_ptr_ptr;n_atts++) {
4845 mem_base = xmlMemBlocks();
4846 ctx = gen_void_ptr(n_ctx, 0);
4847 fullname = gen_const_xmlChar_ptr(n_fullname, 1);
4848 atts = gen_const_xmlChar_ptr_ptr(n_atts, 2);
4849
William M. Brackf13f77f2004-11-12 16:03:48 +00004850 xmlSAX2StartElement(ctx, (const xmlChar *)fullname, (const xmlChar **)atts);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004851 call_tests++;
4852 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004853 des_const_xmlChar_ptr(n_fullname, (const xmlChar *)fullname, 1);
4854 des_const_xmlChar_ptr_ptr(n_atts, (const xmlChar **)atts, 2);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004855 xmlResetLastError();
4856 if (mem_base != xmlMemBlocks()) {
4857 printf("Leak of %d blocks found in xmlSAX2StartElement",
4858 xmlMemBlocks() - mem_base);
4859 test_ret++;
4860 printf(" %d", n_ctx);
4861 printf(" %d", n_fullname);
4862 printf(" %d", n_atts);
4863 printf("\n");
4864 }
4865 }
4866 }
4867 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004868 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00004869#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00004870#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004871
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004872 return(test_ret);
4873}
4874
4875
4876static int
4877test_xmlSAX2StartElementNs(void) {
4878 int test_ret = 0;
4879
4880 int mem_base;
4881 void * ctx; /* the user data (XML parser context) */
4882 int n_ctx;
4883 xmlChar * localname; /* the local name of the element */
4884 int n_localname;
4885 xmlChar * prefix; /* the element namespace prefix if available */
4886 int n_prefix;
4887 xmlChar * URI; /* the element namespace name if available */
4888 int n_URI;
4889 int nb_namespaces; /* number of namespace definitions on that node */
4890 int n_nb_namespaces;
4891 xmlChar ** namespaces; /* pointer to the array of prefix/URI pairs namespace definitions */
4892 int n_namespaces;
4893 int nb_attributes; /* the number of attributes on that node */
4894 int n_nb_attributes;
4895 int nb_defaulted; /* the number of defaulted attributes. */
4896 int n_nb_defaulted;
4897 xmlChar ** attributes; /* pointer to the array of (localname/prefix/URI/value/end) attribute values. */
4898 int n_attributes;
4899
4900 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4901 for (n_localname = 0;n_localname < gen_nb_const_xmlChar_ptr;n_localname++) {
4902 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
4903 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
4904 for (n_nb_namespaces = 0;n_nb_namespaces < gen_nb_int;n_nb_namespaces++) {
4905 for (n_namespaces = 0;n_namespaces < gen_nb_const_xmlChar_ptr_ptr;n_namespaces++) {
4906 for (n_nb_attributes = 0;n_nb_attributes < gen_nb_int;n_nb_attributes++) {
4907 for (n_nb_defaulted = 0;n_nb_defaulted < gen_nb_int;n_nb_defaulted++) {
4908 for (n_attributes = 0;n_attributes < gen_nb_const_xmlChar_ptr_ptr;n_attributes++) {
4909 mem_base = xmlMemBlocks();
4910 ctx = gen_void_ptr(n_ctx, 0);
4911 localname = gen_const_xmlChar_ptr(n_localname, 1);
4912 prefix = gen_const_xmlChar_ptr(n_prefix, 2);
4913 URI = gen_const_xmlChar_ptr(n_URI, 3);
4914 nb_namespaces = gen_int(n_nb_namespaces, 4);
4915 namespaces = gen_const_xmlChar_ptr_ptr(n_namespaces, 5);
4916 nb_attributes = gen_int(n_nb_attributes, 6);
4917 nb_defaulted = gen_int(n_nb_defaulted, 7);
4918 attributes = gen_const_xmlChar_ptr_ptr(n_attributes, 8);
4919
William M. Brackf13f77f2004-11-12 16:03:48 +00004920 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 +00004921 call_tests++;
4922 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004923 des_const_xmlChar_ptr(n_localname, (const xmlChar *)localname, 1);
4924 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 2);
4925 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 3);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004926 des_int(n_nb_namespaces, nb_namespaces, 4);
William M. Brackf13f77f2004-11-12 16:03:48 +00004927 des_const_xmlChar_ptr_ptr(n_namespaces, (const xmlChar **)namespaces, 5);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004928 des_int(n_nb_attributes, nb_attributes, 6);
4929 des_int(n_nb_defaulted, nb_defaulted, 7);
William M. Brackf13f77f2004-11-12 16:03:48 +00004930 des_const_xmlChar_ptr_ptr(n_attributes, (const xmlChar **)attributes, 8);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004931 xmlResetLastError();
4932 if (mem_base != xmlMemBlocks()) {
4933 printf("Leak of %d blocks found in xmlSAX2StartElementNs",
4934 xmlMemBlocks() - mem_base);
4935 test_ret++;
4936 printf(" %d", n_ctx);
4937 printf(" %d", n_localname);
4938 printf(" %d", n_prefix);
4939 printf(" %d", n_URI);
4940 printf(" %d", n_nb_namespaces);
4941 printf(" %d", n_namespaces);
4942 printf(" %d", n_nb_attributes);
4943 printf(" %d", n_nb_defaulted);
4944 printf(" %d", n_attributes);
4945 printf("\n");
4946 }
4947 }
4948 }
4949 }
4950 }
4951 }
4952 }
4953 }
4954 }
4955 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004956 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00004957
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004958 return(test_ret);
4959}
4960
4961
4962static int
4963test_xmlSAX2UnparsedEntityDecl(void) {
4964 int test_ret = 0;
4965
4966 int mem_base;
4967 void * ctx; /* the user data (XML parser context) */
4968 int n_ctx;
4969 xmlChar * name; /* The name of the entity */
4970 int n_name;
4971 xmlChar * publicId; /* The public ID of the entity */
4972 int n_publicId;
4973 xmlChar * systemId; /* The system ID of the entity */
4974 int n_systemId;
4975 xmlChar * notationName; /* the name of the notation */
4976 int n_notationName;
4977
4978 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
4979 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
4980 for (n_publicId = 0;n_publicId < gen_nb_const_xmlChar_ptr;n_publicId++) {
4981 for (n_systemId = 0;n_systemId < gen_nb_const_xmlChar_ptr;n_systemId++) {
4982 for (n_notationName = 0;n_notationName < gen_nb_const_xmlChar_ptr;n_notationName++) {
4983 mem_base = xmlMemBlocks();
4984 ctx = gen_void_ptr(n_ctx, 0);
4985 name = gen_const_xmlChar_ptr(n_name, 1);
4986 publicId = gen_const_xmlChar_ptr(n_publicId, 2);
4987 systemId = gen_const_xmlChar_ptr(n_systemId, 3);
4988 notationName = gen_const_xmlChar_ptr(n_notationName, 4);
4989
William M. Brackf13f77f2004-11-12 16:03:48 +00004990 xmlSAX2UnparsedEntityDecl(ctx, (const xmlChar *)name, (const xmlChar *)publicId, (const xmlChar *)systemId, (const xmlChar *)notationName);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004991 call_tests++;
4992 des_void_ptr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00004993 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
4994 des_const_xmlChar_ptr(n_publicId, (const xmlChar *)publicId, 2);
4995 des_const_xmlChar_ptr(n_systemId, (const xmlChar *)systemId, 3);
4996 des_const_xmlChar_ptr(n_notationName, (const xmlChar *)notationName, 4);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00004997 xmlResetLastError();
4998 if (mem_base != xmlMemBlocks()) {
4999 printf("Leak of %d blocks found in xmlSAX2UnparsedEntityDecl",
5000 xmlMemBlocks() - mem_base);
5001 test_ret++;
5002 printf(" %d", n_ctx);
5003 printf(" %d", n_name);
5004 printf(" %d", n_publicId);
5005 printf(" %d", n_systemId);
5006 printf(" %d", n_notationName);
5007 printf("\n");
5008 }
5009 }
5010 }
5011 }
5012 }
5013 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005014 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005015
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005016 return(test_ret);
5017}
5018
5019
5020static int
5021test_xmlSAXDefaultVersion(void) {
5022 int test_ret = 0;
5023
William M. Brack21e4ef22005-01-02 09:53:13 +00005024#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00005025#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005026 int mem_base;
5027 int ret_val;
5028 int version; /* the version, 1 or 2 */
5029 int n_version;
5030
5031 for (n_version = 0;n_version < gen_nb_int;n_version++) {
5032 mem_base = xmlMemBlocks();
5033 version = gen_int(n_version, 0);
5034
5035 ret_val = xmlSAXDefaultVersion(version);
5036 desret_int(ret_val);
5037 call_tests++;
5038 des_int(n_version, version, 0);
5039 xmlResetLastError();
5040 if (mem_base != xmlMemBlocks()) {
5041 printf("Leak of %d blocks found in xmlSAXDefaultVersion",
5042 xmlMemBlocks() - mem_base);
5043 test_ret++;
5044 printf(" %d", n_version);
5045 printf("\n");
5046 }
5047 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005048 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00005049#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00005050#endif
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005051
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005052 return(test_ret);
5053}
5054
5055
5056static int
5057test_xmlSAXVersion(void) {
5058 int test_ret = 0;
5059
5060 int mem_base;
5061 int ret_val;
5062 xmlSAXHandler * hdlr; /* the SAX handler */
5063 int n_hdlr;
5064 int version; /* the version, 1 or 2 */
5065 int n_version;
5066
5067 for (n_hdlr = 0;n_hdlr < gen_nb_xmlSAXHandler_ptr;n_hdlr++) {
5068 for (n_version = 0;n_version < gen_nb_int;n_version++) {
5069 mem_base = xmlMemBlocks();
5070 hdlr = gen_xmlSAXHandler_ptr(n_hdlr, 0);
5071 version = gen_int(n_version, 1);
5072
5073 ret_val = xmlSAXVersion(hdlr, version);
5074 desret_int(ret_val);
5075 call_tests++;
5076 des_xmlSAXHandler_ptr(n_hdlr, hdlr, 0);
5077 des_int(n_version, version, 1);
5078 xmlResetLastError();
5079 if (mem_base != xmlMemBlocks()) {
5080 printf("Leak of %d blocks found in xmlSAXVersion",
5081 xmlMemBlocks() - mem_base);
5082 test_ret++;
5083 printf(" %d", n_hdlr);
5084 printf(" %d", n_version);
5085 printf("\n");
5086 }
5087 }
5088 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005089 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005090
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005091 return(test_ret);
5092}
5093
5094static int
5095test_SAX2(void) {
5096 int test_ret = 0;
5097
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005098 if (quiet == 0) printf("Testing SAX2 : 38 of 38 functions ...\n");
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +00005099 test_ret += test_docbDefaultSAXHandlerInit();
5100 test_ret += test_htmlDefaultSAXHandlerInit();
5101 test_ret += test_xmlDefaultSAXHandlerInit();
5102 test_ret += test_xmlSAX2AttributeDecl();
5103 test_ret += test_xmlSAX2CDataBlock();
5104 test_ret += test_xmlSAX2Characters();
5105 test_ret += test_xmlSAX2Comment();
5106 test_ret += test_xmlSAX2ElementDecl();
5107 test_ret += test_xmlSAX2EndDocument();
5108 test_ret += test_xmlSAX2EndElement();
5109 test_ret += test_xmlSAX2EndElementNs();
5110 test_ret += test_xmlSAX2EntityDecl();
5111 test_ret += test_xmlSAX2ExternalSubset();
5112 test_ret += test_xmlSAX2GetColumnNumber();
5113 test_ret += test_xmlSAX2GetEntity();
5114 test_ret += test_xmlSAX2GetLineNumber();
5115 test_ret += test_xmlSAX2GetParameterEntity();
5116 test_ret += test_xmlSAX2GetPublicId();
5117 test_ret += test_xmlSAX2GetSystemId();
5118 test_ret += test_xmlSAX2HasExternalSubset();
5119 test_ret += test_xmlSAX2HasInternalSubset();
5120 test_ret += test_xmlSAX2IgnorableWhitespace();
5121 test_ret += test_xmlSAX2InitDefaultSAXHandler();
5122 test_ret += test_xmlSAX2InitDocbDefaultSAXHandler();
5123 test_ret += test_xmlSAX2InitHtmlDefaultSAXHandler();
5124 test_ret += test_xmlSAX2InternalSubset();
5125 test_ret += test_xmlSAX2IsStandalone();
5126 test_ret += test_xmlSAX2NotationDecl();
5127 test_ret += test_xmlSAX2ProcessingInstruction();
5128 test_ret += test_xmlSAX2Reference();
5129 test_ret += test_xmlSAX2ResolveEntity();
5130 test_ret += test_xmlSAX2SetDocumentLocator();
5131 test_ret += test_xmlSAX2StartDocument();
5132 test_ret += test_xmlSAX2StartElement();
5133 test_ret += test_xmlSAX2StartElementNs();
5134 test_ret += test_xmlSAX2UnparsedEntityDecl();
5135 test_ret += test_xmlSAXDefaultVersion();
5136 test_ret += test_xmlSAXVersion();
5137
5138 if (test_ret != 0)
5139 printf("Module SAX2: %d errors\n", test_ret);
5140 return(test_ret);
5141}
5142
Daniel Veillarda82b1822004-11-08 16:24:57 +00005143static int
5144test_xmlC14NDocDumpMemory(void) {
5145 int test_ret = 0;
5146
William M. Brack21e4ef22005-01-02 09:53:13 +00005147#if defined(LIBXML_C14N_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00005148 int mem_base;
5149 int ret_val;
5150 xmlDocPtr doc; /* the XML document for canonization */
5151 int n_doc;
5152 xmlNodeSetPtr nodes; /* the nodes set to be included in the canonized image or NULL if all document nodes should be included */
5153 int n_nodes;
5154 int exclusive; /* the exclusive flag (0 - non-exclusive canonicalization; otherwise - exclusive canonicalization) */
5155 int n_exclusive;
5156 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) */
5157 int n_inclusive_ns_prefixes;
5158 int with_comments; /* include comments in the result (!=0) or not (==0) */
5159 int n_with_comments;
5160 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 */
5161 int n_doc_txt_ptr;
5162
5163 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
5164 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
5165 for (n_exclusive = 0;n_exclusive < gen_nb_int;n_exclusive++) {
5166 for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) {
5167 for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) {
5168 for (n_doc_txt_ptr = 0;n_doc_txt_ptr < gen_nb_xmlChar_ptr_ptr;n_doc_txt_ptr++) {
5169 mem_base = xmlMemBlocks();
5170 doc = gen_xmlDocPtr(n_doc, 0);
5171 nodes = gen_xmlNodeSetPtr(n_nodes, 1);
5172 exclusive = gen_int(n_exclusive, 2);
5173 inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3);
5174 with_comments = gen_int(n_with_comments, 4);
5175 doc_txt_ptr = gen_xmlChar_ptr_ptr(n_doc_txt_ptr, 5);
5176
5177 ret_val = xmlC14NDocDumpMemory(doc, nodes, exclusive, inclusive_ns_prefixes, with_comments, doc_txt_ptr);
5178 desret_int(ret_val);
5179 call_tests++;
5180 des_xmlDocPtr(n_doc, doc, 0);
5181 des_xmlNodeSetPtr(n_nodes, nodes, 1);
5182 des_int(n_exclusive, exclusive, 2);
5183 des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3);
5184 des_int(n_with_comments, with_comments, 4);
5185 des_xmlChar_ptr_ptr(n_doc_txt_ptr, doc_txt_ptr, 5);
5186 xmlResetLastError();
5187 if (mem_base != xmlMemBlocks()) {
5188 printf("Leak of %d blocks found in xmlC14NDocDumpMemory",
5189 xmlMemBlocks() - mem_base);
5190 test_ret++;
5191 printf(" %d", n_doc);
5192 printf(" %d", n_nodes);
5193 printf(" %d", n_exclusive);
5194 printf(" %d", n_inclusive_ns_prefixes);
5195 printf(" %d", n_with_comments);
5196 printf(" %d", n_doc_txt_ptr);
5197 printf("\n");
5198 }
5199 }
5200 }
5201 }
5202 }
5203 }
5204 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005205 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00005206#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00005207
Daniel Veillarda82b1822004-11-08 16:24:57 +00005208 return(test_ret);
5209}
5210
5211
5212static int
5213test_xmlC14NDocSave(void) {
5214 int test_ret = 0;
5215
William M. Brack21e4ef22005-01-02 09:53:13 +00005216#if defined(LIBXML_C14N_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00005217 int mem_base;
5218 int ret_val;
5219 xmlDocPtr doc; /* the XML document for canonization */
5220 int n_doc;
5221 xmlNodeSetPtr nodes; /* the nodes set to be included in the canonized image or NULL if all document nodes should be included */
5222 int n_nodes;
5223 int exclusive; /* the exclusive flag (0 - non-exclusive canonicalization; otherwise - exclusive canonicalization) */
5224 int n_exclusive;
5225 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) */
5226 int n_inclusive_ns_prefixes;
5227 int with_comments; /* include comments in the result (!=0) or not (==0) */
5228 int n_with_comments;
5229 const char * filename; /* the filename to store canonical XML image */
5230 int n_filename;
5231 int compression; /* the compression level (zlib requred): -1 - libxml default, 0 - uncompressed, >0 - compression level */
5232 int n_compression;
5233
5234 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
5235 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
5236 for (n_exclusive = 0;n_exclusive < gen_nb_int;n_exclusive++) {
5237 for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) {
5238 for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) {
5239 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
5240 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
5241 mem_base = xmlMemBlocks();
5242 doc = gen_xmlDocPtr(n_doc, 0);
5243 nodes = gen_xmlNodeSetPtr(n_nodes, 1);
5244 exclusive = gen_int(n_exclusive, 2);
5245 inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3);
5246 with_comments = gen_int(n_with_comments, 4);
5247 filename = gen_fileoutput(n_filename, 5);
5248 compression = gen_int(n_compression, 6);
5249
5250 ret_val = xmlC14NDocSave(doc, nodes, exclusive, inclusive_ns_prefixes, with_comments, filename, compression);
5251 desret_int(ret_val);
5252 call_tests++;
5253 des_xmlDocPtr(n_doc, doc, 0);
5254 des_xmlNodeSetPtr(n_nodes, nodes, 1);
5255 des_int(n_exclusive, exclusive, 2);
5256 des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3);
5257 des_int(n_with_comments, with_comments, 4);
5258 des_fileoutput(n_filename, filename, 5);
5259 des_int(n_compression, compression, 6);
5260 xmlResetLastError();
5261 if (mem_base != xmlMemBlocks()) {
5262 printf("Leak of %d blocks found in xmlC14NDocSave",
5263 xmlMemBlocks() - mem_base);
5264 test_ret++;
5265 printf(" %d", n_doc);
5266 printf(" %d", n_nodes);
5267 printf(" %d", n_exclusive);
5268 printf(" %d", n_inclusive_ns_prefixes);
5269 printf(" %d", n_with_comments);
5270 printf(" %d", n_filename);
5271 printf(" %d", n_compression);
5272 printf("\n");
5273 }
5274 }
5275 }
5276 }
5277 }
5278 }
5279 }
5280 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005281 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00005282#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00005283
Daniel Veillarda82b1822004-11-08 16:24:57 +00005284 return(test_ret);
5285}
5286
5287
5288static int
5289test_xmlC14NDocSaveTo(void) {
5290 int test_ret = 0;
5291
William M. Brack21e4ef22005-01-02 09:53:13 +00005292#if defined(LIBXML_C14N_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00005293 int mem_base;
5294 int ret_val;
5295 xmlDocPtr doc; /* the XML document for canonization */
5296 int n_doc;
5297 xmlNodeSetPtr nodes; /* the nodes set to be included in the canonized image or NULL if all document nodes should be included */
5298 int n_nodes;
5299 int exclusive; /* the exclusive flag (0 - non-exclusive canonicalization; otherwise - exclusive canonicalization) */
5300 int n_exclusive;
5301 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) */
5302 int n_inclusive_ns_prefixes;
5303 int with_comments; /* include comments in the result (!=0) or not (==0) */
5304 int n_with_comments;
5305 xmlOutputBufferPtr buf; /* the output buffer to store canonical XML; this buffer MUST have encoder==NULL because C14N requires UTF-8 output */
5306 int n_buf;
5307
5308 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
5309 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
5310 for (n_exclusive = 0;n_exclusive < gen_nb_int;n_exclusive++) {
5311 for (n_inclusive_ns_prefixes = 0;n_inclusive_ns_prefixes < gen_nb_xmlChar_ptr_ptr;n_inclusive_ns_prefixes++) {
5312 for (n_with_comments = 0;n_with_comments < gen_nb_int;n_with_comments++) {
5313 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
5314 mem_base = xmlMemBlocks();
5315 doc = gen_xmlDocPtr(n_doc, 0);
5316 nodes = gen_xmlNodeSetPtr(n_nodes, 1);
5317 exclusive = gen_int(n_exclusive, 2);
5318 inclusive_ns_prefixes = gen_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, 3);
5319 with_comments = gen_int(n_with_comments, 4);
5320 buf = gen_xmlOutputBufferPtr(n_buf, 5);
5321
5322 ret_val = xmlC14NDocSaveTo(doc, nodes, exclusive, inclusive_ns_prefixes, with_comments, buf);
5323 desret_int(ret_val);
5324 call_tests++;
5325 des_xmlDocPtr(n_doc, doc, 0);
5326 des_xmlNodeSetPtr(n_nodes, nodes, 1);
5327 des_int(n_exclusive, exclusive, 2);
5328 des_xmlChar_ptr_ptr(n_inclusive_ns_prefixes, inclusive_ns_prefixes, 3);
5329 des_int(n_with_comments, with_comments, 4);
5330 des_xmlOutputBufferPtr(n_buf, buf, 5);
5331 xmlResetLastError();
5332 if (mem_base != xmlMemBlocks()) {
5333 printf("Leak of %d blocks found in xmlC14NDocSaveTo",
5334 xmlMemBlocks() - mem_base);
5335 test_ret++;
5336 printf(" %d", n_doc);
5337 printf(" %d", n_nodes);
5338 printf(" %d", n_exclusive);
5339 printf(" %d", n_inclusive_ns_prefixes);
5340 printf(" %d", n_with_comments);
5341 printf(" %d", n_buf);
5342 printf("\n");
5343 }
5344 }
5345 }
5346 }
5347 }
5348 }
5349 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005350 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00005351#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00005352
Daniel Veillarda82b1822004-11-08 16:24:57 +00005353 return(test_ret);
5354}
5355
5356
5357static int
5358test_xmlC14NExecute(void) {
5359 int test_ret = 0;
5360
5361
5362 /* missing type support */
5363 return(test_ret);
5364}
5365
5366static int
5367test_c14n(void) {
5368 int test_ret = 0;
5369
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005370 if (quiet == 0) printf("Testing c14n : 3 of 4 functions ...\n");
Daniel Veillarda82b1822004-11-08 16:24:57 +00005371 test_ret += test_xmlC14NDocDumpMemory();
5372 test_ret += test_xmlC14NDocSave();
5373 test_ret += test_xmlC14NDocSaveTo();
5374 test_ret += test_xmlC14NExecute();
5375
5376 if (test_ret != 0)
5377 printf("Module c14n: %d errors\n", test_ret);
5378 return(test_ret);
5379}
Daniel Veillarda521d282004-11-09 14:59:59 +00005380#ifdef LIBXML_CATALOG_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +00005381
Daniel Veillardce682bc2004-11-05 17:22:25 +00005382#define gen_nb_xmlCatalogPtr 1
5383static xmlCatalogPtr gen_xmlCatalogPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
5384 return(NULL);
5385}
5386static void des_xmlCatalogPtr(int no ATTRIBUTE_UNUSED, xmlCatalogPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
5387}
Daniel Veillarda521d282004-11-09 14:59:59 +00005388#endif
5389
Daniel Veillardce682bc2004-11-05 17:22:25 +00005390
Daniel Veillardd93f6252004-11-02 15:53:51 +00005391static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00005392test_xmlACatalogAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005393 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005394
William M. Brack21e4ef22005-01-02 09:53:13 +00005395#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005396 int mem_base;
5397 int ret_val;
5398 xmlCatalogPtr catal; /* a Catalog */
5399 int n_catal;
5400 xmlChar * type; /* the type of record to add to the catalog */
5401 int n_type;
5402 xmlChar * orig; /* the system, public or prefix to match */
5403 int n_orig;
5404 xmlChar * replace; /* the replacement value for the match */
5405 int n_replace;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005406
Daniel Veillardce682bc2004-11-05 17:22:25 +00005407 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5408 for (n_type = 0;n_type < gen_nb_const_xmlChar_ptr;n_type++) {
5409 for (n_orig = 0;n_orig < gen_nb_const_xmlChar_ptr;n_orig++) {
5410 for (n_replace = 0;n_replace < gen_nb_const_xmlChar_ptr;n_replace++) {
5411 mem_base = xmlMemBlocks();
5412 catal = gen_xmlCatalogPtr(n_catal, 0);
5413 type = gen_const_xmlChar_ptr(n_type, 1);
5414 orig = gen_const_xmlChar_ptr(n_orig, 2);
5415 replace = gen_const_xmlChar_ptr(n_replace, 3);
5416
William M. Brackf13f77f2004-11-12 16:03:48 +00005417 ret_val = xmlACatalogAdd(catal, (const xmlChar *)type, (const xmlChar *)orig, (const xmlChar *)replace);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005418 desret_int(ret_val);
5419 call_tests++;
5420 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005421 des_const_xmlChar_ptr(n_type, (const xmlChar *)type, 1);
5422 des_const_xmlChar_ptr(n_orig, (const xmlChar *)orig, 2);
5423 des_const_xmlChar_ptr(n_replace, (const xmlChar *)replace, 3);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005424 xmlResetLastError();
5425 if (mem_base != xmlMemBlocks()) {
5426 printf("Leak of %d blocks found in xmlACatalogAdd",
5427 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005428 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005429 printf(" %d", n_catal);
5430 printf(" %d", n_type);
5431 printf(" %d", n_orig);
5432 printf(" %d", n_replace);
5433 printf("\n");
5434 }
5435 }
5436 }
5437 }
5438 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005439 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005440#endif
5441
Daniel Veillard42595322004-11-08 10:52:06 +00005442 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005443}
5444
5445
5446static int
5447test_xmlACatalogDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005448 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005449
William M. Brack21e4ef22005-01-02 09:53:13 +00005450#if defined(LIBXML_CATALOG_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005451 int mem_base;
5452 xmlCatalogPtr catal; /* a Catalog */
5453 int n_catal;
5454 FILE * out; /* the file. */
5455 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005456
Daniel Veillardce682bc2004-11-05 17:22:25 +00005457 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5458 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
5459 mem_base = xmlMemBlocks();
5460 catal = gen_xmlCatalogPtr(n_catal, 0);
5461 out = gen_FILE_ptr(n_out, 1);
5462
5463 xmlACatalogDump(catal, out);
5464 call_tests++;
5465 des_xmlCatalogPtr(n_catal, catal, 0);
5466 des_FILE_ptr(n_out, out, 1);
5467 xmlResetLastError();
5468 if (mem_base != xmlMemBlocks()) {
5469 printf("Leak of %d blocks found in xmlACatalogDump",
5470 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005471 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005472 printf(" %d", n_catal);
5473 printf(" %d", n_out);
5474 printf("\n");
5475 }
5476 }
5477 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005478 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005479#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +00005480
Daniel Veillard42595322004-11-08 10:52:06 +00005481 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005482}
5483
5484
5485static int
5486test_xmlACatalogRemove(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005487 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005488
William M. Brack21e4ef22005-01-02 09:53:13 +00005489#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005490 int mem_base;
5491 int ret_val;
5492 xmlCatalogPtr catal; /* a Catalog */
5493 int n_catal;
5494 xmlChar * value; /* the value to remove */
5495 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005496
Daniel Veillardce682bc2004-11-05 17:22:25 +00005497 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5498 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
5499 mem_base = xmlMemBlocks();
5500 catal = gen_xmlCatalogPtr(n_catal, 0);
5501 value = gen_const_xmlChar_ptr(n_value, 1);
5502
William M. Brackf13f77f2004-11-12 16:03:48 +00005503 ret_val = xmlACatalogRemove(catal, (const xmlChar *)value);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005504 desret_int(ret_val);
5505 call_tests++;
5506 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005507 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005508 xmlResetLastError();
5509 if (mem_base != xmlMemBlocks()) {
5510 printf("Leak of %d blocks found in xmlACatalogRemove",
5511 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005512 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005513 printf(" %d", n_catal);
5514 printf(" %d", n_value);
5515 printf("\n");
5516 }
5517 }
5518 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005519 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005520#endif
5521
Daniel Veillard42595322004-11-08 10:52:06 +00005522 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005523}
5524
5525
5526static int
5527test_xmlACatalogResolve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005528 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005529
William M. Brack21e4ef22005-01-02 09:53:13 +00005530#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005531 int mem_base;
5532 xmlChar * ret_val;
5533 xmlCatalogPtr catal; /* a Catalog */
5534 int n_catal;
5535 xmlChar * pubID; /* the public ID string */
5536 int n_pubID;
5537 xmlChar * sysID; /* the system ID string */
5538 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005539
Daniel Veillardce682bc2004-11-05 17:22:25 +00005540 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5541 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
5542 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
5543 mem_base = xmlMemBlocks();
5544 catal = gen_xmlCatalogPtr(n_catal, 0);
5545 pubID = gen_const_xmlChar_ptr(n_pubID, 1);
5546 sysID = gen_const_xmlChar_ptr(n_sysID, 2);
5547
William M. Brackf13f77f2004-11-12 16:03:48 +00005548 ret_val = xmlACatalogResolve(catal, (const xmlChar *)pubID, (const xmlChar *)sysID);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005549 desret_xmlChar_ptr(ret_val);
5550 call_tests++;
5551 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005552 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 1);
5553 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005554 xmlResetLastError();
5555 if (mem_base != xmlMemBlocks()) {
5556 printf("Leak of %d blocks found in xmlACatalogResolve",
5557 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005558 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005559 printf(" %d", n_catal);
5560 printf(" %d", n_pubID);
5561 printf(" %d", n_sysID);
5562 printf("\n");
5563 }
5564 }
5565 }
5566 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005567 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005568#endif
5569
Daniel Veillard42595322004-11-08 10:52:06 +00005570 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005571}
5572
5573
5574static int
5575test_xmlACatalogResolvePublic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005576 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005577
William M. Brack21e4ef22005-01-02 09:53:13 +00005578#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005579 int mem_base;
5580 xmlChar * ret_val;
5581 xmlCatalogPtr catal; /* a Catalog */
5582 int n_catal;
5583 xmlChar * pubID; /* the public ID string */
5584 int n_pubID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005585
Daniel Veillardce682bc2004-11-05 17:22:25 +00005586 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5587 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
5588 mem_base = xmlMemBlocks();
5589 catal = gen_xmlCatalogPtr(n_catal, 0);
5590 pubID = gen_const_xmlChar_ptr(n_pubID, 1);
5591
William M. Brackf13f77f2004-11-12 16:03:48 +00005592 ret_val = xmlACatalogResolvePublic(catal, (const xmlChar *)pubID);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005593 desret_xmlChar_ptr(ret_val);
5594 call_tests++;
5595 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005596 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005597 xmlResetLastError();
5598 if (mem_base != xmlMemBlocks()) {
5599 printf("Leak of %d blocks found in xmlACatalogResolvePublic",
5600 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005601 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005602 printf(" %d", n_catal);
5603 printf(" %d", n_pubID);
5604 printf("\n");
5605 }
5606 }
5607 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005608 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005609#endif
5610
Daniel Veillard42595322004-11-08 10:52:06 +00005611 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005612}
5613
5614
5615static int
5616test_xmlACatalogResolveSystem(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005617 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005618
William M. Brack21e4ef22005-01-02 09:53:13 +00005619#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005620 int mem_base;
5621 xmlChar * ret_val;
5622 xmlCatalogPtr catal; /* a Catalog */
5623 int n_catal;
5624 xmlChar * sysID; /* the system ID string */
5625 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005626
Daniel Veillardce682bc2004-11-05 17:22:25 +00005627 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5628 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
5629 mem_base = xmlMemBlocks();
5630 catal = gen_xmlCatalogPtr(n_catal, 0);
5631 sysID = gen_const_xmlChar_ptr(n_sysID, 1);
5632
William M. Brackf13f77f2004-11-12 16:03:48 +00005633 ret_val = xmlACatalogResolveSystem(catal, (const xmlChar *)sysID);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005634 desret_xmlChar_ptr(ret_val);
5635 call_tests++;
5636 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005637 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005638 xmlResetLastError();
5639 if (mem_base != xmlMemBlocks()) {
5640 printf("Leak of %d blocks found in xmlACatalogResolveSystem",
5641 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005642 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005643 printf(" %d", n_catal);
5644 printf(" %d", n_sysID);
5645 printf("\n");
5646 }
5647 }
5648 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005649 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005650#endif
5651
Daniel Veillard42595322004-11-08 10:52:06 +00005652 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005653}
5654
5655
5656static int
5657test_xmlACatalogResolveURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005658 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005659
William M. Brack21e4ef22005-01-02 09:53:13 +00005660#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005661 int mem_base;
5662 xmlChar * ret_val;
5663 xmlCatalogPtr catal; /* a Catalog */
5664 int n_catal;
5665 xmlChar * URI; /* the URI */
5666 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005667
Daniel Veillardce682bc2004-11-05 17:22:25 +00005668 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5669 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
5670 mem_base = xmlMemBlocks();
5671 catal = gen_xmlCatalogPtr(n_catal, 0);
5672 URI = gen_const_xmlChar_ptr(n_URI, 1);
5673
William M. Brackf13f77f2004-11-12 16:03:48 +00005674 ret_val = xmlACatalogResolveURI(catal, (const xmlChar *)URI);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005675 desret_xmlChar_ptr(ret_val);
5676 call_tests++;
5677 des_xmlCatalogPtr(n_catal, catal, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005678 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00005679 xmlResetLastError();
5680 if (mem_base != xmlMemBlocks()) {
5681 printf("Leak of %d blocks found in xmlACatalogResolveURI",
5682 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005683 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005684 printf(" %d", n_catal);
5685 printf(" %d", n_URI);
5686 printf("\n");
5687 }
5688 }
5689 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005690 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005691#endif
5692
Daniel Veillard42595322004-11-08 10:52:06 +00005693 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005694}
5695
5696
5697static int
5698test_xmlCatalogAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005699 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005700
William M. Brack21e4ef22005-01-02 09:53:13 +00005701#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00005702 int mem_base;
5703 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005704 xmlChar * type; /* the type of record to add to the catalog */
Daniel Veillardd93f6252004-11-02 15:53:51 +00005705 int n_type;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005706 xmlChar * orig; /* the system, public or prefix to match */
Daniel Veillardd93f6252004-11-02 15:53:51 +00005707 int n_orig;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005708 xmlChar * replace; /* the replacement value for the match */
Daniel Veillardd93f6252004-11-02 15:53:51 +00005709 int n_replace;
5710
5711 for (n_type = 0;n_type < gen_nb_const_xmlChar_ptr;n_type++) {
5712 for (n_orig = 0;n_orig < gen_nb_const_xmlChar_ptr;n_orig++) {
5713 for (n_replace = 0;n_replace < gen_nb_const_xmlChar_ptr;n_replace++) {
5714 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00005715 type = gen_const_xmlChar_ptr(n_type, 0);
5716 orig = gen_const_xmlChar_ptr(n_orig, 1);
5717 replace = gen_const_xmlChar_ptr(n_replace, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005718
William M. Brackf13f77f2004-11-12 16:03:48 +00005719 ret_val = xmlCatalogAdd((const xmlChar *)type, (const xmlChar *)orig, (const xmlChar *)replace);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005720 desret_int(ret_val);
5721 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00005722 des_const_xmlChar_ptr(n_type, (const xmlChar *)type, 0);
5723 des_const_xmlChar_ptr(n_orig, (const xmlChar *)orig, 1);
5724 des_const_xmlChar_ptr(n_replace, (const xmlChar *)replace, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005725 xmlResetLastError();
5726 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00005727 printf("Leak of %d blocks found in xmlCatalogAdd",
Daniel Veillardd93f6252004-11-02 15:53:51 +00005728 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005729 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00005730 printf(" %d", n_type);
5731 printf(" %d", n_orig);
5732 printf(" %d", n_replace);
5733 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00005734 }
5735 }
5736 }
5737 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005738 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005739#endif
5740
Daniel Veillard42595322004-11-08 10:52:06 +00005741 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005742}
5743
5744
5745static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00005746test_xmlCatalogCleanup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005747 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005748
William M. Brack21e4ef22005-01-02 09:53:13 +00005749#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00005750
Daniel Veillardd93f6252004-11-02 15:53:51 +00005751
5752 xmlCatalogCleanup();
5753 call_tests++;
5754 xmlResetLastError();
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005755 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005756#endif
5757
Daniel Veillard42595322004-11-08 10:52:06 +00005758 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005759}
5760
5761
5762static int
5763test_xmlCatalogConvert(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005764 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005765
William M. Brack21e4ef22005-01-02 09:53:13 +00005766#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00005767 int ret_val;
5768
5769
5770 ret_val = xmlCatalogConvert();
5771 desret_int(ret_val);
5772 call_tests++;
5773 xmlResetLastError();
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005774 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005775#endif
5776
Daniel Veillard42595322004-11-08 10:52:06 +00005777 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005778}
5779
5780
5781static int
5782test_xmlCatalogDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005783 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005784
William M. Brack21e4ef22005-01-02 09:53:13 +00005785#if defined(LIBXML_CATALOG_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005786 int mem_base;
5787 FILE * out; /* the file. */
5788 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005789
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005790 for (n_out = 0;n_out < gen_nb_FILE_ptr;n_out++) {
5791 mem_base = xmlMemBlocks();
5792 out = gen_FILE_ptr(n_out, 0);
5793
5794 xmlCatalogDump(out);
5795 call_tests++;
5796 des_FILE_ptr(n_out, out, 0);
5797 xmlResetLastError();
5798 if (mem_base != xmlMemBlocks()) {
5799 printf("Leak of %d blocks found in xmlCatalogDump",
5800 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005801 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005802 printf(" %d", n_out);
5803 printf("\n");
5804 }
5805 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005806 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005807#endif
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00005808
Daniel Veillard42595322004-11-08 10:52:06 +00005809 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005810}
5811
5812
5813static int
5814test_xmlCatalogGetDefaults(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005815 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005816
William M. Brack21e4ef22005-01-02 09:53:13 +00005817#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +00005818 int mem_base;
5819 xmlCatalogAllow ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005820
Daniel Veillard57b25162004-11-06 14:50:18 +00005821 mem_base = xmlMemBlocks();
5822
5823 ret_val = xmlCatalogGetDefaults();
5824 desret_xmlCatalogAllow(ret_val);
5825 call_tests++;
5826 xmlResetLastError();
5827 if (mem_base != xmlMemBlocks()) {
5828 printf("Leak of %d blocks found in xmlCatalogGetDefaults",
5829 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005830 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00005831 printf("\n");
5832 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005833 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00005834#endif
5835
Daniel Veillard42595322004-11-08 10:52:06 +00005836 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005837}
5838
5839
5840static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00005841test_xmlCatalogIsEmpty(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005842 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005843
William M. Brack21e4ef22005-01-02 09:53:13 +00005844#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00005845 int mem_base;
5846 int ret_val;
5847 xmlCatalogPtr catal; /* should this create an SGML catalog */
5848 int n_catal;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005849
Daniel Veillardce682bc2004-11-05 17:22:25 +00005850 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
5851 mem_base = xmlMemBlocks();
5852 catal = gen_xmlCatalogPtr(n_catal, 0);
5853
5854 ret_val = xmlCatalogIsEmpty(catal);
5855 desret_int(ret_val);
5856 call_tests++;
5857 des_xmlCatalogPtr(n_catal, catal, 0);
5858 xmlResetLastError();
5859 if (mem_base != xmlMemBlocks()) {
5860 printf("Leak of %d blocks found in xmlCatalogIsEmpty",
5861 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005862 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005863 printf(" %d", n_catal);
5864 printf("\n");
5865 }
5866 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005867 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005868#endif
5869
Daniel Veillard42595322004-11-08 10:52:06 +00005870 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005871}
5872
5873
5874static int
5875test_xmlCatalogLocalResolve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005876 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005877
William M. Brack21e4ef22005-01-02 09:53:13 +00005878#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005879 int mem_base;
5880 xmlChar * ret_val;
5881 void * catalogs; /* a document's list of catalogs */
5882 int n_catalogs;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005883 xmlChar * pubID; /* the public ID string */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005884 int n_pubID;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005885 xmlChar * sysID; /* the system ID string */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005886 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005887
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005888 for (n_catalogs = 0;n_catalogs < gen_nb_void_ptr;n_catalogs++) {
5889 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
5890 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
5891 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00005892 catalogs = gen_void_ptr(n_catalogs, 0);
5893 pubID = gen_const_xmlChar_ptr(n_pubID, 1);
5894 sysID = gen_const_xmlChar_ptr(n_sysID, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005895
William M. Brackf13f77f2004-11-12 16:03:48 +00005896 ret_val = xmlCatalogLocalResolve(catalogs, (const xmlChar *)pubID, (const xmlChar *)sysID);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005897 desret_xmlChar_ptr(ret_val);
5898 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00005899 des_void_ptr(n_catalogs, catalogs, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005900 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 1);
5901 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005902 xmlResetLastError();
5903 if (mem_base != xmlMemBlocks()) {
5904 printf("Leak of %d blocks found in xmlCatalogLocalResolve",
5905 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005906 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005907 printf(" %d", n_catalogs);
5908 printf(" %d", n_pubID);
5909 printf(" %d", n_sysID);
5910 printf("\n");
5911 }
5912 }
5913 }
5914 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005915 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005916#endif
5917
Daniel Veillard42595322004-11-08 10:52:06 +00005918 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005919}
5920
5921
5922static int
5923test_xmlCatalogLocalResolveURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005924 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005925
William M. Brack21e4ef22005-01-02 09:53:13 +00005926#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005927 int mem_base;
5928 xmlChar * ret_val;
5929 void * catalogs; /* a document's list of catalogs */
5930 int n_catalogs;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005931 xmlChar * URI; /* the URI */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005932 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005933
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005934 for (n_catalogs = 0;n_catalogs < gen_nb_void_ptr;n_catalogs++) {
5935 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
5936 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00005937 catalogs = gen_void_ptr(n_catalogs, 0);
5938 URI = gen_const_xmlChar_ptr(n_URI, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005939
William M. Brackf13f77f2004-11-12 16:03:48 +00005940 ret_val = xmlCatalogLocalResolveURI(catalogs, (const xmlChar *)URI);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005941 desret_xmlChar_ptr(ret_val);
5942 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00005943 des_void_ptr(n_catalogs, catalogs, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00005944 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005945 xmlResetLastError();
5946 if (mem_base != xmlMemBlocks()) {
5947 printf("Leak of %d blocks found in xmlCatalogLocalResolveURI",
5948 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00005949 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005950 printf(" %d", n_catalogs);
5951 printf(" %d", n_URI);
5952 printf("\n");
5953 }
5954 }
5955 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005956 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00005957#endif
5958
Daniel Veillard42595322004-11-08 10:52:06 +00005959 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005960}
5961
5962
5963static int
5964test_xmlCatalogRemove(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005965 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005966
William M. Brack21e4ef22005-01-02 09:53:13 +00005967#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00005968 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005969 xmlChar * value; /* the value to remove */
Daniel Veillardd93f6252004-11-02 15:53:51 +00005970 int n_value;
5971
5972 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00005973 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005974
William M. Brackf13f77f2004-11-12 16:03:48 +00005975 ret_val = xmlCatalogRemove((const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005976 desret_int(ret_val);
5977 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00005978 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005979 xmlResetLastError();
5980 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00005981 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005982#endif
5983
Daniel Veillard42595322004-11-08 10:52:06 +00005984 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00005985}
5986
5987
5988static int
5989test_xmlCatalogResolve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00005990 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005991
William M. Brack21e4ef22005-01-02 09:53:13 +00005992#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +00005993 int mem_base;
5994 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005995 xmlChar * pubID; /* the public ID string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00005996 int n_pubID;
Daniel Veillardce682bc2004-11-05 17:22:25 +00005997 xmlChar * sysID; /* the system ID string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00005998 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00005999
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006000 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
6001 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
6002 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006003 pubID = gen_const_xmlChar_ptr(n_pubID, 0);
6004 sysID = gen_const_xmlChar_ptr(n_sysID, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006005
William M. Brackf13f77f2004-11-12 16:03:48 +00006006 ret_val = xmlCatalogResolve((const xmlChar *)pubID, (const xmlChar *)sysID);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006007 desret_xmlChar_ptr(ret_val);
6008 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006009 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 0);
6010 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006011 xmlResetLastError();
6012 if (mem_base != xmlMemBlocks()) {
6013 printf("Leak of %d blocks found in xmlCatalogResolve",
6014 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006015 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006016 printf(" %d", n_pubID);
6017 printf(" %d", n_sysID);
6018 printf("\n");
6019 }
6020 }
6021 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006022 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006023#endif
6024
Daniel Veillard42595322004-11-08 10:52:06 +00006025 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006026}
6027
6028
6029static int
6030test_xmlCatalogResolvePublic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006031 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006032
William M. Brack21e4ef22005-01-02 09:53:13 +00006033#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006034 int mem_base;
6035 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006036 xmlChar * pubID; /* the public ID string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006037 int n_pubID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006038
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006039 for (n_pubID = 0;n_pubID < gen_nb_const_xmlChar_ptr;n_pubID++) {
6040 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006041 pubID = gen_const_xmlChar_ptr(n_pubID, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006042
William M. Brackf13f77f2004-11-12 16:03:48 +00006043 ret_val = xmlCatalogResolvePublic((const xmlChar *)pubID);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006044 desret_xmlChar_ptr(ret_val);
6045 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006046 des_const_xmlChar_ptr(n_pubID, (const xmlChar *)pubID, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006047 xmlResetLastError();
6048 if (mem_base != xmlMemBlocks()) {
6049 printf("Leak of %d blocks found in xmlCatalogResolvePublic",
6050 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006051 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006052 printf(" %d", n_pubID);
6053 printf("\n");
6054 }
6055 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006056 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006057#endif
6058
Daniel Veillard42595322004-11-08 10:52:06 +00006059 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006060}
6061
6062
6063static int
6064test_xmlCatalogResolveSystem(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006065 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006066
William M. Brack21e4ef22005-01-02 09:53:13 +00006067#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006068 int mem_base;
6069 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006070 xmlChar * sysID; /* the system ID string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006071 int n_sysID;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006072
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006073 for (n_sysID = 0;n_sysID < gen_nb_const_xmlChar_ptr;n_sysID++) {
6074 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006075 sysID = gen_const_xmlChar_ptr(n_sysID, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006076
William M. Brackf13f77f2004-11-12 16:03:48 +00006077 ret_val = xmlCatalogResolveSystem((const xmlChar *)sysID);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006078 desret_xmlChar_ptr(ret_val);
6079 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006080 des_const_xmlChar_ptr(n_sysID, (const xmlChar *)sysID, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006081 xmlResetLastError();
6082 if (mem_base != xmlMemBlocks()) {
6083 printf("Leak of %d blocks found in xmlCatalogResolveSystem",
6084 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006085 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006086 printf(" %d", n_sysID);
6087 printf("\n");
6088 }
6089 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006090 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006091#endif
6092
Daniel Veillard42595322004-11-08 10:52:06 +00006093 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006094}
6095
6096
6097static int
6098test_xmlCatalogResolveURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006099 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006100
William M. Brack21e4ef22005-01-02 09:53:13 +00006101#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006102 int mem_base;
6103 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006104 xmlChar * URI; /* the URI */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006105 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006106
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006107 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
6108 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006109 URI = gen_const_xmlChar_ptr(n_URI, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006110
William M. Brackf13f77f2004-11-12 16:03:48 +00006111 ret_val = xmlCatalogResolveURI((const xmlChar *)URI);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006112 desret_xmlChar_ptr(ret_val);
6113 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006114 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006115 xmlResetLastError();
6116 if (mem_base != xmlMemBlocks()) {
6117 printf("Leak of %d blocks found in xmlCatalogResolveURI",
6118 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006119 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006120 printf(" %d", n_URI);
6121 printf("\n");
6122 }
6123 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006124 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00006125#endif
6126
Daniel Veillard42595322004-11-08 10:52:06 +00006127 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006128}
6129
6130
6131static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00006132test_xmlCatalogSetDefaultPrefer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006133 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006134
William M. Brack21e4ef22005-01-02 09:53:13 +00006135#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +00006136 int mem_base;
6137 xmlCatalogPrefer ret_val;
6138 xmlCatalogPrefer prefer; /* the default preference for delegation */
6139 int n_prefer;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006140
Daniel Veillard57b25162004-11-06 14:50:18 +00006141 for (n_prefer = 0;n_prefer < gen_nb_xmlCatalogPrefer;n_prefer++) {
6142 mem_base = xmlMemBlocks();
6143 prefer = gen_xmlCatalogPrefer(n_prefer, 0);
6144
6145 ret_val = xmlCatalogSetDefaultPrefer(prefer);
6146 desret_xmlCatalogPrefer(ret_val);
6147 call_tests++;
6148 des_xmlCatalogPrefer(n_prefer, prefer, 0);
6149 xmlResetLastError();
6150 if (mem_base != xmlMemBlocks()) {
6151 printf("Leak of %d blocks found in xmlCatalogSetDefaultPrefer",
6152 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006153 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00006154 printf(" %d", n_prefer);
6155 printf("\n");
6156 }
6157 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006158 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00006159#endif
6160
Daniel Veillard42595322004-11-08 10:52:06 +00006161 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006162}
6163
6164
6165static int
6166test_xmlCatalogSetDefaults(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006167 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006168
William M. Brack21e4ef22005-01-02 09:53:13 +00006169#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +00006170 int mem_base;
6171 xmlCatalogAllow allow; /* what catalogs should be accepted */
6172 int n_allow;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006173
Daniel Veillard57b25162004-11-06 14:50:18 +00006174 for (n_allow = 0;n_allow < gen_nb_xmlCatalogAllow;n_allow++) {
6175 mem_base = xmlMemBlocks();
6176 allow = gen_xmlCatalogAllow(n_allow, 0);
6177
6178 xmlCatalogSetDefaults(allow);
6179 call_tests++;
6180 des_xmlCatalogAllow(n_allow, allow, 0);
6181 xmlResetLastError();
6182 if (mem_base != xmlMemBlocks()) {
6183 printf("Leak of %d blocks found in xmlCatalogSetDefaults",
6184 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006185 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +00006186 printf(" %d", n_allow);
6187 printf("\n");
6188 }
6189 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006190 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +00006191#endif
6192
Daniel Veillard42595322004-11-08 10:52:06 +00006193 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006194}
6195
6196
6197static int
6198test_xmlConvertSGMLCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006199 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006200
William M. Brack21e4ef22005-01-02 09:53:13 +00006201#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00006202 int mem_base;
6203 int ret_val;
6204 xmlCatalogPtr catal; /* the catalog */
6205 int n_catal;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006206
Daniel Veillardce682bc2004-11-05 17:22:25 +00006207 for (n_catal = 0;n_catal < gen_nb_xmlCatalogPtr;n_catal++) {
6208 mem_base = xmlMemBlocks();
6209 catal = gen_xmlCatalogPtr(n_catal, 0);
6210
6211 ret_val = xmlConvertSGMLCatalog(catal);
6212 desret_int(ret_val);
6213 call_tests++;
6214 des_xmlCatalogPtr(n_catal, catal, 0);
6215 xmlResetLastError();
6216 if (mem_base != xmlMemBlocks()) {
6217 printf("Leak of %d blocks found in xmlConvertSGMLCatalog",
6218 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006219 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006220 printf(" %d", n_catal);
6221 printf("\n");
6222 }
6223 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006224 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006225#endif
6226
Daniel Veillard42595322004-11-08 10:52:06 +00006227 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006228}
6229
6230
6231static int
6232test_xmlInitializeCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006233 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006234
William M. Brack21e4ef22005-01-02 09:53:13 +00006235#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00006236 int mem_base;
6237
6238 mem_base = xmlMemBlocks();
6239
6240 xmlInitializeCatalog();
6241 call_tests++;
6242 xmlResetLastError();
6243 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00006244 printf("Leak of %d blocks found in xmlInitializeCatalog",
Daniel Veillardd93f6252004-11-02 15:53:51 +00006245 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006246 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00006247 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00006248 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006249 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006250#endif
6251
Daniel Veillard42595322004-11-08 10:52:06 +00006252 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006253}
6254
6255
6256static int
6257test_xmlLoadACatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006258 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006259
6260
6261 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00006262 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006263}
6264
6265
6266static int
6267test_xmlLoadCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006268 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006269
William M. Brack21e4ef22005-01-02 09:53:13 +00006270#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00006271 int ret_val;
6272 const char * filename; /* a file path */
6273 int n_filename;
6274
6275 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00006276 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006277
6278 ret_val = xmlLoadCatalog(filename);
6279 desret_int(ret_val);
6280 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006281 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006282 xmlResetLastError();
6283 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006284 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006285#endif
6286
Daniel Veillard42595322004-11-08 10:52:06 +00006287 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006288}
6289
6290
6291static int
6292test_xmlLoadCatalogs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006293 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006294
William M. Brack21e4ef22005-01-02 09:53:13 +00006295#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00006296 char * pathss; /* a list of directories separated by a colon or a space. */
Daniel Veillardd93f6252004-11-02 15:53:51 +00006297 int n_pathss;
6298
6299 for (n_pathss = 0;n_pathss < gen_nb_const_char_ptr;n_pathss++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00006300 pathss = gen_const_char_ptr(n_pathss, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006301
William M. Brackf13f77f2004-11-12 16:03:48 +00006302 xmlLoadCatalogs((const char *)pathss);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006303 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00006304 des_const_char_ptr(n_pathss, (const char *)pathss, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006305 xmlResetLastError();
6306 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006307 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006308#endif
6309
Daniel Veillard42595322004-11-08 10:52:06 +00006310 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006311}
6312
6313
6314static int
6315test_xmlLoadSGMLSuperCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006316 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006317
6318
6319 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00006320 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006321}
6322
6323
6324static int
6325test_xmlNewCatalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006326 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006327
6328
6329 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00006330 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006331}
6332
6333
6334static int
6335test_xmlParseCatalogFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006336 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006337
William M. Brack21e4ef22005-01-02 09:53:13 +00006338#if defined(LIBXML_CATALOG_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +00006339 int mem_base;
6340 xmlDocPtr ret_val;
6341 const char * filename; /* the filename */
6342 int n_filename;
6343
6344 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
6345 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00006346 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006347
6348 ret_val = xmlParseCatalogFile(filename);
6349 desret_xmlDocPtr(ret_val);
6350 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006351 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006352 xmlResetLastError();
6353 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00006354 printf("Leak of %d blocks found in xmlParseCatalogFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +00006355 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006356 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00006357 printf(" %d", n_filename);
6358 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00006359 }
6360 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006361 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006362#endif
6363
Daniel Veillard42595322004-11-08 10:52:06 +00006364 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006365}
6366
6367static int
6368test_catalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006369 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006370
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006371 if (quiet == 0) printf("Testing catalog : 27 of 36 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00006372 test_ret += test_xmlACatalogAdd();
6373 test_ret += test_xmlACatalogDump();
6374 test_ret += test_xmlACatalogRemove();
6375 test_ret += test_xmlACatalogResolve();
6376 test_ret += test_xmlACatalogResolvePublic();
6377 test_ret += test_xmlACatalogResolveSystem();
6378 test_ret += test_xmlACatalogResolveURI();
6379 test_ret += test_xmlCatalogAdd();
6380 test_ret += test_xmlCatalogCleanup();
6381 test_ret += test_xmlCatalogConvert();
6382 test_ret += test_xmlCatalogDump();
6383 test_ret += test_xmlCatalogGetDefaults();
6384 test_ret += test_xmlCatalogIsEmpty();
6385 test_ret += test_xmlCatalogLocalResolve();
6386 test_ret += test_xmlCatalogLocalResolveURI();
6387 test_ret += test_xmlCatalogRemove();
6388 test_ret += test_xmlCatalogResolve();
6389 test_ret += test_xmlCatalogResolvePublic();
6390 test_ret += test_xmlCatalogResolveSystem();
6391 test_ret += test_xmlCatalogResolveURI();
6392 test_ret += test_xmlCatalogSetDefaultPrefer();
6393 test_ret += test_xmlCatalogSetDefaults();
6394 test_ret += test_xmlConvertSGMLCatalog();
6395 test_ret += test_xmlInitializeCatalog();
6396 test_ret += test_xmlLoadACatalog();
6397 test_ret += test_xmlLoadCatalog();
6398 test_ret += test_xmlLoadCatalogs();
6399 test_ret += test_xmlLoadSGMLSuperCatalog();
6400 test_ret += test_xmlNewCatalog();
6401 test_ret += test_xmlParseCatalogFile();
Daniel Veillardd93f6252004-11-02 15:53:51 +00006402
Daniel Veillard42595322004-11-08 10:52:06 +00006403 if (test_ret != 0)
6404 printf("Module catalog: %d errors\n", test_ret);
6405 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006406}
6407
Daniel Veillardce682bc2004-11-05 17:22:25 +00006408#define gen_nb_const_xmlChRangeGroupPtr 1
6409static xmlChRangeGroupPtr gen_const_xmlChRangeGroupPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
6410 return(NULL);
6411}
6412static void des_const_xmlChRangeGroupPtr(int no ATTRIBUTE_UNUSED, const xmlChRangeGroupPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
6413}
6414
Daniel Veillardd93f6252004-11-02 15:53:51 +00006415static int
6416test_xmlCharInRange(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006417 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006418
Daniel Veillardce682bc2004-11-05 17:22:25 +00006419 int mem_base;
6420 int ret_val;
6421 unsigned int val; /* character to be validated */
6422 int n_val;
6423 xmlChRangeGroupPtr rptr; /* pointer to range to be used to validate */
6424 int n_rptr;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006425
Daniel Veillardce682bc2004-11-05 17:22:25 +00006426 for (n_val = 0;n_val < gen_nb_unsigned_int;n_val++) {
6427 for (n_rptr = 0;n_rptr < gen_nb_const_xmlChRangeGroupPtr;n_rptr++) {
6428 mem_base = xmlMemBlocks();
6429 val = gen_unsigned_int(n_val, 0);
6430 rptr = gen_const_xmlChRangeGroupPtr(n_rptr, 1);
6431
William M. Brackf13f77f2004-11-12 16:03:48 +00006432 ret_val = xmlCharInRange(val, (const xmlChRangeGroupPtr)rptr);
Daniel Veillardce682bc2004-11-05 17:22:25 +00006433 desret_int(ret_val);
6434 call_tests++;
6435 des_unsigned_int(n_val, val, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00006436 des_const_xmlChRangeGroupPtr(n_rptr, (const xmlChRangeGroupPtr)rptr, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +00006437 xmlResetLastError();
6438 if (mem_base != xmlMemBlocks()) {
6439 printf("Leak of %d blocks found in xmlCharInRange",
6440 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006441 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00006442 printf(" %d", n_val);
6443 printf(" %d", n_rptr);
6444 printf("\n");
6445 }
6446 }
6447 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00006448 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006449
Daniel Veillard42595322004-11-08 10:52:06 +00006450 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006451}
6452
6453
6454static int
6455test_xmlIsBaseChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006456 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006457
Daniel Veillard3d97e662004-11-04 10:49:00 +00006458 int mem_base;
6459 int ret_val;
6460 unsigned int ch; /* character to validate */
6461 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006462
Daniel Veillard3d97e662004-11-04 10:49:00 +00006463 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6464 mem_base = xmlMemBlocks();
6465 ch = gen_unsigned_int(n_ch, 0);
6466
6467 ret_val = xmlIsBaseChar(ch);
6468 desret_int(ret_val);
6469 call_tests++;
6470 des_unsigned_int(n_ch, ch, 0);
6471 xmlResetLastError();
6472 if (mem_base != xmlMemBlocks()) {
6473 printf("Leak of %d blocks found in xmlIsBaseChar",
6474 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006475 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006476 printf(" %d", n_ch);
6477 printf("\n");
6478 }
6479 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006480 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006481
Daniel Veillard42595322004-11-08 10:52:06 +00006482 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006483}
6484
6485
6486static int
6487test_xmlIsBlank(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006488 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006489
Daniel Veillard3d97e662004-11-04 10:49:00 +00006490 int mem_base;
6491 int ret_val;
6492 unsigned int ch; /* character to validate */
6493 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006494
Daniel Veillard3d97e662004-11-04 10:49:00 +00006495 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6496 mem_base = xmlMemBlocks();
6497 ch = gen_unsigned_int(n_ch, 0);
6498
6499 ret_val = xmlIsBlank(ch);
6500 desret_int(ret_val);
6501 call_tests++;
6502 des_unsigned_int(n_ch, ch, 0);
6503 xmlResetLastError();
6504 if (mem_base != xmlMemBlocks()) {
6505 printf("Leak of %d blocks found in xmlIsBlank",
6506 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006507 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006508 printf(" %d", n_ch);
6509 printf("\n");
6510 }
6511 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006512 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006513
Daniel Veillard42595322004-11-08 10:52:06 +00006514 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006515}
6516
6517
6518static int
6519test_xmlIsChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006520 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006521
Daniel Veillard3d97e662004-11-04 10:49:00 +00006522 int mem_base;
6523 int ret_val;
6524 unsigned int ch; /* character to validate */
6525 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006526
Daniel Veillard3d97e662004-11-04 10:49:00 +00006527 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6528 mem_base = xmlMemBlocks();
6529 ch = gen_unsigned_int(n_ch, 0);
6530
6531 ret_val = xmlIsChar(ch);
6532 desret_int(ret_val);
6533 call_tests++;
6534 des_unsigned_int(n_ch, ch, 0);
6535 xmlResetLastError();
6536 if (mem_base != xmlMemBlocks()) {
6537 printf("Leak of %d blocks found in xmlIsChar",
6538 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006539 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006540 printf(" %d", n_ch);
6541 printf("\n");
6542 }
6543 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006544 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006545
Daniel Veillard42595322004-11-08 10:52:06 +00006546 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006547}
6548
6549
6550static int
6551test_xmlIsCombining(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006552 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006553
Daniel Veillard3d97e662004-11-04 10:49:00 +00006554 int mem_base;
6555 int ret_val;
6556 unsigned int ch; /* character to validate */
6557 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006558
Daniel Veillard3d97e662004-11-04 10:49:00 +00006559 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6560 mem_base = xmlMemBlocks();
6561 ch = gen_unsigned_int(n_ch, 0);
6562
6563 ret_val = xmlIsCombining(ch);
6564 desret_int(ret_val);
6565 call_tests++;
6566 des_unsigned_int(n_ch, ch, 0);
6567 xmlResetLastError();
6568 if (mem_base != xmlMemBlocks()) {
6569 printf("Leak of %d blocks found in xmlIsCombining",
6570 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006571 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006572 printf(" %d", n_ch);
6573 printf("\n");
6574 }
6575 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006576 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006577
Daniel Veillard42595322004-11-08 10:52:06 +00006578 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006579}
6580
6581
6582static int
6583test_xmlIsDigit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006584 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006585
Daniel Veillard3d97e662004-11-04 10:49:00 +00006586 int mem_base;
6587 int ret_val;
6588 unsigned int ch; /* character to validate */
6589 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006590
Daniel Veillard3d97e662004-11-04 10:49:00 +00006591 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6592 mem_base = xmlMemBlocks();
6593 ch = gen_unsigned_int(n_ch, 0);
6594
6595 ret_val = xmlIsDigit(ch);
6596 desret_int(ret_val);
6597 call_tests++;
6598 des_unsigned_int(n_ch, ch, 0);
6599 xmlResetLastError();
6600 if (mem_base != xmlMemBlocks()) {
6601 printf("Leak of %d blocks found in xmlIsDigit",
6602 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006603 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006604 printf(" %d", n_ch);
6605 printf("\n");
6606 }
6607 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006608 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006609
Daniel Veillard42595322004-11-08 10:52:06 +00006610 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006611}
6612
6613
6614static int
6615test_xmlIsExtender(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006616 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006617
Daniel Veillard3d97e662004-11-04 10:49:00 +00006618 int mem_base;
6619 int ret_val;
6620 unsigned int ch; /* character to validate */
6621 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006622
Daniel Veillard3d97e662004-11-04 10:49:00 +00006623 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6624 mem_base = xmlMemBlocks();
6625 ch = gen_unsigned_int(n_ch, 0);
6626
6627 ret_val = xmlIsExtender(ch);
6628 desret_int(ret_val);
6629 call_tests++;
6630 des_unsigned_int(n_ch, ch, 0);
6631 xmlResetLastError();
6632 if (mem_base != xmlMemBlocks()) {
6633 printf("Leak of %d blocks found in xmlIsExtender",
6634 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006635 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006636 printf(" %d", n_ch);
6637 printf("\n");
6638 }
6639 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006640 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006641
Daniel Veillard42595322004-11-08 10:52:06 +00006642 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006643}
6644
6645
6646static int
6647test_xmlIsIdeographic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006648 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006649
Daniel Veillard3d97e662004-11-04 10:49:00 +00006650 int mem_base;
6651 int ret_val;
6652 unsigned int ch; /* character to validate */
6653 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006654
Daniel Veillard3d97e662004-11-04 10:49:00 +00006655 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6656 mem_base = xmlMemBlocks();
6657 ch = gen_unsigned_int(n_ch, 0);
6658
6659 ret_val = xmlIsIdeographic(ch);
6660 desret_int(ret_val);
6661 call_tests++;
6662 des_unsigned_int(n_ch, ch, 0);
6663 xmlResetLastError();
6664 if (mem_base != xmlMemBlocks()) {
6665 printf("Leak of %d blocks found in xmlIsIdeographic",
6666 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006667 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006668 printf(" %d", n_ch);
6669 printf("\n");
6670 }
6671 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006672 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006673
Daniel Veillard42595322004-11-08 10:52:06 +00006674 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006675}
6676
6677
6678static int
6679test_xmlIsPubidChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006680 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006681
Daniel Veillard3d97e662004-11-04 10:49:00 +00006682 int mem_base;
6683 int ret_val;
6684 unsigned int ch; /* character to validate */
6685 int n_ch;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006686
Daniel Veillard3d97e662004-11-04 10:49:00 +00006687 for (n_ch = 0;n_ch < gen_nb_unsigned_int;n_ch++) {
6688 mem_base = xmlMemBlocks();
6689 ch = gen_unsigned_int(n_ch, 0);
6690
6691 ret_val = xmlIsPubidChar(ch);
6692 desret_int(ret_val);
6693 call_tests++;
6694 des_unsigned_int(n_ch, ch, 0);
6695 xmlResetLastError();
6696 if (mem_base != xmlMemBlocks()) {
6697 printf("Leak of %d blocks found in xmlIsPubidChar",
6698 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00006699 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00006700 printf(" %d", n_ch);
6701 printf("\n");
6702 }
6703 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00006704 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006705
Daniel Veillard42595322004-11-08 10:52:06 +00006706 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006707}
6708
6709static int
6710test_chvalid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00006711 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00006712
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006713 if (quiet == 0) printf("Testing chvalid : 9 of 9 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00006714 test_ret += test_xmlCharInRange();
6715 test_ret += test_xmlIsBaseChar();
6716 test_ret += test_xmlIsBlank();
6717 test_ret += test_xmlIsChar();
6718 test_ret += test_xmlIsCombining();
6719 test_ret += test_xmlIsDigit();
6720 test_ret += test_xmlIsExtender();
6721 test_ret += test_xmlIsIdeographic();
6722 test_ret += test_xmlIsPubidChar();
Daniel Veillardd93f6252004-11-02 15:53:51 +00006723
Daniel Veillard42595322004-11-08 10:52:06 +00006724 if (test_ret != 0)
6725 printf("Module chvalid: %d errors\n", test_ret);
6726 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00006727}
6728
6729static int
Daniel Veillarda82b1822004-11-08 16:24:57 +00006730test_xmlBoolToText(void) {
6731 int test_ret = 0;
6732
William M. Brack21e4ef22005-01-02 09:53:13 +00006733#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00006734 int mem_base;
6735 const char * ret_val;
6736 int boolval; /* a bool to turn into text */
6737 int n_boolval;
6738
6739 for (n_boolval = 0;n_boolval < gen_nb_int;n_boolval++) {
6740 mem_base = xmlMemBlocks();
6741 boolval = gen_int(n_boolval, 0);
6742
6743 ret_val = xmlBoolToText(boolval);
6744 desret_const_char_ptr(ret_val);
6745 call_tests++;
6746 des_int(n_boolval, boolval, 0);
6747 xmlResetLastError();
6748 if (mem_base != xmlMemBlocks()) {
6749 printf("Leak of %d blocks found in xmlBoolToText",
6750 xmlMemBlocks() - mem_base);
6751 test_ret++;
6752 printf(" %d", n_boolval);
6753 printf("\n");
6754 }
6755 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006756 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00006757#endif
6758
Daniel Veillarda82b1822004-11-08 16:24:57 +00006759 return(test_ret);
6760}
6761
6762
6763static int
6764test_xmlDebugCheckDocument(void) {
6765 int test_ret = 0;
6766
William M. Brack21e4ef22005-01-02 09:53:13 +00006767#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00006768 int mem_base;
6769 int ret_val;
6770 FILE * output; /* the FILE * for the output */
6771 int n_output;
6772 xmlDocPtr doc; /* the document */
6773 int n_doc;
6774
6775 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
6776 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
6777 mem_base = xmlMemBlocks();
6778 output = gen_debug_FILE_ptr(n_output, 0);
6779 doc = gen_xmlDocPtr(n_doc, 1);
6780
6781 ret_val = xmlDebugCheckDocument(output, doc);
6782 desret_int(ret_val);
6783 call_tests++;
6784 des_debug_FILE_ptr(n_output, output, 0);
6785 des_xmlDocPtr(n_doc, doc, 1);
6786 xmlResetLastError();
6787 if (mem_base != xmlMemBlocks()) {
6788 printf("Leak of %d blocks found in xmlDebugCheckDocument",
6789 xmlMemBlocks() - mem_base);
6790 test_ret++;
6791 printf(" %d", n_output);
6792 printf(" %d", n_doc);
6793 printf("\n");
6794 }
6795 }
6796 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006797 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00006798#endif
6799
Daniel Veillarda82b1822004-11-08 16:24:57 +00006800 return(test_ret);
6801}
6802
6803
6804static int
6805test_xmlDebugDumpAttr(void) {
6806 int test_ret = 0;
6807
William M. Brack21e4ef22005-01-02 09:53:13 +00006808#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00006809 int mem_base;
6810 FILE * output; /* the FILE * for the output */
6811 int n_output;
6812 xmlAttrPtr attr; /* the attribute */
6813 int n_attr;
6814 int depth; /* the indentation level. */
6815 int n_depth;
6816
6817 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
6818 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
6819 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
6820 mem_base = xmlMemBlocks();
6821 output = gen_debug_FILE_ptr(n_output, 0);
6822 attr = gen_xmlAttrPtr(n_attr, 1);
6823 depth = gen_int(n_depth, 2);
6824
6825 xmlDebugDumpAttr(output, attr, depth);
6826 call_tests++;
6827 des_debug_FILE_ptr(n_output, output, 0);
6828 des_xmlAttrPtr(n_attr, attr, 1);
6829 des_int(n_depth, depth, 2);
6830 xmlResetLastError();
6831 if (mem_base != xmlMemBlocks()) {
6832 printf("Leak of %d blocks found in xmlDebugDumpAttr",
6833 xmlMemBlocks() - mem_base);
6834 test_ret++;
6835 printf(" %d", n_output);
6836 printf(" %d", n_attr);
6837 printf(" %d", n_depth);
6838 printf("\n");
6839 }
6840 }
6841 }
6842 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006843 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00006844#endif
6845
Daniel Veillarda82b1822004-11-08 16:24:57 +00006846 return(test_ret);
6847}
6848
6849
6850static int
6851test_xmlDebugDumpAttrList(void) {
6852 int test_ret = 0;
6853
William M. Brack21e4ef22005-01-02 09:53:13 +00006854#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00006855 int mem_base;
6856 FILE * output; /* the FILE * for the output */
6857 int n_output;
6858 xmlAttrPtr attr; /* the attribute list */
6859 int n_attr;
6860 int depth; /* the indentation level. */
6861 int n_depth;
6862
6863 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
6864 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
6865 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
6866 mem_base = xmlMemBlocks();
6867 output = gen_debug_FILE_ptr(n_output, 0);
6868 attr = gen_xmlAttrPtr(n_attr, 1);
6869 depth = gen_int(n_depth, 2);
6870
6871 xmlDebugDumpAttrList(output, attr, depth);
6872 call_tests++;
6873 des_debug_FILE_ptr(n_output, output, 0);
6874 des_xmlAttrPtr(n_attr, attr, 1);
6875 des_int(n_depth, depth, 2);
6876 xmlResetLastError();
6877 if (mem_base != xmlMemBlocks()) {
6878 printf("Leak of %d blocks found in xmlDebugDumpAttrList",
6879 xmlMemBlocks() - mem_base);
6880 test_ret++;
6881 printf(" %d", n_output);
6882 printf(" %d", n_attr);
6883 printf(" %d", n_depth);
6884 printf("\n");
6885 }
6886 }
6887 }
6888 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006889 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00006890#endif
6891
Daniel Veillarda82b1822004-11-08 16:24:57 +00006892 return(test_ret);
6893}
6894
6895
6896static int
6897test_xmlDebugDumpDTD(void) {
6898 int test_ret = 0;
6899
William M. Brack21e4ef22005-01-02 09:53:13 +00006900#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00006901 int mem_base;
6902 FILE * output; /* the FILE * for the output */
6903 int n_output;
6904 xmlDtdPtr dtd; /* the DTD */
6905 int n_dtd;
6906
6907 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
6908 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
6909 mem_base = xmlMemBlocks();
6910 output = gen_debug_FILE_ptr(n_output, 0);
6911 dtd = gen_xmlDtdPtr(n_dtd, 1);
6912
6913 xmlDebugDumpDTD(output, dtd);
6914 call_tests++;
6915 des_debug_FILE_ptr(n_output, output, 0);
6916 des_xmlDtdPtr(n_dtd, dtd, 1);
6917 xmlResetLastError();
6918 if (mem_base != xmlMemBlocks()) {
6919 printf("Leak of %d blocks found in xmlDebugDumpDTD",
6920 xmlMemBlocks() - mem_base);
6921 test_ret++;
6922 printf(" %d", n_output);
6923 printf(" %d", n_dtd);
6924 printf("\n");
6925 }
6926 }
6927 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006928 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00006929#endif
6930
Daniel Veillarda82b1822004-11-08 16:24:57 +00006931 return(test_ret);
6932}
6933
6934
6935static int
6936test_xmlDebugDumpDocument(void) {
6937 int test_ret = 0;
6938
William M. Brack21e4ef22005-01-02 09:53:13 +00006939#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00006940 int mem_base;
6941 FILE * output; /* the FILE * for the output */
6942 int n_output;
6943 xmlDocPtr doc; /* the document */
6944 int n_doc;
6945
6946 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
6947 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
6948 mem_base = xmlMemBlocks();
6949 output = gen_debug_FILE_ptr(n_output, 0);
6950 doc = gen_xmlDocPtr(n_doc, 1);
6951
6952 xmlDebugDumpDocument(output, doc);
6953 call_tests++;
6954 des_debug_FILE_ptr(n_output, output, 0);
6955 des_xmlDocPtr(n_doc, doc, 1);
6956 xmlResetLastError();
6957 if (mem_base != xmlMemBlocks()) {
6958 printf("Leak of %d blocks found in xmlDebugDumpDocument",
6959 xmlMemBlocks() - mem_base);
6960 test_ret++;
6961 printf(" %d", n_output);
6962 printf(" %d", n_doc);
6963 printf("\n");
6964 }
6965 }
6966 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00006967 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00006968#endif
6969
Daniel Veillarda82b1822004-11-08 16:24:57 +00006970 return(test_ret);
6971}
6972
6973
6974static int
6975test_xmlDebugDumpDocumentHead(void) {
6976 int test_ret = 0;
6977
William M. Brack21e4ef22005-01-02 09:53:13 +00006978#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00006979 int mem_base;
6980 FILE * output; /* the FILE * for the output */
6981 int n_output;
6982 xmlDocPtr doc; /* the document */
6983 int n_doc;
6984
6985 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
6986 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
6987 mem_base = xmlMemBlocks();
6988 output = gen_debug_FILE_ptr(n_output, 0);
6989 doc = gen_xmlDocPtr(n_doc, 1);
6990
6991 xmlDebugDumpDocumentHead(output, doc);
6992 call_tests++;
6993 des_debug_FILE_ptr(n_output, output, 0);
6994 des_xmlDocPtr(n_doc, doc, 1);
6995 xmlResetLastError();
6996 if (mem_base != xmlMemBlocks()) {
6997 printf("Leak of %d blocks found in xmlDebugDumpDocumentHead",
6998 xmlMemBlocks() - mem_base);
6999 test_ret++;
7000 printf(" %d", n_output);
7001 printf(" %d", n_doc);
7002 printf("\n");
7003 }
7004 }
7005 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007006 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007007#endif
7008
Daniel Veillarda82b1822004-11-08 16:24:57 +00007009 return(test_ret);
7010}
7011
7012
7013static int
7014test_xmlDebugDumpEntities(void) {
7015 int test_ret = 0;
7016
William M. Brack21e4ef22005-01-02 09:53:13 +00007017#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007018 int mem_base;
7019 FILE * output; /* the FILE * for the output */
7020 int n_output;
7021 xmlDocPtr doc; /* the document */
7022 int n_doc;
7023
7024 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7025 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
7026 mem_base = xmlMemBlocks();
7027 output = gen_debug_FILE_ptr(n_output, 0);
7028 doc = gen_xmlDocPtr(n_doc, 1);
7029
7030 xmlDebugDumpEntities(output, doc);
7031 call_tests++;
7032 des_debug_FILE_ptr(n_output, output, 0);
7033 des_xmlDocPtr(n_doc, doc, 1);
7034 xmlResetLastError();
7035 if (mem_base != xmlMemBlocks()) {
7036 printf("Leak of %d blocks found in xmlDebugDumpEntities",
7037 xmlMemBlocks() - mem_base);
7038 test_ret++;
7039 printf(" %d", n_output);
7040 printf(" %d", n_doc);
7041 printf("\n");
7042 }
7043 }
7044 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007045 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007046#endif
7047
Daniel Veillarda82b1822004-11-08 16:24:57 +00007048 return(test_ret);
7049}
7050
7051
7052static int
7053test_xmlDebugDumpNode(void) {
7054 int test_ret = 0;
7055
William M. Brack21e4ef22005-01-02 09:53:13 +00007056#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007057 int mem_base;
7058 FILE * output; /* the FILE * for the output */
7059 int n_output;
7060 xmlNodePtr node; /* the node */
7061 int n_node;
7062 int depth; /* the indentation level. */
7063 int n_depth;
7064
7065 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7066 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7067 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
7068 mem_base = xmlMemBlocks();
7069 output = gen_debug_FILE_ptr(n_output, 0);
7070 node = gen_xmlNodePtr(n_node, 1);
7071 depth = gen_int(n_depth, 2);
7072
7073 xmlDebugDumpNode(output, node, depth);
7074 call_tests++;
7075 des_debug_FILE_ptr(n_output, output, 0);
7076 des_xmlNodePtr(n_node, node, 1);
7077 des_int(n_depth, depth, 2);
7078 xmlResetLastError();
7079 if (mem_base != xmlMemBlocks()) {
7080 printf("Leak of %d blocks found in xmlDebugDumpNode",
7081 xmlMemBlocks() - mem_base);
7082 test_ret++;
7083 printf(" %d", n_output);
7084 printf(" %d", n_node);
7085 printf(" %d", n_depth);
7086 printf("\n");
7087 }
7088 }
7089 }
7090 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007091 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007092#endif
7093
Daniel Veillarda82b1822004-11-08 16:24:57 +00007094 return(test_ret);
7095}
7096
7097
7098static int
7099test_xmlDebugDumpNodeList(void) {
7100 int test_ret = 0;
7101
William M. Brack21e4ef22005-01-02 09:53:13 +00007102#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007103 int mem_base;
7104 FILE * output; /* the FILE * for the output */
7105 int n_output;
7106 xmlNodePtr node; /* the node list */
7107 int n_node;
7108 int depth; /* the indentation level. */
7109 int n_depth;
7110
7111 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7112 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7113 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
7114 mem_base = xmlMemBlocks();
7115 output = gen_debug_FILE_ptr(n_output, 0);
7116 node = gen_xmlNodePtr(n_node, 1);
7117 depth = gen_int(n_depth, 2);
7118
7119 xmlDebugDumpNodeList(output, node, depth);
7120 call_tests++;
7121 des_debug_FILE_ptr(n_output, output, 0);
7122 des_xmlNodePtr(n_node, node, 1);
7123 des_int(n_depth, depth, 2);
7124 xmlResetLastError();
7125 if (mem_base != xmlMemBlocks()) {
7126 printf("Leak of %d blocks found in xmlDebugDumpNodeList",
7127 xmlMemBlocks() - mem_base);
7128 test_ret++;
7129 printf(" %d", n_output);
7130 printf(" %d", n_node);
7131 printf(" %d", n_depth);
7132 printf("\n");
7133 }
7134 }
7135 }
7136 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007137 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007138#endif
7139
Daniel Veillarda82b1822004-11-08 16:24:57 +00007140 return(test_ret);
7141}
7142
7143
7144static int
7145test_xmlDebugDumpOneNode(void) {
7146 int test_ret = 0;
7147
William M. Brack21e4ef22005-01-02 09:53:13 +00007148#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007149 int mem_base;
7150 FILE * output; /* the FILE * for the output */
7151 int n_output;
7152 xmlNodePtr node; /* the node */
7153 int n_node;
7154 int depth; /* the indentation level. */
7155 int n_depth;
7156
7157 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7158 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7159 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
7160 mem_base = xmlMemBlocks();
7161 output = gen_debug_FILE_ptr(n_output, 0);
7162 node = gen_xmlNodePtr(n_node, 1);
7163 depth = gen_int(n_depth, 2);
7164
7165 xmlDebugDumpOneNode(output, node, depth);
7166 call_tests++;
7167 des_debug_FILE_ptr(n_output, output, 0);
7168 des_xmlNodePtr(n_node, node, 1);
7169 des_int(n_depth, depth, 2);
7170 xmlResetLastError();
7171 if (mem_base != xmlMemBlocks()) {
7172 printf("Leak of %d blocks found in xmlDebugDumpOneNode",
7173 xmlMemBlocks() - mem_base);
7174 test_ret++;
7175 printf(" %d", n_output);
7176 printf(" %d", n_node);
7177 printf(" %d", n_depth);
7178 printf("\n");
7179 }
7180 }
7181 }
7182 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007183 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007184#endif
7185
Daniel Veillarda82b1822004-11-08 16:24:57 +00007186 return(test_ret);
7187}
7188
7189
7190static int
7191test_xmlDebugDumpString(void) {
7192 int test_ret = 0;
7193
William M. Brack21e4ef22005-01-02 09:53:13 +00007194#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007195 int mem_base;
7196 FILE * output; /* the FILE * for the output */
7197 int n_output;
7198 xmlChar * str; /* the string */
7199 int n_str;
7200
7201 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7202 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
7203 mem_base = xmlMemBlocks();
7204 output = gen_debug_FILE_ptr(n_output, 0);
7205 str = gen_const_xmlChar_ptr(n_str, 1);
7206
William M. Brackf13f77f2004-11-12 16:03:48 +00007207 xmlDebugDumpString(output, (const xmlChar *)str);
Daniel Veillarda82b1822004-11-08 16:24:57 +00007208 call_tests++;
7209 des_debug_FILE_ptr(n_output, output, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00007210 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +00007211 xmlResetLastError();
7212 if (mem_base != xmlMemBlocks()) {
7213 printf("Leak of %d blocks found in xmlDebugDumpString",
7214 xmlMemBlocks() - mem_base);
7215 test_ret++;
7216 printf(" %d", n_output);
7217 printf(" %d", n_str);
7218 printf("\n");
7219 }
7220 }
7221 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007222 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007223#endif
7224
Daniel Veillarda82b1822004-11-08 16:24:57 +00007225 return(test_ret);
7226}
7227
7228
7229static int
7230test_xmlLsCountNode(void) {
7231 int test_ret = 0;
7232
William M. Brack21e4ef22005-01-02 09:53:13 +00007233#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007234 int mem_base;
7235 int ret_val;
7236 xmlNodePtr node; /* the node to count */
7237 int n_node;
7238
7239 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7240 mem_base = xmlMemBlocks();
7241 node = gen_xmlNodePtr(n_node, 0);
7242
7243 ret_val = xmlLsCountNode(node);
7244 desret_int(ret_val);
7245 call_tests++;
7246 des_xmlNodePtr(n_node, node, 0);
7247 xmlResetLastError();
7248 if (mem_base != xmlMemBlocks()) {
7249 printf("Leak of %d blocks found in xmlLsCountNode",
7250 xmlMemBlocks() - mem_base);
7251 test_ret++;
7252 printf(" %d", n_node);
7253 printf("\n");
7254 }
7255 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007256 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007257#endif
7258
Daniel Veillarda82b1822004-11-08 16:24:57 +00007259 return(test_ret);
7260}
7261
7262
7263static int
7264test_xmlLsOneNode(void) {
7265 int test_ret = 0;
7266
William M. Brack21e4ef22005-01-02 09:53:13 +00007267#if defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007268 int mem_base;
7269 FILE * output; /* the FILE * for the output */
7270 int n_output;
7271 xmlNodePtr node; /* the node to dump */
7272 int n_node;
7273
7274 for (n_output = 0;n_output < gen_nb_debug_FILE_ptr;n_output++) {
7275 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7276 mem_base = xmlMemBlocks();
7277 output = gen_debug_FILE_ptr(n_output, 0);
7278 node = gen_xmlNodePtr(n_node, 1);
7279
7280 xmlLsOneNode(output, node);
7281 call_tests++;
7282 des_debug_FILE_ptr(n_output, output, 0);
7283 des_xmlNodePtr(n_node, node, 1);
7284 xmlResetLastError();
7285 if (mem_base != xmlMemBlocks()) {
7286 printf("Leak of %d blocks found in xmlLsOneNode",
7287 xmlMemBlocks() - mem_base);
7288 test_ret++;
7289 printf(" %d", n_output);
7290 printf(" %d", n_node);
7291 printf("\n");
7292 }
7293 }
7294 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007295 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +00007296#endif
7297
Daniel Veillarda82b1822004-11-08 16:24:57 +00007298 return(test_ret);
7299}
7300
7301
7302#define gen_nb_char_ptr 1
7303static char * gen_char_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
7304 return(NULL);
7305}
7306static void des_char_ptr(int no ATTRIBUTE_UNUSED, char * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
7307}
7308
7309static int
7310test_xmlShell(void) {
7311 int test_ret = 0;
7312
7313
7314 /* missing type support */
7315 return(test_ret);
7316}
7317
7318
Daniel Veillarda82b1822004-11-08 16:24:57 +00007319static int
7320test_xmlShellBase(void) {
7321 int test_ret = 0;
7322
William M. Brack21e4ef22005-01-02 09:53:13 +00007323#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007324 int mem_base;
7325 int ret_val;
7326 xmlShellCtxtPtr ctxt; /* the shell context */
7327 int n_ctxt;
7328 char * arg; /* unused */
7329 int n_arg;
7330 xmlNodePtr node; /* a node */
7331 int n_node;
7332 xmlNodePtr node2; /* unused */
7333 int n_node2;
7334
7335 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7336 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7337 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7338 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7339 mem_base = xmlMemBlocks();
7340 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7341 arg = gen_char_ptr(n_arg, 1);
7342 node = gen_xmlNodePtr(n_node, 2);
7343 node2 = gen_xmlNodePtr(n_node2, 3);
7344
7345 ret_val = xmlShellBase(ctxt, arg, node, node2);
7346 desret_int(ret_val);
7347 call_tests++;
7348 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7349 des_char_ptr(n_arg, arg, 1);
7350 des_xmlNodePtr(n_node, node, 2);
7351 des_xmlNodePtr(n_node2, node2, 3);
7352 xmlResetLastError();
7353 if (mem_base != xmlMemBlocks()) {
7354 printf("Leak of %d blocks found in xmlShellBase",
7355 xmlMemBlocks() - mem_base);
7356 test_ret++;
7357 printf(" %d", n_ctxt);
7358 printf(" %d", n_arg);
7359 printf(" %d", n_node);
7360 printf(" %d", n_node2);
7361 printf("\n");
7362 }
7363 }
7364 }
7365 }
7366 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007367 function_tests++;
7368#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007369
Daniel Veillarda82b1822004-11-08 16:24:57 +00007370 return(test_ret);
7371}
7372
7373
7374static int
7375test_xmlShellCat(void) {
7376 int test_ret = 0;
7377
William M. Brack21e4ef22005-01-02 09:53:13 +00007378#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007379 int mem_base;
7380 int ret_val;
7381 xmlShellCtxtPtr ctxt; /* the shell context */
7382 int n_ctxt;
7383 char * arg; /* unused */
7384 int n_arg;
7385 xmlNodePtr node; /* a node */
7386 int n_node;
7387 xmlNodePtr node2; /* unused */
7388 int n_node2;
7389
7390 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7391 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7392 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7393 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7394 mem_base = xmlMemBlocks();
7395 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7396 arg = gen_char_ptr(n_arg, 1);
7397 node = gen_xmlNodePtr(n_node, 2);
7398 node2 = gen_xmlNodePtr(n_node2, 3);
7399
7400 ret_val = xmlShellCat(ctxt, arg, node, node2);
7401 desret_int(ret_val);
7402 call_tests++;
7403 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7404 des_char_ptr(n_arg, arg, 1);
7405 des_xmlNodePtr(n_node, node, 2);
7406 des_xmlNodePtr(n_node2, node2, 3);
7407 xmlResetLastError();
7408 if (mem_base != xmlMemBlocks()) {
7409 printf("Leak of %d blocks found in xmlShellCat",
7410 xmlMemBlocks() - mem_base);
7411 test_ret++;
7412 printf(" %d", n_ctxt);
7413 printf(" %d", n_arg);
7414 printf(" %d", n_node);
7415 printf(" %d", n_node2);
7416 printf("\n");
7417 }
7418 }
7419 }
7420 }
7421 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007422 function_tests++;
7423#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007424
Daniel Veillarda82b1822004-11-08 16:24:57 +00007425 return(test_ret);
7426}
7427
7428
7429static int
7430test_xmlShellDir(void) {
7431 int test_ret = 0;
7432
William M. Brack21e4ef22005-01-02 09:53:13 +00007433#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007434 int mem_base;
7435 int ret_val;
7436 xmlShellCtxtPtr ctxt; /* the shell context */
7437 int n_ctxt;
7438 char * arg; /* unused */
7439 int n_arg;
7440 xmlNodePtr node; /* a node */
7441 int n_node;
7442 xmlNodePtr node2; /* unused */
7443 int n_node2;
7444
7445 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7446 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7447 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7448 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7449 mem_base = xmlMemBlocks();
7450 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7451 arg = gen_char_ptr(n_arg, 1);
7452 node = gen_xmlNodePtr(n_node, 2);
7453 node2 = gen_xmlNodePtr(n_node2, 3);
7454
7455 ret_val = xmlShellDir(ctxt, arg, node, node2);
7456 desret_int(ret_val);
7457 call_tests++;
7458 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7459 des_char_ptr(n_arg, arg, 1);
7460 des_xmlNodePtr(n_node, node, 2);
7461 des_xmlNodePtr(n_node2, node2, 3);
7462 xmlResetLastError();
7463 if (mem_base != xmlMemBlocks()) {
7464 printf("Leak of %d blocks found in xmlShellDir",
7465 xmlMemBlocks() - mem_base);
7466 test_ret++;
7467 printf(" %d", n_ctxt);
7468 printf(" %d", n_arg);
7469 printf(" %d", n_node);
7470 printf(" %d", n_node2);
7471 printf("\n");
7472 }
7473 }
7474 }
7475 }
7476 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007477 function_tests++;
7478#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007479
Daniel Veillarda82b1822004-11-08 16:24:57 +00007480 return(test_ret);
7481}
7482
7483
7484static int
7485test_xmlShellDu(void) {
7486 int test_ret = 0;
7487
William M. Brack21e4ef22005-01-02 09:53:13 +00007488#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007489 int mem_base;
7490 int ret_val;
7491 xmlShellCtxtPtr ctxt; /* the shell context */
7492 int n_ctxt;
7493 char * arg; /* unused */
7494 int n_arg;
7495 xmlNodePtr tree; /* a node defining a subtree */
7496 int n_tree;
7497 xmlNodePtr node2; /* unused */
7498 int n_node2;
7499
7500 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7501 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7502 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
7503 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7504 mem_base = xmlMemBlocks();
7505 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7506 arg = gen_char_ptr(n_arg, 1);
7507 tree = gen_xmlNodePtr(n_tree, 2);
7508 node2 = gen_xmlNodePtr(n_node2, 3);
7509
7510 ret_val = xmlShellDu(ctxt, arg, tree, node2);
7511 desret_int(ret_val);
7512 call_tests++;
7513 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7514 des_char_ptr(n_arg, arg, 1);
7515 des_xmlNodePtr(n_tree, tree, 2);
7516 des_xmlNodePtr(n_node2, node2, 3);
7517 xmlResetLastError();
7518 if (mem_base != xmlMemBlocks()) {
7519 printf("Leak of %d blocks found in xmlShellDu",
7520 xmlMemBlocks() - mem_base);
7521 test_ret++;
7522 printf(" %d", n_ctxt);
7523 printf(" %d", n_arg);
7524 printf(" %d", n_tree);
7525 printf(" %d", n_node2);
7526 printf("\n");
7527 }
7528 }
7529 }
7530 }
7531 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007532 function_tests++;
7533#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007534
Daniel Veillarda82b1822004-11-08 16:24:57 +00007535 return(test_ret);
7536}
7537
7538
7539static int
7540test_xmlShellList(void) {
7541 int test_ret = 0;
7542
William M. Brack21e4ef22005-01-02 09:53:13 +00007543#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007544 int mem_base;
7545 int ret_val;
7546 xmlShellCtxtPtr ctxt; /* the shell context */
7547 int n_ctxt;
7548 char * arg; /* unused */
7549 int n_arg;
7550 xmlNodePtr node; /* a node */
7551 int n_node;
7552 xmlNodePtr node2; /* unused */
7553 int n_node2;
7554
7555 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7556 for (n_arg = 0;n_arg < gen_nb_char_ptr;n_arg++) {
7557 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7558 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7559 mem_base = xmlMemBlocks();
7560 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7561 arg = gen_char_ptr(n_arg, 1);
7562 node = gen_xmlNodePtr(n_node, 2);
7563 node2 = gen_xmlNodePtr(n_node2, 3);
7564
7565 ret_val = xmlShellList(ctxt, arg, node, node2);
7566 desret_int(ret_val);
7567 call_tests++;
7568 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7569 des_char_ptr(n_arg, arg, 1);
7570 des_xmlNodePtr(n_node, node, 2);
7571 des_xmlNodePtr(n_node2, node2, 3);
7572 xmlResetLastError();
7573 if (mem_base != xmlMemBlocks()) {
7574 printf("Leak of %d blocks found in xmlShellList",
7575 xmlMemBlocks() - mem_base);
7576 test_ret++;
7577 printf(" %d", n_ctxt);
7578 printf(" %d", n_arg);
7579 printf(" %d", n_node);
7580 printf(" %d", n_node2);
7581 printf("\n");
7582 }
7583 }
7584 }
7585 }
7586 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007587 function_tests++;
7588#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007589
Daniel Veillarda82b1822004-11-08 16:24:57 +00007590 return(test_ret);
7591}
7592
7593
7594static int
7595test_xmlShellLoad(void) {
7596 int test_ret = 0;
7597
William M. Brack21e4ef22005-01-02 09:53:13 +00007598#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007599 int mem_base;
7600 int ret_val;
7601 xmlShellCtxtPtr ctxt; /* the shell context */
7602 int n_ctxt;
7603 char * filename; /* the file name */
7604 int n_filename;
7605 xmlNodePtr node; /* unused */
7606 int n_node;
7607 xmlNodePtr node2; /* unused */
7608 int n_node2;
7609
7610 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7611 for (n_filename = 0;n_filename < gen_nb_char_ptr;n_filename++) {
7612 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7613 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7614 mem_base = xmlMemBlocks();
7615 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7616 filename = gen_char_ptr(n_filename, 1);
7617 node = gen_xmlNodePtr(n_node, 2);
7618 node2 = gen_xmlNodePtr(n_node2, 3);
7619
7620 ret_val = xmlShellLoad(ctxt, filename, node, node2);
7621 desret_int(ret_val);
7622 call_tests++;
7623 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7624 des_char_ptr(n_filename, filename, 1);
7625 des_xmlNodePtr(n_node, node, 2);
7626 des_xmlNodePtr(n_node2, node2, 3);
7627 xmlResetLastError();
7628 if (mem_base != xmlMemBlocks()) {
7629 printf("Leak of %d blocks found in xmlShellLoad",
7630 xmlMemBlocks() - mem_base);
7631 test_ret++;
7632 printf(" %d", n_ctxt);
7633 printf(" %d", n_filename);
7634 printf(" %d", n_node);
7635 printf(" %d", n_node2);
7636 printf("\n");
7637 }
7638 }
7639 }
7640 }
7641 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007642 function_tests++;
7643#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007644
Daniel Veillarda82b1822004-11-08 16:24:57 +00007645 return(test_ret);
7646}
7647
7648
7649static int
7650test_xmlShellPrintXPathResult(void) {
7651 int test_ret = 0;
7652
William M. Brack21e4ef22005-01-02 09:53:13 +00007653#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007654 int mem_base;
7655 xmlXPathObjectPtr list; /* a valid result generated by an xpath evaluation */
7656 int n_list;
7657
7658 for (n_list = 0;n_list < gen_nb_xmlXPathObjectPtr;n_list++) {
7659 mem_base = xmlMemBlocks();
7660 list = gen_xmlXPathObjectPtr(n_list, 0);
7661
7662 xmlShellPrintXPathResult(list);
7663 call_tests++;
7664 des_xmlXPathObjectPtr(n_list, list, 0);
7665 xmlResetLastError();
7666 if (mem_base != xmlMemBlocks()) {
7667 printf("Leak of %d blocks found in xmlShellPrintXPathResult",
7668 xmlMemBlocks() - mem_base);
7669 test_ret++;
7670 printf(" %d", n_list);
7671 printf("\n");
7672 }
7673 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007674 function_tests++;
7675#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007676
Daniel Veillarda82b1822004-11-08 16:24:57 +00007677 return(test_ret);
7678}
7679
7680
7681static int
7682test_xmlShellPwd(void) {
7683 int test_ret = 0;
7684
William M. Brack21e4ef22005-01-02 09:53:13 +00007685#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007686 int mem_base;
7687 int ret_val;
7688 xmlShellCtxtPtr ctxt; /* the shell context */
7689 int n_ctxt;
7690 char * buffer; /* the output buffer */
7691 int n_buffer;
7692 xmlNodePtr node; /* a node */
7693 int n_node;
7694 xmlNodePtr node2; /* unused */
7695 int n_node2;
7696
7697 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7698 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
7699 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7700 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7701 mem_base = xmlMemBlocks();
7702 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7703 buffer = gen_char_ptr(n_buffer, 1);
7704 node = gen_xmlNodePtr(n_node, 2);
7705 node2 = gen_xmlNodePtr(n_node2, 3);
7706
7707 ret_val = xmlShellPwd(ctxt, buffer, node, node2);
7708 desret_int(ret_val);
7709 call_tests++;
7710 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7711 des_char_ptr(n_buffer, buffer, 1);
7712 des_xmlNodePtr(n_node, node, 2);
7713 des_xmlNodePtr(n_node2, node2, 3);
7714 xmlResetLastError();
7715 if (mem_base != xmlMemBlocks()) {
7716 printf("Leak of %d blocks found in xmlShellPwd",
7717 xmlMemBlocks() - mem_base);
7718 test_ret++;
7719 printf(" %d", n_ctxt);
7720 printf(" %d", n_buffer);
7721 printf(" %d", n_node);
7722 printf(" %d", n_node2);
7723 printf("\n");
7724 }
7725 }
7726 }
7727 }
7728 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007729 function_tests++;
7730#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007731
Daniel Veillarda82b1822004-11-08 16:24:57 +00007732 return(test_ret);
7733}
7734
7735
7736static int
7737test_xmlShellSave(void) {
7738 int test_ret = 0;
7739
William M. Brack21e4ef22005-01-02 09:53:13 +00007740#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007741 int mem_base;
7742 int ret_val;
7743 xmlShellCtxtPtr ctxt; /* the shell context */
7744 int n_ctxt;
7745 char * filename; /* the file name (optional) */
7746 int n_filename;
7747 xmlNodePtr node; /* unused */
7748 int n_node;
7749 xmlNodePtr node2; /* unused */
7750 int n_node2;
7751
7752 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7753 for (n_filename = 0;n_filename < gen_nb_char_ptr;n_filename++) {
7754 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7755 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7756 mem_base = xmlMemBlocks();
7757 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7758 filename = gen_char_ptr(n_filename, 1);
7759 node = gen_xmlNodePtr(n_node, 2);
7760 node2 = gen_xmlNodePtr(n_node2, 3);
7761
7762 ret_val = xmlShellSave(ctxt, filename, node, node2);
7763 desret_int(ret_val);
7764 call_tests++;
7765 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7766 des_char_ptr(n_filename, filename, 1);
7767 des_xmlNodePtr(n_node, node, 2);
7768 des_xmlNodePtr(n_node2, node2, 3);
7769 xmlResetLastError();
7770 if (mem_base != xmlMemBlocks()) {
7771 printf("Leak of %d blocks found in xmlShellSave",
7772 xmlMemBlocks() - mem_base);
7773 test_ret++;
7774 printf(" %d", n_ctxt);
7775 printf(" %d", n_filename);
7776 printf(" %d", n_node);
7777 printf(" %d", n_node2);
7778 printf("\n");
7779 }
7780 }
7781 }
7782 }
7783 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007784 function_tests++;
7785#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007786
Daniel Veillarda82b1822004-11-08 16:24:57 +00007787 return(test_ret);
7788}
7789
7790
7791static int
7792test_xmlShellValidate(void) {
7793 int test_ret = 0;
7794
William M. Brack21e4ef22005-01-02 09:53:13 +00007795#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_VALID_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007796 int mem_base;
7797 int ret_val;
7798 xmlShellCtxtPtr ctxt; /* the shell context */
7799 int n_ctxt;
7800 char * dtd; /* the DTD URI (optional) */
7801 int n_dtd;
7802 xmlNodePtr node; /* unused */
7803 int n_node;
7804 xmlNodePtr node2; /* unused */
7805 int n_node2;
7806
7807 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7808 for (n_dtd = 0;n_dtd < gen_nb_char_ptr;n_dtd++) {
7809 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7810 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7811 mem_base = xmlMemBlocks();
7812 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7813 dtd = gen_char_ptr(n_dtd, 1);
7814 node = gen_xmlNodePtr(n_node, 2);
7815 node2 = gen_xmlNodePtr(n_node2, 3);
7816
7817 ret_val = xmlShellValidate(ctxt, dtd, node, node2);
7818 desret_int(ret_val);
7819 call_tests++;
7820 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7821 des_char_ptr(n_dtd, dtd, 1);
7822 des_xmlNodePtr(n_node, node, 2);
7823 des_xmlNodePtr(n_node2, node2, 3);
7824 xmlResetLastError();
7825 if (mem_base != xmlMemBlocks()) {
7826 printf("Leak of %d blocks found in xmlShellValidate",
7827 xmlMemBlocks() - mem_base);
7828 test_ret++;
7829 printf(" %d", n_ctxt);
7830 printf(" %d", n_dtd);
7831 printf(" %d", n_node);
7832 printf(" %d", n_node2);
7833 printf("\n");
7834 }
7835 }
7836 }
7837 }
7838 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007839 function_tests++;
7840#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007841
Daniel Veillarda82b1822004-11-08 16:24:57 +00007842 return(test_ret);
7843}
7844
7845
7846static int
7847test_xmlShellWrite(void) {
7848 int test_ret = 0;
7849
William M. Brack21e4ef22005-01-02 09:53:13 +00007850#if defined(LIBXML_DEBUG_ENABLED) && defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +00007851 int mem_base;
7852 int ret_val;
7853 xmlShellCtxtPtr ctxt; /* the shell context */
7854 int n_ctxt;
7855 char * filename; /* the file name */
7856 int n_filename;
7857 xmlNodePtr node; /* a node in the tree */
7858 int n_node;
7859 xmlNodePtr node2; /* unused */
7860 int n_node2;
7861
7862 for (n_ctxt = 0;n_ctxt < gen_nb_xmlShellCtxtPtr;n_ctxt++) {
7863 for (n_filename = 0;n_filename < gen_nb_char_ptr;n_filename++) {
7864 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
7865 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
7866 mem_base = xmlMemBlocks();
7867 ctxt = gen_xmlShellCtxtPtr(n_ctxt, 0);
7868 filename = gen_char_ptr(n_filename, 1);
7869 node = gen_xmlNodePtr(n_node, 2);
7870 node2 = gen_xmlNodePtr(n_node2, 3);
7871
7872 ret_val = xmlShellWrite(ctxt, filename, node, node2);
7873 desret_int(ret_val);
7874 call_tests++;
7875 des_xmlShellCtxtPtr(n_ctxt, ctxt, 0);
7876 des_char_ptr(n_filename, filename, 1);
7877 des_xmlNodePtr(n_node, node, 2);
7878 des_xmlNodePtr(n_node2, node2, 3);
7879 xmlResetLastError();
7880 if (mem_base != xmlMemBlocks()) {
7881 printf("Leak of %d blocks found in xmlShellWrite",
7882 xmlMemBlocks() - mem_base);
7883 test_ret++;
7884 printf(" %d", n_ctxt);
7885 printf(" %d", n_filename);
7886 printf(" %d", n_node);
7887 printf(" %d", n_node2);
7888 printf("\n");
7889 }
7890 }
7891 }
7892 }
7893 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007894 function_tests++;
7895#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +00007896
Daniel Veillarda82b1822004-11-08 16:24:57 +00007897 return(test_ret);
7898}
7899
7900static int
7901test_debugXML(void) {
7902 int test_ret = 0;
7903
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007904 if (quiet == 0) printf("Testing debugXML : 25 of 28 functions ...\n");
Daniel Veillarda82b1822004-11-08 16:24:57 +00007905 test_ret += test_xmlBoolToText();
7906 test_ret += test_xmlDebugCheckDocument();
7907 test_ret += test_xmlDebugDumpAttr();
7908 test_ret += test_xmlDebugDumpAttrList();
7909 test_ret += test_xmlDebugDumpDTD();
7910 test_ret += test_xmlDebugDumpDocument();
7911 test_ret += test_xmlDebugDumpDocumentHead();
7912 test_ret += test_xmlDebugDumpEntities();
7913 test_ret += test_xmlDebugDumpNode();
7914 test_ret += test_xmlDebugDumpNodeList();
7915 test_ret += test_xmlDebugDumpOneNode();
7916 test_ret += test_xmlDebugDumpString();
7917 test_ret += test_xmlLsCountNode();
7918 test_ret += test_xmlLsOneNode();
7919 test_ret += test_xmlShell();
7920 test_ret += test_xmlShellBase();
7921 test_ret += test_xmlShellCat();
7922 test_ret += test_xmlShellDir();
7923 test_ret += test_xmlShellDu();
7924 test_ret += test_xmlShellList();
7925 test_ret += test_xmlShellLoad();
7926 test_ret += test_xmlShellPrintXPathResult();
7927 test_ret += test_xmlShellPwd();
7928 test_ret += test_xmlShellSave();
7929 test_ret += test_xmlShellValidate();
7930 test_ret += test_xmlShellWrite();
7931
7932 if (test_ret != 0)
7933 printf("Module debugXML: %d errors\n", test_ret);
7934 return(test_ret);
7935}
7936
7937static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00007938test_xmlDictCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00007939 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007940
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00007941 int mem_base;
7942 xmlDictPtr ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007943
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00007944 mem_base = xmlMemBlocks();
7945
7946 ret_val = xmlDictCreate();
7947 desret_xmlDictPtr(ret_val);
7948 call_tests++;
7949 xmlResetLastError();
7950 if (mem_base != xmlMemBlocks()) {
7951 printf("Leak of %d blocks found in xmlDictCreate",
7952 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00007953 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00007954 printf("\n");
7955 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00007956 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007957
Daniel Veillard42595322004-11-08 10:52:06 +00007958 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00007959}
7960
7961
7962static int
7963test_xmlDictCreateSub(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00007964 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007965
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00007966 int mem_base;
7967 xmlDictPtr ret_val;
7968 xmlDictPtr sub; /* an existing dictionnary */
7969 int n_sub;
Daniel Veillardd93f6252004-11-02 15:53:51 +00007970
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00007971 for (n_sub = 0;n_sub < gen_nb_xmlDictPtr;n_sub++) {
7972 mem_base = xmlMemBlocks();
7973 sub = gen_xmlDictPtr(n_sub, 0);
7974
7975 ret_val = xmlDictCreateSub(sub);
7976 desret_xmlDictPtr(ret_val);
7977 call_tests++;
7978 des_xmlDictPtr(n_sub, sub, 0);
7979 xmlResetLastError();
7980 if (mem_base != xmlMemBlocks()) {
7981 printf("Leak of %d blocks found in xmlDictCreateSub",
7982 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00007983 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00007984 printf(" %d", n_sub);
7985 printf("\n");
7986 }
7987 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00007988 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00007989
Daniel Veillard42595322004-11-08 10:52:06 +00007990 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00007991}
7992
7993
7994static int
Daniel Veillard91b955c2004-12-10 10:26:42 +00007995test_xmlDictExists(void) {
7996 int test_ret = 0;
7997
7998 int mem_base;
7999 const xmlChar * ret_val;
8000 xmlDictPtr dict; /* the dictionnary */
8001 int n_dict;
8002 xmlChar * name; /* the name of the userdata */
8003 int n_name;
8004 int len; /* the length of the name, if -1 it is recomputed */
8005 int n_len;
8006
8007 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8008 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
8009 for (n_len = 0;n_len < gen_nb_int;n_len++) {
8010 mem_base = xmlMemBlocks();
8011 dict = gen_xmlDictPtr(n_dict, 0);
8012 name = gen_const_xmlChar_ptr(n_name, 1);
8013 len = gen_int(n_len, 2);
8014
8015 ret_val = xmlDictExists(dict, (const xmlChar *)name, len);
8016 desret_const_xmlChar_ptr(ret_val);
8017 call_tests++;
8018 des_xmlDictPtr(n_dict, dict, 0);
8019 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
8020 des_int(n_len, len, 2);
8021 xmlResetLastError();
8022 if (mem_base != xmlMemBlocks()) {
8023 printf("Leak of %d blocks found in xmlDictExists",
8024 xmlMemBlocks() - mem_base);
8025 test_ret++;
8026 printf(" %d", n_dict);
8027 printf(" %d", n_name);
8028 printf(" %d", n_len);
8029 printf("\n");
8030 }
8031 }
8032 }
8033 }
8034 function_tests++;
8035
8036 return(test_ret);
8037}
8038
8039
8040static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00008041test_xmlDictLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008042 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008043
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008044 int mem_base;
8045 const xmlChar * ret_val;
8046 xmlDictPtr dict; /* the dictionnary */
8047 int n_dict;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008048 xmlChar * name; /* the name of the userdata */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008049 int n_name;
8050 int len; /* the length of the name, if -1 it is recomputed */
8051 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008052
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008053 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8054 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
8055 for (n_len = 0;n_len < gen_nb_int;n_len++) {
8056 mem_base = xmlMemBlocks();
8057 dict = gen_xmlDictPtr(n_dict, 0);
8058 name = gen_const_xmlChar_ptr(n_name, 1);
8059 len = gen_int(n_len, 2);
8060
William M. Brackf13f77f2004-11-12 16:03:48 +00008061 ret_val = xmlDictLookup(dict, (const xmlChar *)name, len);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008062 desret_const_xmlChar_ptr(ret_val);
8063 call_tests++;
8064 des_xmlDictPtr(n_dict, dict, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00008065 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008066 des_int(n_len, len, 2);
8067 xmlResetLastError();
8068 if (mem_base != xmlMemBlocks()) {
8069 printf("Leak of %d blocks found in xmlDictLookup",
8070 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008071 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008072 printf(" %d", n_dict);
8073 printf(" %d", n_name);
8074 printf(" %d", n_len);
8075 printf("\n");
8076 }
8077 }
8078 }
8079 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008080 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008081
Daniel Veillard42595322004-11-08 10:52:06 +00008082 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008083}
8084
8085
8086static int
8087test_xmlDictOwns(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008088 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008089
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008090 int mem_base;
8091 int ret_val;
8092 xmlDictPtr dict; /* the dictionnary */
8093 int n_dict;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008094 xmlChar * str; /* the string */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008095 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008096
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008097 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8098 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
8099 mem_base = xmlMemBlocks();
8100 dict = gen_xmlDictPtr(n_dict, 0);
8101 str = gen_const_xmlChar_ptr(n_str, 1);
8102
William M. Brackf13f77f2004-11-12 16:03:48 +00008103 ret_val = xmlDictOwns(dict, (const xmlChar *)str);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008104 desret_int(ret_val);
8105 call_tests++;
8106 des_xmlDictPtr(n_dict, dict, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00008107 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008108 xmlResetLastError();
8109 if (mem_base != xmlMemBlocks()) {
8110 printf("Leak of %d blocks found in xmlDictOwns",
8111 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008112 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008113 printf(" %d", n_dict);
8114 printf(" %d", n_str);
8115 printf("\n");
8116 }
8117 }
8118 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008119 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008120
Daniel Veillard42595322004-11-08 10:52:06 +00008121 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008122}
8123
8124
8125static int
8126test_xmlDictQLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008127 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008128
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008129 int mem_base;
8130 const xmlChar * ret_val;
8131 xmlDictPtr dict; /* the dictionnary */
8132 int n_dict;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008133 xmlChar * prefix; /* the prefix */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008134 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008135 xmlChar * name; /* the name */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008136 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008137
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008138 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8139 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
8140 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
8141 mem_base = xmlMemBlocks();
8142 dict = gen_xmlDictPtr(n_dict, 0);
8143 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
8144 name = gen_const_xmlChar_ptr(n_name, 2);
8145
William M. Brackf13f77f2004-11-12 16:03:48 +00008146 ret_val = xmlDictQLookup(dict, (const xmlChar *)prefix, (const xmlChar *)name);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008147 desret_const_xmlChar_ptr(ret_val);
8148 call_tests++;
8149 des_xmlDictPtr(n_dict, dict, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00008150 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
8151 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008152 xmlResetLastError();
8153 if (mem_base != xmlMemBlocks()) {
8154 printf("Leak of %d blocks found in xmlDictQLookup",
8155 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008156 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008157 printf(" %d", n_dict);
8158 printf(" %d", n_prefix);
8159 printf(" %d", n_name);
8160 printf("\n");
8161 }
8162 }
8163 }
8164 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008165 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008166
Daniel Veillard42595322004-11-08 10:52:06 +00008167 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008168}
8169
8170
8171static int
8172test_xmlDictReference(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008173 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008174
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008175 int mem_base;
8176 int ret_val;
8177 xmlDictPtr dict; /* the dictionnary */
8178 int n_dict;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008179
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008180 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8181 mem_base = xmlMemBlocks();
8182 dict = gen_xmlDictPtr(n_dict, 0);
8183
8184 ret_val = xmlDictReference(dict);
8185 xmlDictFree(dict);
8186 desret_int(ret_val);
8187 call_tests++;
8188 des_xmlDictPtr(n_dict, dict, 0);
8189 xmlResetLastError();
8190 if (mem_base != xmlMemBlocks()) {
8191 printf("Leak of %d blocks found in xmlDictReference",
8192 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008193 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008194 printf(" %d", n_dict);
8195 printf("\n");
8196 }
8197 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008198 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008199
Daniel Veillard42595322004-11-08 10:52:06 +00008200 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008201}
8202
8203
8204static int
8205test_xmlDictSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008206 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008207
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008208 int mem_base;
8209 int ret_val;
8210 xmlDictPtr dict; /* the dictionnary */
8211 int n_dict;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008212
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008213 for (n_dict = 0;n_dict < gen_nb_xmlDictPtr;n_dict++) {
8214 mem_base = xmlMemBlocks();
8215 dict = gen_xmlDictPtr(n_dict, 0);
8216
8217 ret_val = xmlDictSize(dict);
8218 desret_int(ret_val);
8219 call_tests++;
8220 des_xmlDictPtr(n_dict, dict, 0);
8221 xmlResetLastError();
8222 if (mem_base != xmlMemBlocks()) {
8223 printf("Leak of %d blocks found in xmlDictSize",
8224 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008225 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008226 printf(" %d", n_dict);
8227 printf("\n");
8228 }
8229 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +00008230 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008231
Daniel Veillard42595322004-11-08 10:52:06 +00008232 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008233}
8234
8235static int
8236test_dict(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008237 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008238
Daniel Veillard91b955c2004-12-10 10:26:42 +00008239 if (quiet == 0) printf("Testing dict : 8 of 9 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00008240 test_ret += test_xmlDictCreate();
8241 test_ret += test_xmlDictCreateSub();
Daniel Veillard91b955c2004-12-10 10:26:42 +00008242 test_ret += test_xmlDictExists();
Daniel Veillard42595322004-11-08 10:52:06 +00008243 test_ret += test_xmlDictLookup();
8244 test_ret += test_xmlDictOwns();
8245 test_ret += test_xmlDictQLookup();
8246 test_ret += test_xmlDictReference();
8247 test_ret += test_xmlDictSize();
Daniel Veillardd93f6252004-11-02 15:53:51 +00008248
Daniel Veillard42595322004-11-08 10:52:06 +00008249 if (test_ret != 0)
8250 printf("Module dict: %d errors\n", test_ret);
8251 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008252}
8253
8254static int
8255test_UTF8Toisolat1(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008256 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008257
William M. Brack21e4ef22005-01-02 09:53:13 +00008258#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00008259#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +00008260 int mem_base;
8261 int ret_val;
8262 unsigned char * out; /* a pointer to an array of bytes to store the result */
8263 int n_out;
8264 int * outlen; /* the length of @out */
8265 int n_outlen;
8266 unsigned char * in; /* a pointer to an array of UTF-8 chars */
8267 int n_in;
8268 int * inlen; /* the length of @in */
8269 int n_inlen;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008270
Daniel Veillardce682bc2004-11-05 17:22:25 +00008271 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
8272 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
8273 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
8274 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
8275 mem_base = xmlMemBlocks();
8276 out = gen_unsigned_char_ptr(n_out, 0);
8277 outlen = gen_int_ptr(n_outlen, 1);
8278 in = gen_const_unsigned_char_ptr(n_in, 2);
8279 inlen = gen_int_ptr(n_inlen, 3);
8280
William M. Brackf13f77f2004-11-12 16:03:48 +00008281 ret_val = UTF8Toisolat1(out, outlen, (const unsigned char *)in, inlen);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008282 desret_int(ret_val);
8283 call_tests++;
8284 des_unsigned_char_ptr(n_out, out, 0);
8285 des_int_ptr(n_outlen, outlen, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00008286 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008287 des_int_ptr(n_inlen, inlen, 3);
8288 xmlResetLastError();
8289 if (mem_base != xmlMemBlocks()) {
8290 printf("Leak of %d blocks found in UTF8Toisolat1",
8291 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008292 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008293 printf(" %d", n_out);
8294 printf(" %d", n_outlen);
8295 printf(" %d", n_in);
8296 printf(" %d", n_inlen);
8297 printf("\n");
8298 }
8299 }
8300 }
8301 }
8302 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008303 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00008304#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00008305#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +00008306
Daniel Veillard42595322004-11-08 10:52:06 +00008307 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008308}
8309
8310
8311static int
8312test_isolat1ToUTF8(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008313 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008314
Daniel Veillardce682bc2004-11-05 17:22:25 +00008315 int mem_base;
8316 int ret_val;
8317 unsigned char * out; /* a pointer to an array of bytes to store the result */
8318 int n_out;
8319 int * outlen; /* the length of @out */
8320 int n_outlen;
8321 unsigned char * in; /* a pointer to an array of ISO Latin 1 chars */
8322 int n_in;
8323 int * inlen; /* the length of @in */
8324 int n_inlen;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008325
Daniel Veillardce682bc2004-11-05 17:22:25 +00008326 for (n_out = 0;n_out < gen_nb_unsigned_char_ptr;n_out++) {
8327 for (n_outlen = 0;n_outlen < gen_nb_int_ptr;n_outlen++) {
8328 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
8329 for (n_inlen = 0;n_inlen < gen_nb_int_ptr;n_inlen++) {
8330 mem_base = xmlMemBlocks();
8331 out = gen_unsigned_char_ptr(n_out, 0);
8332 outlen = gen_int_ptr(n_outlen, 1);
8333 in = gen_const_unsigned_char_ptr(n_in, 2);
8334 inlen = gen_int_ptr(n_inlen, 3);
8335
William M. Brackf13f77f2004-11-12 16:03:48 +00008336 ret_val = isolat1ToUTF8(out, outlen, (const unsigned char *)in, inlen);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008337 desret_int(ret_val);
8338 call_tests++;
8339 des_unsigned_char_ptr(n_out, out, 0);
8340 des_int_ptr(n_outlen, outlen, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +00008341 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008342 des_int_ptr(n_inlen, inlen, 3);
8343 xmlResetLastError();
8344 if (mem_base != xmlMemBlocks()) {
8345 printf("Leak of %d blocks found in isolat1ToUTF8",
8346 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008347 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008348 printf(" %d", n_out);
8349 printf(" %d", n_outlen);
8350 printf(" %d", n_in);
8351 printf(" %d", n_inlen);
8352 printf("\n");
8353 }
8354 }
8355 }
8356 }
8357 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008358 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008359
Daniel Veillard42595322004-11-08 10:52:06 +00008360 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008361}
8362
8363
8364static int
8365test_xmlAddEncodingAlias(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008366 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008367
8368 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008369 char * name; /* the encoding name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00008370 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008371 char * alias; /* the alias name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00008372 int n_alias;
8373
8374 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
8375 for (n_alias = 0;n_alias < gen_nb_const_char_ptr;n_alias++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +00008376 name = gen_const_char_ptr(n_name, 0);
8377 alias = gen_const_char_ptr(n_alias, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008378
William M. Brackf13f77f2004-11-12 16:03:48 +00008379 ret_val = xmlAddEncodingAlias((const char *)name, (const char *)alias);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008380 desret_int(ret_val);
8381 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00008382 des_const_char_ptr(n_name, (const char *)name, 0);
8383 des_const_char_ptr(n_alias, (const char *)alias, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008384 xmlResetLastError();
8385 }
8386 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008387 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008388
Daniel Veillard42595322004-11-08 10:52:06 +00008389 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008390}
8391
8392
Daniel Veillardce682bc2004-11-05 17:22:25 +00008393#define gen_nb_xmlCharEncodingHandler_ptr 1
8394static xmlCharEncodingHandler * gen_xmlCharEncodingHandler_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
8395 return(NULL);
8396}
8397static void des_xmlCharEncodingHandler_ptr(int no ATTRIBUTE_UNUSED, xmlCharEncodingHandler * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
8398}
8399
Daniel Veillardd93f6252004-11-02 15:53:51 +00008400static int
8401test_xmlCharEncCloseFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008402 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008403
Daniel Veillardce682bc2004-11-05 17:22:25 +00008404 int mem_base;
8405 int ret_val;
8406 xmlCharEncodingHandler * handler; /* char enconding transformation data structure */
8407 int n_handler;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008408
Daniel Veillardce682bc2004-11-05 17:22:25 +00008409 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8410 mem_base = xmlMemBlocks();
8411 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8412
8413 ret_val = xmlCharEncCloseFunc(handler);
8414 desret_int(ret_val);
8415 call_tests++;
8416 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8417 xmlResetLastError();
8418 if (mem_base != xmlMemBlocks()) {
8419 printf("Leak of %d blocks found in xmlCharEncCloseFunc",
8420 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008421 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008422 printf(" %d", n_handler);
8423 printf("\n");
8424 }
8425 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008426 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008427
Daniel Veillard42595322004-11-08 10:52:06 +00008428 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008429}
8430
8431
8432static int
8433test_xmlCharEncFirstLine(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008434 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008435
Daniel Veillardce682bc2004-11-05 17:22:25 +00008436 int mem_base;
8437 int ret_val;
8438 xmlCharEncodingHandler * handler; /* char enconding transformation data structure */
8439 int n_handler;
8440 xmlBufferPtr out; /* an xmlBuffer for the output. */
8441 int n_out;
8442 xmlBufferPtr in; /* an xmlBuffer for the input */
8443 int n_in;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008444
Daniel Veillardce682bc2004-11-05 17:22:25 +00008445 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8446 for (n_out = 0;n_out < gen_nb_xmlBufferPtr;n_out++) {
8447 for (n_in = 0;n_in < gen_nb_xmlBufferPtr;n_in++) {
8448 mem_base = xmlMemBlocks();
8449 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8450 out = gen_xmlBufferPtr(n_out, 1);
8451 in = gen_xmlBufferPtr(n_in, 2);
8452
8453 ret_val = xmlCharEncFirstLine(handler, out, in);
8454 desret_int(ret_val);
8455 call_tests++;
8456 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8457 des_xmlBufferPtr(n_out, out, 1);
8458 des_xmlBufferPtr(n_in, in, 2);
8459 xmlResetLastError();
8460 if (mem_base != xmlMemBlocks()) {
8461 printf("Leak of %d blocks found in xmlCharEncFirstLine",
8462 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008463 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008464 printf(" %d", n_handler);
8465 printf(" %d", n_out);
8466 printf(" %d", n_in);
8467 printf("\n");
8468 }
8469 }
8470 }
8471 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008472 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008473
Daniel Veillard42595322004-11-08 10:52:06 +00008474 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008475}
8476
8477
8478static int
8479test_xmlCharEncInFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008480 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008481
Daniel Veillardce682bc2004-11-05 17:22:25 +00008482 int mem_base;
8483 int ret_val;
8484 xmlCharEncodingHandler * handler; /* char encoding transformation data structure */
8485 int n_handler;
8486 xmlBufferPtr out; /* an xmlBuffer for the output. */
8487 int n_out;
8488 xmlBufferPtr in; /* an xmlBuffer for the input */
8489 int n_in;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008490
Daniel Veillardce682bc2004-11-05 17:22:25 +00008491 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8492 for (n_out = 0;n_out < gen_nb_xmlBufferPtr;n_out++) {
8493 for (n_in = 0;n_in < gen_nb_xmlBufferPtr;n_in++) {
8494 mem_base = xmlMemBlocks();
8495 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8496 out = gen_xmlBufferPtr(n_out, 1);
8497 in = gen_xmlBufferPtr(n_in, 2);
8498
8499 ret_val = xmlCharEncInFunc(handler, out, in);
8500 desret_int(ret_val);
8501 call_tests++;
8502 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8503 des_xmlBufferPtr(n_out, out, 1);
8504 des_xmlBufferPtr(n_in, in, 2);
8505 xmlResetLastError();
8506 if (mem_base != xmlMemBlocks()) {
8507 printf("Leak of %d blocks found in xmlCharEncInFunc",
8508 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008509 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008510 printf(" %d", n_handler);
8511 printf(" %d", n_out);
8512 printf(" %d", n_in);
8513 printf("\n");
8514 }
8515 }
8516 }
8517 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008518 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008519
Daniel Veillard42595322004-11-08 10:52:06 +00008520 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008521}
8522
8523
8524static int
8525test_xmlCharEncOutFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008526 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008527
Daniel Veillardce682bc2004-11-05 17:22:25 +00008528 int mem_base;
8529 int ret_val;
8530 xmlCharEncodingHandler * handler; /* char enconding transformation data structure */
8531 int n_handler;
8532 xmlBufferPtr out; /* an xmlBuffer for the output. */
8533 int n_out;
8534 xmlBufferPtr in; /* an xmlBuffer for the input */
8535 int n_in;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008536
Daniel Veillardce682bc2004-11-05 17:22:25 +00008537 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandler_ptr;n_handler++) {
8538 for (n_out = 0;n_out < gen_nb_xmlBufferPtr;n_out++) {
8539 for (n_in = 0;n_in < gen_nb_xmlBufferPtr;n_in++) {
8540 mem_base = xmlMemBlocks();
8541 handler = gen_xmlCharEncodingHandler_ptr(n_handler, 0);
8542 out = gen_xmlBufferPtr(n_out, 1);
8543 in = gen_xmlBufferPtr(n_in, 2);
8544
8545 ret_val = xmlCharEncOutFunc(handler, out, in);
8546 desret_int(ret_val);
8547 call_tests++;
8548 des_xmlCharEncodingHandler_ptr(n_handler, handler, 0);
8549 des_xmlBufferPtr(n_out, out, 1);
8550 des_xmlBufferPtr(n_in, in, 2);
8551 xmlResetLastError();
8552 if (mem_base != xmlMemBlocks()) {
8553 printf("Leak of %d blocks found in xmlCharEncOutFunc",
8554 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008555 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008556 printf(" %d", n_handler);
8557 printf(" %d", n_out);
8558 printf(" %d", n_in);
8559 printf("\n");
8560 }
8561 }
8562 }
8563 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008564 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008565
Daniel Veillard42595322004-11-08 10:52:06 +00008566 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008567}
8568
8569
8570static int
8571test_xmlCleanupCharEncodingHandlers(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008572 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008573
8574
8575
8576 xmlCleanupCharEncodingHandlers();
8577 call_tests++;
8578 xmlResetLastError();
Daniel Veillard3d97e662004-11-04 10:49:00 +00008579 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008580
Daniel Veillard42595322004-11-08 10:52:06 +00008581 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008582}
8583
8584
8585static int
8586test_xmlCleanupEncodingAliases(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008587 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008588
8589 int mem_base;
8590
8591 mem_base = xmlMemBlocks();
8592
8593 xmlCleanupEncodingAliases();
8594 call_tests++;
8595 xmlResetLastError();
8596 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00008597 printf("Leak of %d blocks found in xmlCleanupEncodingAliases",
Daniel Veillardd93f6252004-11-02 15:53:51 +00008598 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008599 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00008600 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00008601 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008602 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008603
Daniel Veillard42595322004-11-08 10:52:06 +00008604 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008605}
8606
8607
8608static int
8609test_xmlDelEncodingAlias(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008610 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008611
8612 int mem_base;
8613 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008614 char * alias; /* the alias name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00008615 int n_alias;
8616
8617 for (n_alias = 0;n_alias < gen_nb_const_char_ptr;n_alias++) {
8618 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00008619 alias = gen_const_char_ptr(n_alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008620
William M. Brackf13f77f2004-11-12 16:03:48 +00008621 ret_val = xmlDelEncodingAlias((const char *)alias);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008622 desret_int(ret_val);
8623 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00008624 des_const_char_ptr(n_alias, (const char *)alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008625 xmlResetLastError();
8626 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00008627 printf("Leak of %d blocks found in xmlDelEncodingAlias",
Daniel Veillardd93f6252004-11-02 15:53:51 +00008628 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008629 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00008630 printf(" %d", n_alias);
8631 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00008632 }
8633 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008634 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008635
Daniel Veillard42595322004-11-08 10:52:06 +00008636 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008637}
8638
8639
8640static int
8641test_xmlDetectCharEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008642 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008643
Daniel Veillardce682bc2004-11-05 17:22:25 +00008644 int mem_base;
8645 xmlCharEncoding ret_val;
8646 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). */
8647 int n_in;
8648 int len; /* pointer to the length of the buffer */
8649 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008650
Daniel Veillardce682bc2004-11-05 17:22:25 +00008651 for (n_in = 0;n_in < gen_nb_const_unsigned_char_ptr;n_in++) {
8652 for (n_len = 0;n_len < gen_nb_int;n_len++) {
8653 mem_base = xmlMemBlocks();
8654 in = gen_const_unsigned_char_ptr(n_in, 0);
8655 len = gen_int(n_len, 1);
8656
William M. Brackf13f77f2004-11-12 16:03:48 +00008657 ret_val = xmlDetectCharEncoding((const unsigned char *)in, len);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008658 desret_xmlCharEncoding(ret_val);
8659 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00008660 des_const_unsigned_char_ptr(n_in, (const unsigned char *)in, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +00008661 des_int(n_len, len, 1);
8662 xmlResetLastError();
8663 if (mem_base != xmlMemBlocks()) {
8664 printf("Leak of %d blocks found in xmlDetectCharEncoding",
8665 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008666 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008667 printf(" %d", n_in);
8668 printf(" %d", n_len);
8669 printf("\n");
8670 }
8671 }
8672 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008673 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008674
Daniel Veillard42595322004-11-08 10:52:06 +00008675 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008676}
8677
8678
8679static int
8680test_xmlFindCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008681 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008682
8683
8684 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00008685 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008686}
8687
8688
8689static int
8690test_xmlGetCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008691 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008692
8693
8694 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00008695 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008696}
8697
8698
8699static int
8700test_xmlGetCharEncodingName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008701 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008702
Daniel Veillard3d97e662004-11-04 10:49:00 +00008703 int mem_base;
8704 const char * ret_val;
8705 xmlCharEncoding enc; /* the encoding */
8706 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008707
Daniel Veillard3d97e662004-11-04 10:49:00 +00008708 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
8709 mem_base = xmlMemBlocks();
8710 enc = gen_xmlCharEncoding(n_enc, 0);
8711
8712 ret_val = xmlGetCharEncodingName(enc);
8713 desret_const_char_ptr(ret_val);
8714 call_tests++;
8715 des_xmlCharEncoding(n_enc, enc, 0);
8716 xmlResetLastError();
8717 if (mem_base != xmlMemBlocks()) {
8718 printf("Leak of %d blocks found in xmlGetCharEncodingName",
8719 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008720 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00008721 printf(" %d", n_enc);
8722 printf("\n");
8723 }
8724 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008725 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008726
Daniel Veillard42595322004-11-08 10:52:06 +00008727 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008728}
8729
8730
8731static int
8732test_xmlGetEncodingAlias(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008733 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008734
8735 int mem_base;
8736 const char * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008737 char * alias; /* the alias name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillardd93f6252004-11-02 15:53:51 +00008738 int n_alias;
8739
8740 for (n_alias = 0;n_alias < gen_nb_const_char_ptr;n_alias++) {
8741 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00008742 alias = gen_const_char_ptr(n_alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008743
William M. Brackf13f77f2004-11-12 16:03:48 +00008744 ret_val = xmlGetEncodingAlias((const char *)alias);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008745 desret_const_char_ptr(ret_val);
8746 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00008747 des_const_char_ptr(n_alias, (const char *)alias, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008748 xmlResetLastError();
8749 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00008750 printf("Leak of %d blocks found in xmlGetEncodingAlias",
Daniel Veillardd93f6252004-11-02 15:53:51 +00008751 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008752 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00008753 printf(" %d", n_alias);
8754 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00008755 }
8756 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008757 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008758
Daniel Veillard42595322004-11-08 10:52:06 +00008759 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008760}
8761
8762
8763static int
8764test_xmlInitCharEncodingHandlers(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008765 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008766
8767
8768
8769 xmlInitCharEncodingHandlers();
8770 call_tests++;
8771 xmlResetLastError();
Daniel Veillard3d97e662004-11-04 10:49:00 +00008772 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008773
Daniel Veillard42595322004-11-08 10:52:06 +00008774 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008775}
8776
8777
8778static int
8779test_xmlNewCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008780 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008781
8782
8783 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00008784 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008785}
8786
8787
8788static int
8789test_xmlParseCharEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008790 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008791
Daniel Veillard3d97e662004-11-04 10:49:00 +00008792 int mem_base;
8793 xmlCharEncoding ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008794 char * name; /* the encoding name as parsed, in UTF-8 format (ASCII actually) */
Daniel Veillard3d97e662004-11-04 10:49:00 +00008795 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008796
Daniel Veillard3d97e662004-11-04 10:49:00 +00008797 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
8798 mem_base = xmlMemBlocks();
8799 name = gen_const_char_ptr(n_name, 0);
8800
William M. Brackf13f77f2004-11-12 16:03:48 +00008801 ret_val = xmlParseCharEncoding((const char *)name);
Daniel Veillard3d97e662004-11-04 10:49:00 +00008802 desret_xmlCharEncoding(ret_val);
8803 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00008804 des_const_char_ptr(n_name, (const char *)name, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +00008805 xmlResetLastError();
8806 if (mem_base != xmlMemBlocks()) {
8807 printf("Leak of %d blocks found in xmlParseCharEncoding",
8808 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008809 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00008810 printf(" %d", n_name);
8811 printf("\n");
8812 }
8813 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00008814 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008815
Daniel Veillard42595322004-11-08 10:52:06 +00008816 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008817}
8818
8819
Daniel Veillardce682bc2004-11-05 17:22:25 +00008820#define gen_nb_xmlCharEncodingHandlerPtr 1
8821static xmlCharEncodingHandlerPtr gen_xmlCharEncodingHandlerPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
8822 return(NULL);
8823}
8824static void des_xmlCharEncodingHandlerPtr(int no ATTRIBUTE_UNUSED, xmlCharEncodingHandlerPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
8825}
8826
Daniel Veillardd93f6252004-11-02 15:53:51 +00008827static int
8828test_xmlRegisterCharEncodingHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008829 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008830
Daniel Veillardce682bc2004-11-05 17:22:25 +00008831 int mem_base;
8832 xmlCharEncodingHandlerPtr handler; /* the xmlCharEncodingHandlerPtr handler block */
8833 int n_handler;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008834
Daniel Veillardce682bc2004-11-05 17:22:25 +00008835 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandlerPtr;n_handler++) {
8836 mem_base = xmlMemBlocks();
8837 handler = gen_xmlCharEncodingHandlerPtr(n_handler, 0);
8838
8839 xmlRegisterCharEncodingHandler(handler);
8840 call_tests++;
8841 des_xmlCharEncodingHandlerPtr(n_handler, handler, 0);
8842 xmlResetLastError();
8843 if (mem_base != xmlMemBlocks()) {
8844 printf("Leak of %d blocks found in xmlRegisterCharEncodingHandler",
8845 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008846 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00008847 printf(" %d", n_handler);
8848 printf("\n");
8849 }
8850 }
Daniel Veillardce682bc2004-11-05 17:22:25 +00008851 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008852
Daniel Veillard42595322004-11-08 10:52:06 +00008853 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008854}
8855
8856static int
8857test_encoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008858 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008859
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008860 if (quiet == 0) printf("Testing encoding : 16 of 19 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00008861 test_ret += test_UTF8Toisolat1();
8862 test_ret += test_isolat1ToUTF8();
8863 test_ret += test_xmlAddEncodingAlias();
8864 test_ret += test_xmlCharEncCloseFunc();
8865 test_ret += test_xmlCharEncFirstLine();
8866 test_ret += test_xmlCharEncInFunc();
8867 test_ret += test_xmlCharEncOutFunc();
8868 test_ret += test_xmlCleanupCharEncodingHandlers();
8869 test_ret += test_xmlCleanupEncodingAliases();
8870 test_ret += test_xmlDelEncodingAlias();
8871 test_ret += test_xmlDetectCharEncoding();
8872 test_ret += test_xmlFindCharEncodingHandler();
8873 test_ret += test_xmlGetCharEncodingHandler();
8874 test_ret += test_xmlGetCharEncodingName();
8875 test_ret += test_xmlGetEncodingAlias();
8876 test_ret += test_xmlInitCharEncodingHandlers();
8877 test_ret += test_xmlNewCharEncodingHandler();
8878 test_ret += test_xmlParseCharEncoding();
8879 test_ret += test_xmlRegisterCharEncodingHandler();
Daniel Veillardd93f6252004-11-02 15:53:51 +00008880
Daniel Veillard42595322004-11-08 10:52:06 +00008881 if (test_ret != 0)
8882 printf("Module encoding: %d errors\n", test_ret);
8883 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008884}
8885
8886static int
8887test_xmlAddDocEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008888 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008889
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008890 int mem_base;
8891 xmlEntityPtr ret_val;
8892 xmlDocPtr doc; /* the document */
8893 int n_doc;
8894 xmlChar * name; /* the entity name */
8895 int n_name;
8896 int type; /* the entity type XML_xxx_yyy_ENTITY */
8897 int n_type;
8898 xmlChar * ExternalID; /* the entity external ID if available */
8899 int n_ExternalID;
8900 xmlChar * SystemID; /* the entity system ID if available */
8901 int n_SystemID;
8902 xmlChar * content; /* the entity content */
8903 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008904
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008905 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
8906 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
8907 for (n_type = 0;n_type < gen_nb_int;n_type++) {
8908 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
8909 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
8910 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
8911 mem_base = xmlMemBlocks();
8912 doc = gen_xmlDocPtr(n_doc, 0);
8913 name = gen_const_xmlChar_ptr(n_name, 1);
8914 type = gen_int(n_type, 2);
8915 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 3);
8916 SystemID = gen_const_xmlChar_ptr(n_SystemID, 4);
8917 content = gen_const_xmlChar_ptr(n_content, 5);
8918
William M. Brackf13f77f2004-11-12 16:03:48 +00008919 ret_val = xmlAddDocEntity(doc, (const xmlChar *)name, type, (const xmlChar *)ExternalID, (const xmlChar *)SystemID, (const xmlChar *)content);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008920 desret_xmlEntityPtr(ret_val);
8921 call_tests++;
8922 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00008923 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008924 des_int(n_type, type, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00008925 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 3);
8926 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 4);
8927 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 5);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008928 xmlResetLastError();
8929 if (mem_base != xmlMemBlocks()) {
8930 printf("Leak of %d blocks found in xmlAddDocEntity",
8931 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008932 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008933 printf(" %d", n_doc);
8934 printf(" %d", n_name);
8935 printf(" %d", n_type);
8936 printf(" %d", n_ExternalID);
8937 printf(" %d", n_SystemID);
8938 printf(" %d", n_content);
8939 printf("\n");
8940 }
8941 }
8942 }
8943 }
8944 }
8945 }
8946 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008947 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00008948
Daniel Veillard42595322004-11-08 10:52:06 +00008949 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00008950}
8951
8952
8953static int
8954test_xmlAddDtdEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00008955 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008956
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008957 int mem_base;
8958 xmlEntityPtr ret_val;
8959 xmlDocPtr doc; /* the document */
8960 int n_doc;
8961 xmlChar * name; /* the entity name */
8962 int n_name;
8963 int type; /* the entity type XML_xxx_yyy_ENTITY */
8964 int n_type;
8965 xmlChar * ExternalID; /* the entity external ID if available */
8966 int n_ExternalID;
8967 xmlChar * SystemID; /* the entity system ID if available */
8968 int n_SystemID;
8969 xmlChar * content; /* the entity content */
8970 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +00008971
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008972 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
8973 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
8974 for (n_type = 0;n_type < gen_nb_int;n_type++) {
8975 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
8976 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
8977 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
8978 mem_base = xmlMemBlocks();
8979 doc = gen_xmlDocPtr(n_doc, 0);
8980 name = gen_const_xmlChar_ptr(n_name, 1);
8981 type = gen_int(n_type, 2);
8982 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 3);
8983 SystemID = gen_const_xmlChar_ptr(n_SystemID, 4);
8984 content = gen_const_xmlChar_ptr(n_content, 5);
8985
William M. Brackf13f77f2004-11-12 16:03:48 +00008986 ret_val = xmlAddDtdEntity(doc, (const xmlChar *)name, type, (const xmlChar *)ExternalID, (const xmlChar *)SystemID, (const xmlChar *)content);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008987 desret_xmlEntityPtr(ret_val);
8988 call_tests++;
8989 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00008990 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008991 des_int(n_type, type, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +00008992 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 3);
8993 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 4);
8994 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 5);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00008995 xmlResetLastError();
8996 if (mem_base != xmlMemBlocks()) {
8997 printf("Leak of %d blocks found in xmlAddDtdEntity",
8998 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00008999 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009000 printf(" %d", n_doc);
9001 printf(" %d", n_name);
9002 printf(" %d", n_type);
9003 printf(" %d", n_ExternalID);
9004 printf(" %d", n_SystemID);
9005 printf(" %d", n_content);
9006 printf("\n");
9007 }
9008 }
9009 }
9010 }
9011 }
9012 }
9013 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009014 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009015
Daniel Veillard42595322004-11-08 10:52:06 +00009016 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009017}
9018
9019
9020static int
9021test_xmlCleanupPredefinedEntities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009022 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009023
William M. Brack21e4ef22005-01-02 09:53:13 +00009024#if defined(LIBXML_LEGACY_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00009025#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +00009026 int mem_base;
9027
9028 mem_base = xmlMemBlocks();
9029
9030 xmlCleanupPredefinedEntities();
9031 call_tests++;
9032 xmlResetLastError();
9033 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00009034 printf("Leak of %d blocks found in xmlCleanupPredefinedEntities",
Daniel Veillardd93f6252004-11-02 15:53:51 +00009035 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009036 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00009037 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00009038 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009039 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00009040#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00009041#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00009042
Daniel Veillard42595322004-11-08 10:52:06 +00009043 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009044}
9045
9046
Daniel Veillardce682bc2004-11-05 17:22:25 +00009047#define gen_nb_xmlEntitiesTablePtr 1
9048static xmlEntitiesTablePtr gen_xmlEntitiesTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9049 return(NULL);
9050}
9051static void des_xmlEntitiesTablePtr(int no ATTRIBUTE_UNUSED, xmlEntitiesTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9052}
9053
Daniel Veillardd93f6252004-11-02 15:53:51 +00009054static int
9055test_xmlCopyEntitiesTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009056 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009057
9058
9059 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009060 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009061}
9062
9063
9064static int
9065test_xmlCreateEntitiesTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009066 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009067
9068
9069 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009070 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009071}
9072
9073
9074static int
9075test_xmlDumpEntitiesTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009076 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009077
William M. Brack21e4ef22005-01-02 09:53:13 +00009078#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00009079 int mem_base;
9080 xmlBufferPtr buf; /* An XML buffer. */
9081 int n_buf;
9082 xmlEntitiesTablePtr table; /* An entity table */
9083 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009084
Daniel Veillardce682bc2004-11-05 17:22:25 +00009085 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
9086 for (n_table = 0;n_table < gen_nb_xmlEntitiesTablePtr;n_table++) {
9087 mem_base = xmlMemBlocks();
9088 buf = gen_xmlBufferPtr(n_buf, 0);
9089 table = gen_xmlEntitiesTablePtr(n_table, 1);
9090
9091 xmlDumpEntitiesTable(buf, table);
9092 call_tests++;
9093 des_xmlBufferPtr(n_buf, buf, 0);
9094 des_xmlEntitiesTablePtr(n_table, table, 1);
9095 xmlResetLastError();
9096 if (mem_base != xmlMemBlocks()) {
9097 printf("Leak of %d blocks found in xmlDumpEntitiesTable",
9098 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009099 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009100 printf(" %d", n_buf);
9101 printf(" %d", n_table);
9102 printf("\n");
9103 }
9104 }
9105 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009106 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009107#endif
9108
Daniel Veillard42595322004-11-08 10:52:06 +00009109 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009110}
9111
9112
Daniel Veillardce682bc2004-11-05 17:22:25 +00009113#define gen_nb_xmlEntityPtr 1
9114static xmlEntityPtr gen_xmlEntityPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9115 return(NULL);
9116}
9117static void des_xmlEntityPtr(int no ATTRIBUTE_UNUSED, xmlEntityPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
9118}
9119
Daniel Veillardd93f6252004-11-02 15:53:51 +00009120static int
9121test_xmlDumpEntityDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009122 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009123
William M. Brack21e4ef22005-01-02 09:53:13 +00009124#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +00009125 int mem_base;
9126 xmlBufferPtr buf; /* An XML buffer. */
9127 int n_buf;
9128 xmlEntityPtr ent; /* An entity table */
9129 int n_ent;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009130
Daniel Veillardce682bc2004-11-05 17:22:25 +00009131 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
9132 for (n_ent = 0;n_ent < gen_nb_xmlEntityPtr;n_ent++) {
9133 mem_base = xmlMemBlocks();
9134 buf = gen_xmlBufferPtr(n_buf, 0);
9135 ent = gen_xmlEntityPtr(n_ent, 1);
9136
9137 xmlDumpEntityDecl(buf, ent);
9138 call_tests++;
9139 des_xmlBufferPtr(n_buf, buf, 0);
9140 des_xmlEntityPtr(n_ent, ent, 1);
9141 xmlResetLastError();
9142 if (mem_base != xmlMemBlocks()) {
9143 printf("Leak of %d blocks found in xmlDumpEntityDecl",
9144 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009145 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009146 printf(" %d", n_buf);
9147 printf(" %d", n_ent);
9148 printf("\n");
9149 }
9150 }
9151 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009152 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009153#endif
9154
Daniel Veillard42595322004-11-08 10:52:06 +00009155 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009156}
9157
9158
9159static int
Daniel Veillardd93f6252004-11-02 15:53:51 +00009160test_xmlEncodeEntitiesReentrant(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009161 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009162
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009163 int mem_base;
9164 xmlChar * ret_val;
9165 xmlDocPtr doc; /* the document containing the string */
9166 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009167 xmlChar * input; /* A string to convert to XML. */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009168 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009169
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009170 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9171 for (n_input = 0;n_input < gen_nb_const_xmlChar_ptr;n_input++) {
9172 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009173 doc = gen_xmlDocPtr(n_doc, 0);
9174 input = gen_const_xmlChar_ptr(n_input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009175
William M. Brackf13f77f2004-11-12 16:03:48 +00009176 ret_val = xmlEncodeEntitiesReentrant(doc, (const xmlChar *)input);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009177 desret_xmlChar_ptr(ret_val);
9178 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009179 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009180 des_const_xmlChar_ptr(n_input, (const xmlChar *)input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009181 xmlResetLastError();
9182 if (mem_base != xmlMemBlocks()) {
9183 printf("Leak of %d blocks found in xmlEncodeEntitiesReentrant",
9184 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009185 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009186 printf(" %d", n_doc);
9187 printf(" %d", n_input);
9188 printf("\n");
9189 }
9190 }
9191 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009192 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009193
Daniel Veillard42595322004-11-08 10:52:06 +00009194 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009195}
9196
9197
9198static int
9199test_xmlEncodeSpecialChars(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009200 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009201
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009202 int mem_base;
9203 xmlChar * ret_val;
9204 xmlDocPtr doc; /* the document containing the string */
9205 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009206 xmlChar * input; /* A string to convert to XML. */
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009207 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009208
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009209 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9210 for (n_input = 0;n_input < gen_nb_const_xmlChar_ptr;n_input++) {
9211 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009212 doc = gen_xmlDocPtr(n_doc, 0);
9213 input = gen_const_xmlChar_ptr(n_input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009214
William M. Brackf13f77f2004-11-12 16:03:48 +00009215 ret_val = xmlEncodeSpecialChars(doc, (const xmlChar *)input);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009216 desret_xmlChar_ptr(ret_val);
9217 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009218 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009219 des_const_xmlChar_ptr(n_input, (const xmlChar *)input, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009220 xmlResetLastError();
9221 if (mem_base != xmlMemBlocks()) {
9222 printf("Leak of %d blocks found in xmlEncodeSpecialChars",
9223 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009224 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +00009225 printf(" %d", n_doc);
9226 printf(" %d", n_input);
9227 printf("\n");
9228 }
9229 }
9230 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009231 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009232
Daniel Veillard42595322004-11-08 10:52:06 +00009233 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009234}
9235
9236
9237static int
9238test_xmlGetDocEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009239 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009240
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009241 int mem_base;
9242 xmlEntityPtr ret_val;
9243 xmlDocPtr doc; /* the document referencing the entity */
9244 int n_doc;
9245 xmlChar * name; /* the entity name */
9246 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009247
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009248 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9249 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9250 mem_base = xmlMemBlocks();
9251 doc = gen_xmlDocPtr(n_doc, 0);
9252 name = gen_const_xmlChar_ptr(n_name, 1);
9253
William M. Brackf13f77f2004-11-12 16:03:48 +00009254 ret_val = xmlGetDocEntity(doc, (const xmlChar *)name);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009255 desret_xmlEntityPtr(ret_val);
9256 call_tests++;
9257 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009258 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009259 xmlResetLastError();
9260 if (mem_base != xmlMemBlocks()) {
9261 printf("Leak of %d blocks found in xmlGetDocEntity",
9262 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009263 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009264 printf(" %d", n_doc);
9265 printf(" %d", n_name);
9266 printf("\n");
9267 }
9268 }
9269 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009270 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009271
Daniel Veillard42595322004-11-08 10:52:06 +00009272 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009273}
9274
9275
9276static int
9277test_xmlGetDtdEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009278 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009279
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009280 int mem_base;
9281 xmlEntityPtr ret_val;
9282 xmlDocPtr doc; /* the document referencing the entity */
9283 int n_doc;
9284 xmlChar * name; /* the entity name */
9285 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009286
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009287 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9288 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9289 mem_base = xmlMemBlocks();
9290 doc = gen_xmlDocPtr(n_doc, 0);
9291 name = gen_const_xmlChar_ptr(n_name, 1);
9292
William M. Brackf13f77f2004-11-12 16:03:48 +00009293 ret_val = xmlGetDtdEntity(doc, (const xmlChar *)name);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009294 desret_xmlEntityPtr(ret_val);
9295 call_tests++;
9296 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009297 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009298 xmlResetLastError();
9299 if (mem_base != xmlMemBlocks()) {
9300 printf("Leak of %d blocks found in xmlGetDtdEntity",
9301 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009302 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009303 printf(" %d", n_doc);
9304 printf(" %d", n_name);
9305 printf("\n");
9306 }
9307 }
9308 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009309 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009310
Daniel Veillard42595322004-11-08 10:52:06 +00009311 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009312}
9313
9314
9315static int
9316test_xmlGetParameterEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009317 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009318
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009319 int mem_base;
9320 xmlEntityPtr ret_val;
9321 xmlDocPtr doc; /* the document referencing the entity */
9322 int n_doc;
9323 xmlChar * name; /* the entity name */
9324 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009325
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009326 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
9327 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9328 mem_base = xmlMemBlocks();
9329 doc = gen_xmlDocPtr(n_doc, 0);
9330 name = gen_const_xmlChar_ptr(n_name, 1);
9331
William M. Brackf13f77f2004-11-12 16:03:48 +00009332 ret_val = xmlGetParameterEntity(doc, (const xmlChar *)name);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009333 desret_xmlEntityPtr(ret_val);
9334 call_tests++;
9335 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009336 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009337 xmlResetLastError();
9338 if (mem_base != xmlMemBlocks()) {
9339 printf("Leak of %d blocks found in xmlGetParameterEntity",
9340 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009341 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009342 printf(" %d", n_doc);
9343 printf(" %d", n_name);
9344 printf("\n");
9345 }
9346 }
9347 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009348 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009349
Daniel Veillard42595322004-11-08 10:52:06 +00009350 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009351}
9352
9353
9354static int
9355test_xmlGetPredefinedEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009356 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009357
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009358 int mem_base;
9359 xmlEntityPtr ret_val;
9360 xmlChar * name; /* the entity name */
9361 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009362
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009363 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9364 mem_base = xmlMemBlocks();
9365 name = gen_const_xmlChar_ptr(n_name, 0);
9366
William M. Brackf13f77f2004-11-12 16:03:48 +00009367 ret_val = xmlGetPredefinedEntity((const xmlChar *)name);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009368 desret_xmlEntityPtr(ret_val);
9369 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +00009370 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009371 xmlResetLastError();
9372 if (mem_base != xmlMemBlocks()) {
9373 printf("Leak of %d blocks found in xmlGetPredefinedEntity",
9374 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009375 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009376 printf(" %d", n_name);
9377 printf("\n");
9378 }
9379 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +00009380 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009381
Daniel Veillard42595322004-11-08 10:52:06 +00009382 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009383}
9384
9385
9386static int
9387test_xmlInitializePredefinedEntities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009388 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009389
William M. Brack21e4ef22005-01-02 09:53:13 +00009390#if defined(LIBXML_LEGACY_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +00009391#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +00009392 int mem_base;
9393
9394 mem_base = xmlMemBlocks();
9395
9396 xmlInitializePredefinedEntities();
9397 call_tests++;
9398 xmlResetLastError();
9399 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +00009400 printf("Leak of %d blocks found in xmlInitializePredefinedEntities",
Daniel Veillardd93f6252004-11-02 15:53:51 +00009401 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009402 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +00009403 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +00009404 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009405 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +00009406#endif
William M. Brack21e4ef22005-01-02 09:53:13 +00009407#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +00009408
Daniel Veillard42595322004-11-08 10:52:06 +00009409 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009410}
9411
9412static int
9413test_entities(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009414 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009415
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009416 if (quiet == 0) printf("Testing entities : 12 of 16 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +00009417 test_ret += test_xmlAddDocEntity();
9418 test_ret += test_xmlAddDtdEntity();
9419 test_ret += test_xmlCleanupPredefinedEntities();
9420 test_ret += test_xmlCopyEntitiesTable();
9421 test_ret += test_xmlCreateEntitiesTable();
9422 test_ret += test_xmlDumpEntitiesTable();
9423 test_ret += test_xmlDumpEntityDecl();
9424 test_ret += test_xmlEncodeEntitiesReentrant();
9425 test_ret += test_xmlEncodeSpecialChars();
9426 test_ret += test_xmlGetDocEntity();
9427 test_ret += test_xmlGetDtdEntity();
9428 test_ret += test_xmlGetParameterEntity();
9429 test_ret += test_xmlGetPredefinedEntity();
9430 test_ret += test_xmlInitializePredefinedEntities();
Daniel Veillardd93f6252004-11-02 15:53:51 +00009431
Daniel Veillard42595322004-11-08 10:52:06 +00009432 if (test_ret != 0)
9433 printf("Module entities: %d errors\n", test_ret);
9434 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009435}
9436
9437static int
9438test_xmlHashAddEntry(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009439 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009440
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009441 int mem_base;
9442 int ret_val;
9443 xmlHashTablePtr table; /* the hash table */
9444 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009445 xmlChar * name; /* the name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009446 int n_name;
9447 void * userdata; /* a pointer to the userdata */
9448 int n_userdata;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009449
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009450 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9451 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9452 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
9453 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009454 table = gen_xmlHashTablePtr(n_table, 0);
9455 name = gen_const_xmlChar_ptr(n_name, 1);
9456 userdata = gen_userdata(n_userdata, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009457
William M. Brackf13f77f2004-11-12 16:03:48 +00009458 ret_val = xmlHashAddEntry(table, (const xmlChar *)name, userdata);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009459 desret_int(ret_val);
9460 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009461 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009462 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +00009463 des_userdata(n_userdata, userdata, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009464 xmlResetLastError();
9465 if (mem_base != xmlMemBlocks()) {
9466 printf("Leak of %d blocks found in xmlHashAddEntry",
9467 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009468 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009469 printf(" %d", n_table);
9470 printf(" %d", n_name);
9471 printf(" %d", n_userdata);
9472 printf("\n");
9473 }
9474 }
9475 }
9476 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009477 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009478
Daniel Veillard42595322004-11-08 10:52:06 +00009479 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009480}
9481
9482
9483static int
9484test_xmlHashAddEntry2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009485 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009486
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009487 int mem_base;
9488 int ret_val;
9489 xmlHashTablePtr table; /* the hash table */
9490 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009491 xmlChar * name; /* the name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009492 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009493 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009494 int n_name2;
9495 void * userdata; /* a pointer to the userdata */
9496 int n_userdata;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009497
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009498 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9499 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9500 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9501 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
9502 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009503 table = gen_xmlHashTablePtr(n_table, 0);
9504 name = gen_const_xmlChar_ptr(n_name, 1);
9505 name2 = gen_const_xmlChar_ptr(n_name2, 2);
9506 userdata = gen_userdata(n_userdata, 3);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009507
William M. Brackf13f77f2004-11-12 16:03:48 +00009508 ret_val = xmlHashAddEntry2(table, (const xmlChar *)name, (const xmlChar *)name2, userdata);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009509 desret_int(ret_val);
9510 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009511 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009512 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
9513 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +00009514 des_userdata(n_userdata, userdata, 3);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009515 xmlResetLastError();
9516 if (mem_base != xmlMemBlocks()) {
9517 printf("Leak of %d blocks found in xmlHashAddEntry2",
9518 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009519 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009520 printf(" %d", n_table);
9521 printf(" %d", n_name);
9522 printf(" %d", n_name2);
9523 printf(" %d", n_userdata);
9524 printf("\n");
9525 }
9526 }
9527 }
9528 }
9529 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009530 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009531
Daniel Veillard42595322004-11-08 10:52:06 +00009532 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009533}
9534
9535
9536static int
9537test_xmlHashAddEntry3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009538 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009539
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009540 int mem_base;
9541 int ret_val;
9542 xmlHashTablePtr table; /* the hash table */
9543 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009544 xmlChar * name; /* the name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009545 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009546 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009547 int n_name2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009548 xmlChar * name3; /* a third name of the userdata */
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009549 int n_name3;
9550 void * userdata; /* a pointer to the userdata */
9551 int n_userdata;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009552
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009553 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9554 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9555 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9556 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
9557 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
9558 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009559 table = gen_xmlHashTablePtr(n_table, 0);
9560 name = gen_const_xmlChar_ptr(n_name, 1);
9561 name2 = gen_const_xmlChar_ptr(n_name2, 2);
9562 name3 = gen_const_xmlChar_ptr(n_name3, 3);
9563 userdata = gen_userdata(n_userdata, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009564
William M. Brackf13f77f2004-11-12 16:03:48 +00009565 ret_val = xmlHashAddEntry3(table, (const xmlChar *)name, (const xmlChar *)name2, (const xmlChar *)name3, userdata);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009566 desret_int(ret_val);
9567 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009568 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009569 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
9570 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
9571 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +00009572 des_userdata(n_userdata, userdata, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009573 xmlResetLastError();
9574 if (mem_base != xmlMemBlocks()) {
9575 printf("Leak of %d blocks found in xmlHashAddEntry3",
9576 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009577 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +00009578 printf(" %d", n_table);
9579 printf(" %d", n_name);
9580 printf(" %d", n_name2);
9581 printf(" %d", n_name3);
9582 printf(" %d", n_userdata);
9583 printf("\n");
9584 }
9585 }
9586 }
9587 }
9588 }
9589 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009590 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009591
Daniel Veillard42595322004-11-08 10:52:06 +00009592 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009593}
9594
9595
9596static int
9597test_xmlHashCopy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009598 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009599
9600
9601 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009602 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009603}
9604
9605
9606static int
9607test_xmlHashCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009608 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009609
9610
9611 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +00009612 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009613}
9614
9615
9616static int
9617test_xmlHashLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009618 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009619
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009620 int mem_base;
9621 void * ret_val;
9622 xmlHashTablePtr table; /* the hash table */
9623 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009624 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009625 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009626
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009627 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9628 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9629 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009630 table = gen_xmlHashTablePtr(n_table, 0);
9631 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009632
William M. Brackf13f77f2004-11-12 16:03:48 +00009633 ret_val = xmlHashLookup(table, (const xmlChar *)name);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009634 desret_void_ptr(ret_val);
9635 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009636 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009637 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009638 xmlResetLastError();
9639 if (mem_base != xmlMemBlocks()) {
9640 printf("Leak of %d blocks found in xmlHashLookup",
9641 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009642 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009643 printf(" %d", n_table);
9644 printf(" %d", n_name);
9645 printf("\n");
9646 }
9647 }
9648 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009649 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009650
Daniel Veillard42595322004-11-08 10:52:06 +00009651 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009652}
9653
9654
9655static int
9656test_xmlHashLookup2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009657 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009658
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009659 int mem_base;
9660 void * ret_val;
9661 xmlHashTablePtr table; /* the hash table */
9662 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009663 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009664 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009665 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009666 int n_name2;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009667
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009668 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9669 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9670 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9671 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009672 table = gen_xmlHashTablePtr(n_table, 0);
9673 name = gen_const_xmlChar_ptr(n_name, 1);
9674 name2 = gen_const_xmlChar_ptr(n_name2, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009675
William M. Brackf13f77f2004-11-12 16:03:48 +00009676 ret_val = xmlHashLookup2(table, (const xmlChar *)name, (const xmlChar *)name2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009677 desret_void_ptr(ret_val);
9678 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009679 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009680 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
9681 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009682 xmlResetLastError();
9683 if (mem_base != xmlMemBlocks()) {
9684 printf("Leak of %d blocks found in xmlHashLookup2",
9685 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009686 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009687 printf(" %d", n_table);
9688 printf(" %d", n_name);
9689 printf(" %d", n_name2);
9690 printf("\n");
9691 }
9692 }
9693 }
9694 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009695 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009696
Daniel Veillard42595322004-11-08 10:52:06 +00009697 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009698}
9699
9700
9701static int
9702test_xmlHashLookup3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009703 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009704
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009705 int mem_base;
9706 void * ret_val;
9707 xmlHashTablePtr table; /* the hash table */
9708 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009709 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009710 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009711 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009712 int n_name2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009713 xmlChar * name3; /* a third name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009714 int n_name3;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009715
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009716 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9717 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9718 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9719 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
9720 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009721 table = gen_xmlHashTablePtr(n_table, 0);
9722 name = gen_const_xmlChar_ptr(n_name, 1);
9723 name2 = gen_const_xmlChar_ptr(n_name2, 2);
9724 name3 = gen_const_xmlChar_ptr(n_name3, 3);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009725
William M. Brackf13f77f2004-11-12 16:03:48 +00009726 ret_val = xmlHashLookup3(table, (const xmlChar *)name, (const xmlChar *)name2, (const xmlChar *)name3);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009727 desret_void_ptr(ret_val);
9728 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009729 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009730 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
9731 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
9732 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 3);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009733 xmlResetLastError();
9734 if (mem_base != xmlMemBlocks()) {
9735 printf("Leak of %d blocks found in xmlHashLookup3",
9736 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009737 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009738 printf(" %d", n_table);
9739 printf(" %d", n_name);
9740 printf(" %d", n_name2);
9741 printf(" %d", n_name3);
9742 printf("\n");
9743 }
9744 }
9745 }
9746 }
9747 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009748 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009749
Daniel Veillard42595322004-11-08 10:52:06 +00009750 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009751}
9752
9753
9754static int
9755test_xmlHashQLookup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009756 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009757
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009758 int mem_base;
9759 void * ret_val;
9760 xmlHashTablePtr table; /* the hash table */
9761 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009762 xmlChar * prefix; /* the prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009763 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009764 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009765 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009766
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009767 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9768 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
9769 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9770 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009771 table = gen_xmlHashTablePtr(n_table, 0);
9772 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
9773 name = gen_const_xmlChar_ptr(n_name, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009774
William M. Brackf13f77f2004-11-12 16:03:48 +00009775 ret_val = xmlHashQLookup(table, (const xmlChar *)prefix, (const xmlChar *)name);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009776 desret_void_ptr(ret_val);
9777 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009778 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009779 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
9780 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009781 xmlResetLastError();
9782 if (mem_base != xmlMemBlocks()) {
9783 printf("Leak of %d blocks found in xmlHashQLookup",
9784 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009785 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009786 printf(" %d", n_table);
9787 printf(" %d", n_prefix);
9788 printf(" %d", n_name);
9789 printf("\n");
9790 }
9791 }
9792 }
9793 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009794 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009795
Daniel Veillard42595322004-11-08 10:52:06 +00009796 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009797}
9798
9799
9800static int
9801test_xmlHashQLookup2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009802 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009803
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009804 int mem_base;
9805 void * ret_val;
9806 xmlHashTablePtr table; /* the hash table */
9807 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009808 xmlChar * prefix; /* the prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009809 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009810 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009811 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009812 xmlChar * prefix2; /* the second prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009813 int n_prefix2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009814 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009815 int n_name2;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009816
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009817 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9818 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
9819 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9820 for (n_prefix2 = 0;n_prefix2 < gen_nb_const_xmlChar_ptr;n_prefix2++) {
9821 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9822 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009823 table = gen_xmlHashTablePtr(n_table, 0);
9824 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
9825 name = gen_const_xmlChar_ptr(n_name, 2);
9826 prefix2 = gen_const_xmlChar_ptr(n_prefix2, 3);
9827 name2 = gen_const_xmlChar_ptr(n_name2, 4);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009828
William M. Brackf13f77f2004-11-12 16:03:48 +00009829 ret_val = xmlHashQLookup2(table, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)prefix2, (const xmlChar *)name2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009830 desret_void_ptr(ret_val);
9831 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009832 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009833 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
9834 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
9835 des_const_xmlChar_ptr(n_prefix2, (const xmlChar *)prefix2, 3);
9836 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 4);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009837 xmlResetLastError();
9838 if (mem_base != xmlMemBlocks()) {
9839 printf("Leak of %d blocks found in xmlHashQLookup2",
9840 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009841 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009842 printf(" %d", n_table);
9843 printf(" %d", n_prefix);
9844 printf(" %d", n_name);
9845 printf(" %d", n_prefix2);
9846 printf(" %d", n_name2);
9847 printf("\n");
9848 }
9849 }
9850 }
9851 }
9852 }
9853 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009854 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009855
Daniel Veillard42595322004-11-08 10:52:06 +00009856 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009857}
9858
9859
9860static int
9861test_xmlHashQLookup3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009862 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009863
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009864 int mem_base;
9865 void * ret_val;
9866 xmlHashTablePtr table; /* the hash table */
9867 int n_table;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009868 xmlChar * prefix; /* the prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009869 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009870 xmlChar * name; /* the name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009871 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009872 xmlChar * prefix2; /* the second prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009873 int n_prefix2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009874 xmlChar * name2; /* a second name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009875 int n_name2;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009876 xmlChar * prefix3; /* the third prefix of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009877 int n_prefix3;
Daniel Veillardce682bc2004-11-05 17:22:25 +00009878 xmlChar * name3; /* a third name of the userdata */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009879 int n_name3;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009880
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009881 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9882 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
9883 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9884 for (n_prefix2 = 0;n_prefix2 < gen_nb_const_xmlChar_ptr;n_prefix2++) {
9885 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9886 for (n_prefix3 = 0;n_prefix3 < gen_nb_const_xmlChar_ptr;n_prefix3++) {
9887 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
9888 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +00009889 table = gen_xmlHashTablePtr(n_table, 0);
9890 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
9891 name = gen_const_xmlChar_ptr(n_name, 2);
9892 prefix2 = gen_const_xmlChar_ptr(n_prefix2, 3);
9893 name2 = gen_const_xmlChar_ptr(n_name2, 4);
9894 prefix3 = gen_const_xmlChar_ptr(n_prefix3, 5);
9895 name3 = gen_const_xmlChar_ptr(n_name3, 6);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009896
William M. Brackf13f77f2004-11-12 16:03:48 +00009897 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 +00009898 desret_void_ptr(ret_val);
9899 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +00009900 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009901 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
9902 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
9903 des_const_xmlChar_ptr(n_prefix2, (const xmlChar *)prefix2, 3);
9904 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 4);
9905 des_const_xmlChar_ptr(n_prefix3, (const xmlChar *)prefix3, 5);
9906 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 6);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009907 xmlResetLastError();
9908 if (mem_base != xmlMemBlocks()) {
9909 printf("Leak of %d blocks found in xmlHashQLookup3",
9910 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +00009911 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +00009912 printf(" %d", n_table);
9913 printf(" %d", n_prefix);
9914 printf(" %d", n_name);
9915 printf(" %d", n_prefix2);
9916 printf(" %d", n_name2);
9917 printf(" %d", n_prefix3);
9918 printf(" %d", n_name3);
9919 printf("\n");
9920 }
9921 }
9922 }
9923 }
9924 }
9925 }
9926 }
9927 }
Daniel Veillard3d97e662004-11-04 10:49:00 +00009928 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009929
Daniel Veillard42595322004-11-08 10:52:06 +00009930 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009931}
9932
9933
9934static int
9935test_xmlHashRemoveEntry(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009936 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009937
Daniel Veillard42595322004-11-08 10:52:06 +00009938 int mem_base;
9939 int ret_val;
9940 xmlHashTablePtr table; /* the hash table */
9941 int n_table;
9942 xmlChar * name; /* the name of the userdata */
9943 int n_name;
9944 xmlHashDeallocator f; /* the deallocator function for removed item (if any) */
9945 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009946
Daniel Veillard42595322004-11-08 10:52:06 +00009947 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9948 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9949 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
9950 mem_base = xmlMemBlocks();
9951 table = gen_xmlHashTablePtr(n_table, 0);
9952 name = gen_const_xmlChar_ptr(n_name, 1);
9953 f = gen_xmlHashDeallocator(n_f, 2);
9954
William M. Brackf13f77f2004-11-12 16:03:48 +00009955 ret_val = xmlHashRemoveEntry(table, (const xmlChar *)name, f);
Daniel Veillard42595322004-11-08 10:52:06 +00009956 desret_int(ret_val);
9957 call_tests++;
9958 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +00009959 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard42595322004-11-08 10:52:06 +00009960 des_xmlHashDeallocator(n_f, f, 2);
9961 xmlResetLastError();
9962 if (mem_base != xmlMemBlocks()) {
9963 printf("Leak of %d blocks found in xmlHashRemoveEntry",
9964 xmlMemBlocks() - mem_base);
9965 test_ret++;
9966 printf(" %d", n_table);
9967 printf(" %d", n_name);
9968 printf(" %d", n_f);
9969 printf("\n");
9970 }
9971 }
9972 }
9973 }
Daniel Veillard42595322004-11-08 10:52:06 +00009974 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +00009975
Daniel Veillard42595322004-11-08 10:52:06 +00009976 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +00009977}
9978
9979
9980static int
9981test_xmlHashRemoveEntry2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +00009982 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009983
Daniel Veillard42595322004-11-08 10:52:06 +00009984 int mem_base;
9985 int ret_val;
9986 xmlHashTablePtr table; /* the hash table */
9987 int n_table;
9988 xmlChar * name; /* the name of the userdata */
9989 int n_name;
9990 xmlChar * name2; /* a second name of the userdata */
9991 int n_name2;
9992 xmlHashDeallocator f; /* the deallocator function for removed item (if any) */
9993 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +00009994
Daniel Veillard42595322004-11-08 10:52:06 +00009995 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
9996 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
9997 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
9998 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
9999 mem_base = xmlMemBlocks();
10000 table = gen_xmlHashTablePtr(n_table, 0);
10001 name = gen_const_xmlChar_ptr(n_name, 1);
10002 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10003 f = gen_xmlHashDeallocator(n_f, 3);
10004
William M. Brackf13f77f2004-11-12 16:03:48 +000010005 ret_val = xmlHashRemoveEntry2(table, (const xmlChar *)name, (const xmlChar *)name2, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010006 desret_int(ret_val);
10007 call_tests++;
10008 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010009 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
10010 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
Daniel Veillard42595322004-11-08 10:52:06 +000010011 des_xmlHashDeallocator(n_f, f, 3);
10012 xmlResetLastError();
10013 if (mem_base != xmlMemBlocks()) {
10014 printf("Leak of %d blocks found in xmlHashRemoveEntry2",
10015 xmlMemBlocks() - mem_base);
10016 test_ret++;
10017 printf(" %d", n_table);
10018 printf(" %d", n_name);
10019 printf(" %d", n_name2);
10020 printf(" %d", n_f);
10021 printf("\n");
10022 }
10023 }
10024 }
10025 }
10026 }
Daniel Veillard42595322004-11-08 10:52:06 +000010027 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010028
Daniel Veillard42595322004-11-08 10:52:06 +000010029 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010030}
10031
10032
10033static int
10034test_xmlHashRemoveEntry3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010035 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010036
Daniel Veillard42595322004-11-08 10:52:06 +000010037 int mem_base;
10038 int ret_val;
10039 xmlHashTablePtr table; /* the hash table */
10040 int n_table;
10041 xmlChar * name; /* the name of the userdata */
10042 int n_name;
10043 xmlChar * name2; /* a second name of the userdata */
10044 int n_name2;
10045 xmlChar * name3; /* a third name of the userdata */
10046 int n_name3;
10047 xmlHashDeallocator f; /* the deallocator function for removed item (if any) */
10048 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010049
Daniel Veillard42595322004-11-08 10:52:06 +000010050 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10051 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10052 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10053 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
10054 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10055 mem_base = xmlMemBlocks();
10056 table = gen_xmlHashTablePtr(n_table, 0);
10057 name = gen_const_xmlChar_ptr(n_name, 1);
10058 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10059 name3 = gen_const_xmlChar_ptr(n_name3, 3);
10060 f = gen_xmlHashDeallocator(n_f, 4);
10061
William M. Brackf13f77f2004-11-12 16:03:48 +000010062 ret_val = xmlHashRemoveEntry3(table, (const xmlChar *)name, (const xmlChar *)name2, (const xmlChar *)name3, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010063 desret_int(ret_val);
10064 call_tests++;
10065 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010066 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
10067 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
10068 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000010069 des_xmlHashDeallocator(n_f, f, 4);
10070 xmlResetLastError();
10071 if (mem_base != xmlMemBlocks()) {
10072 printf("Leak of %d blocks found in xmlHashRemoveEntry3",
10073 xmlMemBlocks() - mem_base);
10074 test_ret++;
10075 printf(" %d", n_table);
10076 printf(" %d", n_name);
10077 printf(" %d", n_name2);
10078 printf(" %d", n_name3);
10079 printf(" %d", n_f);
10080 printf("\n");
10081 }
10082 }
10083 }
10084 }
10085 }
10086 }
Daniel Veillard42595322004-11-08 10:52:06 +000010087 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010088
Daniel Veillard42595322004-11-08 10:52:06 +000010089 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010090}
10091
10092
10093static int
10094test_xmlHashScan(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010095 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010096
10097
10098 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010099 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010100}
10101
10102
10103static int
10104test_xmlHashScan3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010105 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010106
10107
10108 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010109 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010110}
10111
10112
10113static int
10114test_xmlHashScanFull(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010115 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010116
10117
10118 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010119 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010120}
10121
10122
10123static int
10124test_xmlHashScanFull3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010125 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010126
10127
10128 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010129 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010130}
10131
10132
10133static int
10134test_xmlHashSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010135 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010136
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010137 int mem_base;
10138 int ret_val;
10139 xmlHashTablePtr table; /* the hash table */
10140 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010141
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010142 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10143 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010144 table = gen_xmlHashTablePtr(n_table, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010145
10146 ret_val = xmlHashSize(table);
10147 desret_int(ret_val);
10148 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010149 des_xmlHashTablePtr(n_table, table, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010150 xmlResetLastError();
10151 if (mem_base != xmlMemBlocks()) {
10152 printf("Leak of %d blocks found in xmlHashSize",
10153 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010154 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010155 printf(" %d", n_table);
10156 printf("\n");
10157 }
10158 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010159 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010160
Daniel Veillard42595322004-11-08 10:52:06 +000010161 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010162}
10163
10164
10165static int
10166test_xmlHashUpdateEntry(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010167 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010168
Daniel Veillard42595322004-11-08 10:52:06 +000010169 int mem_base;
10170 int ret_val;
10171 xmlHashTablePtr table; /* the hash table */
10172 int n_table;
10173 xmlChar * name; /* the name of the userdata */
10174 int n_name;
10175 void * userdata; /* a pointer to the userdata */
10176 int n_userdata;
10177 xmlHashDeallocator f; /* the deallocator function for replaced item (if any) */
10178 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010179
Daniel Veillard42595322004-11-08 10:52:06 +000010180 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10181 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10182 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
10183 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10184 mem_base = xmlMemBlocks();
10185 table = gen_xmlHashTablePtr(n_table, 0);
10186 name = gen_const_xmlChar_ptr(n_name, 1);
10187 userdata = gen_userdata(n_userdata, 2);
10188 f = gen_xmlHashDeallocator(n_f, 3);
10189
William M. Brackf13f77f2004-11-12 16:03:48 +000010190 ret_val = xmlHashUpdateEntry(table, (const xmlChar *)name, userdata, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010191 desret_int(ret_val);
10192 call_tests++;
10193 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010194 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000010195 des_userdata(n_userdata, userdata, 2);
10196 des_xmlHashDeallocator(n_f, f, 3);
10197 xmlResetLastError();
10198 if (mem_base != xmlMemBlocks()) {
10199 printf("Leak of %d blocks found in xmlHashUpdateEntry",
10200 xmlMemBlocks() - mem_base);
10201 test_ret++;
10202 printf(" %d", n_table);
10203 printf(" %d", n_name);
10204 printf(" %d", n_userdata);
10205 printf(" %d", n_f);
10206 printf("\n");
10207 }
10208 }
10209 }
10210 }
10211 }
Daniel Veillard42595322004-11-08 10:52:06 +000010212 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010213
Daniel Veillard42595322004-11-08 10:52:06 +000010214 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010215}
10216
10217
10218static int
10219test_xmlHashUpdateEntry2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010220 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010221
Daniel Veillard42595322004-11-08 10:52:06 +000010222 int mem_base;
10223 int ret_val;
10224 xmlHashTablePtr table; /* the hash table */
10225 int n_table;
10226 xmlChar * name; /* the name of the userdata */
10227 int n_name;
10228 xmlChar * name2; /* a second name of the userdata */
10229 int n_name2;
10230 void * userdata; /* a pointer to the userdata */
10231 int n_userdata;
10232 xmlHashDeallocator f; /* the deallocator function for replaced item (if any) */
10233 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010234
Daniel Veillard42595322004-11-08 10:52:06 +000010235 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10236 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10237 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10238 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
10239 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10240 mem_base = xmlMemBlocks();
10241 table = gen_xmlHashTablePtr(n_table, 0);
10242 name = gen_const_xmlChar_ptr(n_name, 1);
10243 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10244 userdata = gen_userdata(n_userdata, 3);
10245 f = gen_xmlHashDeallocator(n_f, 4);
10246
William M. Brackf13f77f2004-11-12 16:03:48 +000010247 ret_val = xmlHashUpdateEntry2(table, (const xmlChar *)name, (const xmlChar *)name2, userdata, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010248 desret_int(ret_val);
10249 call_tests++;
10250 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010251 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
10252 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
Daniel Veillard42595322004-11-08 10:52:06 +000010253 des_userdata(n_userdata, userdata, 3);
10254 des_xmlHashDeallocator(n_f, f, 4);
10255 xmlResetLastError();
10256 if (mem_base != xmlMemBlocks()) {
10257 printf("Leak of %d blocks found in xmlHashUpdateEntry2",
10258 xmlMemBlocks() - mem_base);
10259 test_ret++;
10260 printf(" %d", n_table);
10261 printf(" %d", n_name);
10262 printf(" %d", n_name2);
10263 printf(" %d", n_userdata);
10264 printf(" %d", n_f);
10265 printf("\n");
10266 }
10267 }
10268 }
10269 }
10270 }
10271 }
Daniel Veillard42595322004-11-08 10:52:06 +000010272 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010273
Daniel Veillard42595322004-11-08 10:52:06 +000010274 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010275}
10276
10277
10278static int
10279test_xmlHashUpdateEntry3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010280 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010281
Daniel Veillard42595322004-11-08 10:52:06 +000010282 int mem_base;
10283 int ret_val;
10284 xmlHashTablePtr table; /* the hash table */
10285 int n_table;
10286 xmlChar * name; /* the name of the userdata */
10287 int n_name;
10288 xmlChar * name2; /* a second name of the userdata */
10289 int n_name2;
10290 xmlChar * name3; /* a third name of the userdata */
10291 int n_name3;
10292 void * userdata; /* a pointer to the userdata */
10293 int n_userdata;
10294 xmlHashDeallocator f; /* the deallocator function for replaced item (if any) */
10295 int n_f;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010296
Daniel Veillard42595322004-11-08 10:52:06 +000010297 for (n_table = 0;n_table < gen_nb_xmlHashTablePtr;n_table++) {
10298 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
10299 for (n_name2 = 0;n_name2 < gen_nb_const_xmlChar_ptr;n_name2++) {
10300 for (n_name3 = 0;n_name3 < gen_nb_const_xmlChar_ptr;n_name3++) {
10301 for (n_userdata = 0;n_userdata < gen_nb_userdata;n_userdata++) {
10302 for (n_f = 0;n_f < gen_nb_xmlHashDeallocator;n_f++) {
10303 mem_base = xmlMemBlocks();
10304 table = gen_xmlHashTablePtr(n_table, 0);
10305 name = gen_const_xmlChar_ptr(n_name, 1);
10306 name2 = gen_const_xmlChar_ptr(n_name2, 2);
10307 name3 = gen_const_xmlChar_ptr(n_name3, 3);
10308 userdata = gen_userdata(n_userdata, 4);
10309 f = gen_xmlHashDeallocator(n_f, 5);
10310
William M. Brackf13f77f2004-11-12 16:03:48 +000010311 ret_val = xmlHashUpdateEntry3(table, (const xmlChar *)name, (const xmlChar *)name2, (const xmlChar *)name3, userdata, f);
Daniel Veillard42595322004-11-08 10:52:06 +000010312 desret_int(ret_val);
10313 call_tests++;
10314 des_xmlHashTablePtr(n_table, table, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010315 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
10316 des_const_xmlChar_ptr(n_name2, (const xmlChar *)name2, 2);
10317 des_const_xmlChar_ptr(n_name3, (const xmlChar *)name3, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000010318 des_userdata(n_userdata, userdata, 4);
10319 des_xmlHashDeallocator(n_f, f, 5);
10320 xmlResetLastError();
10321 if (mem_base != xmlMemBlocks()) {
10322 printf("Leak of %d blocks found in xmlHashUpdateEntry3",
10323 xmlMemBlocks() - mem_base);
10324 test_ret++;
10325 printf(" %d", n_table);
10326 printf(" %d", n_name);
10327 printf(" %d", n_name2);
10328 printf(" %d", n_name3);
10329 printf(" %d", n_userdata);
10330 printf(" %d", n_f);
10331 printf("\n");
10332 }
10333 }
10334 }
10335 }
10336 }
10337 }
10338 }
Daniel Veillard42595322004-11-08 10:52:06 +000010339 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010340
Daniel Veillard42595322004-11-08 10:52:06 +000010341 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010342}
10343
10344static int
10345test_hash(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010346 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010347
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010348 if (quiet == 0) printf("Testing hash : 16 of 23 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000010349 test_ret += test_xmlHashAddEntry();
10350 test_ret += test_xmlHashAddEntry2();
10351 test_ret += test_xmlHashAddEntry3();
10352 test_ret += test_xmlHashCopy();
10353 test_ret += test_xmlHashCreate();
10354 test_ret += test_xmlHashLookup();
10355 test_ret += test_xmlHashLookup2();
10356 test_ret += test_xmlHashLookup3();
10357 test_ret += test_xmlHashQLookup();
10358 test_ret += test_xmlHashQLookup2();
10359 test_ret += test_xmlHashQLookup3();
10360 test_ret += test_xmlHashRemoveEntry();
10361 test_ret += test_xmlHashRemoveEntry2();
10362 test_ret += test_xmlHashRemoveEntry3();
10363 test_ret += test_xmlHashScan();
10364 test_ret += test_xmlHashScan3();
10365 test_ret += test_xmlHashScanFull();
10366 test_ret += test_xmlHashScanFull3();
10367 test_ret += test_xmlHashSize();
10368 test_ret += test_xmlHashUpdateEntry();
10369 test_ret += test_xmlHashUpdateEntry2();
10370 test_ret += test_xmlHashUpdateEntry3();
Daniel Veillardd93f6252004-11-02 15:53:51 +000010371
Daniel Veillard42595322004-11-08 10:52:06 +000010372 if (test_ret != 0)
10373 printf("Module hash: %d errors\n", test_ret);
10374 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010375}
10376
Daniel Veillardce682bc2004-11-05 17:22:25 +000010377#define gen_nb_xmlLinkPtr 1
10378static xmlLinkPtr gen_xmlLinkPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10379 return(NULL);
10380}
10381static void des_xmlLinkPtr(int no ATTRIBUTE_UNUSED, xmlLinkPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10382}
10383
Daniel Veillardd93f6252004-11-02 15:53:51 +000010384static int
10385test_xmlLinkGetData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010386 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010387
Daniel Veillardce682bc2004-11-05 17:22:25 +000010388 int mem_base;
10389 void * ret_val;
10390 xmlLinkPtr lk; /* a link */
10391 int n_lk;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010392
Daniel Veillardce682bc2004-11-05 17:22:25 +000010393 for (n_lk = 0;n_lk < gen_nb_xmlLinkPtr;n_lk++) {
10394 mem_base = xmlMemBlocks();
10395 lk = gen_xmlLinkPtr(n_lk, 0);
10396
10397 ret_val = xmlLinkGetData(lk);
10398 desret_void_ptr(ret_val);
10399 call_tests++;
10400 des_xmlLinkPtr(n_lk, lk, 0);
10401 xmlResetLastError();
10402 if (mem_base != xmlMemBlocks()) {
10403 printf("Leak of %d blocks found in xmlLinkGetData",
10404 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010405 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010406 printf(" %d", n_lk);
10407 printf("\n");
10408 }
10409 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000010410 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010411
Daniel Veillard42595322004-11-08 10:52:06 +000010412 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010413}
10414
10415
10416static int
10417test_xmlListAppend(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010418 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010419
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010420 int mem_base;
10421 int ret_val;
10422 xmlListPtr l; /* a list */
10423 int n_l;
10424 void * data; /* the data */
10425 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010426
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010427 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10428 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10429 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010430 l = gen_xmlListPtr(n_l, 0);
10431 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010432
10433 ret_val = xmlListAppend(l, data);
10434 desret_int(ret_val);
10435 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010436 des_xmlListPtr(n_l, l, 0);
10437 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010438 xmlResetLastError();
10439 if (mem_base != xmlMemBlocks()) {
10440 printf("Leak of %d blocks found in xmlListAppend",
10441 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010442 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010443 printf(" %d", n_l);
10444 printf(" %d", n_data);
10445 printf("\n");
10446 }
10447 }
10448 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010449 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010450
Daniel Veillard42595322004-11-08 10:52:06 +000010451 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010452}
10453
10454
10455static int
10456test_xmlListClear(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010457 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010458
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010459 int mem_base;
10460 xmlListPtr l; /* a list */
10461 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010462
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010463 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10464 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010465 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010466
10467 xmlListClear(l);
10468 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010469 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010470 xmlResetLastError();
10471 if (mem_base != xmlMemBlocks()) {
10472 printf("Leak of %d blocks found in xmlListClear",
10473 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010474 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010475 printf(" %d", n_l);
10476 printf("\n");
10477 }
10478 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010479 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010480
Daniel Veillard42595322004-11-08 10:52:06 +000010481 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010482}
10483
10484
Daniel Veillardce682bc2004-11-05 17:22:25 +000010485#define gen_nb_const_xmlListPtr 1
10486static xmlListPtr gen_const_xmlListPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10487 return(NULL);
10488}
10489static void des_const_xmlListPtr(int no ATTRIBUTE_UNUSED, const xmlListPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
10490}
10491
Daniel Veillardd93f6252004-11-02 15:53:51 +000010492static int
10493test_xmlListCopy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010494 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010495
Daniel Veillardce682bc2004-11-05 17:22:25 +000010496 int mem_base;
10497 int ret_val;
10498 xmlListPtr cur; /* the new list */
10499 int n_cur;
10500 xmlListPtr old; /* the old list */
10501 int n_old;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010502
Daniel Veillardce682bc2004-11-05 17:22:25 +000010503 for (n_cur = 0;n_cur < gen_nb_xmlListPtr;n_cur++) {
10504 for (n_old = 0;n_old < gen_nb_const_xmlListPtr;n_old++) {
10505 mem_base = xmlMemBlocks();
10506 cur = gen_xmlListPtr(n_cur, 0);
10507 old = gen_const_xmlListPtr(n_old, 1);
10508
William M. Brackf13f77f2004-11-12 16:03:48 +000010509 ret_val = xmlListCopy(cur, (const xmlListPtr)old);
Daniel Veillardce682bc2004-11-05 17:22:25 +000010510 desret_int(ret_val);
10511 call_tests++;
10512 des_xmlListPtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000010513 des_const_xmlListPtr(n_old, (const xmlListPtr)old, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000010514 xmlResetLastError();
10515 if (mem_base != xmlMemBlocks()) {
10516 printf("Leak of %d blocks found in xmlListCopy",
10517 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010518 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000010519 printf(" %d", n_cur);
10520 printf(" %d", n_old);
10521 printf("\n");
10522 }
10523 }
10524 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000010525 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010526
Daniel Veillard42595322004-11-08 10:52:06 +000010527 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010528}
10529
10530
10531static int
10532test_xmlListCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010533 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010534
10535
10536 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010537 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010538}
10539
10540
10541static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000010542test_xmlListDup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010543 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010544
10545
10546 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010547 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010548}
10549
10550
10551static int
10552test_xmlListEmpty(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010553 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010554
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010555 int mem_base;
10556 int ret_val;
10557 xmlListPtr l; /* a list */
10558 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010559
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010560 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10561 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010562 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010563
10564 ret_val = xmlListEmpty(l);
10565 desret_int(ret_val);
10566 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010567 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010568 xmlResetLastError();
10569 if (mem_base != xmlMemBlocks()) {
10570 printf("Leak of %d blocks found in xmlListEmpty",
10571 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010572 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010573 printf(" %d", n_l);
10574 printf("\n");
10575 }
10576 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010577 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010578
Daniel Veillard42595322004-11-08 10:52:06 +000010579 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010580}
10581
10582
10583static int
10584test_xmlListEnd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010585 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010586
10587
10588 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010589 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010590}
10591
10592
10593static int
10594test_xmlListFront(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010595 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010596
10597
10598 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000010599 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010600}
10601
10602
10603static int
10604test_xmlListInsert(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010605 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010606
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010607 int mem_base;
10608 int ret_val;
10609 xmlListPtr l; /* a list */
10610 int n_l;
10611 void * data; /* the data */
10612 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010613
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010614 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10615 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10616 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010617 l = gen_xmlListPtr(n_l, 0);
10618 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010619
10620 ret_val = xmlListInsert(l, data);
10621 desret_int(ret_val);
10622 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010623 des_xmlListPtr(n_l, l, 0);
10624 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010625 xmlResetLastError();
10626 if (mem_base != xmlMemBlocks()) {
10627 printf("Leak of %d blocks found in xmlListInsert",
10628 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010629 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010630 printf(" %d", n_l);
10631 printf(" %d", n_data);
10632 printf("\n");
10633 }
10634 }
10635 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010636 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010637
Daniel Veillard42595322004-11-08 10:52:06 +000010638 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010639}
10640
10641
10642static int
10643test_xmlListMerge(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010644 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010645
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010646 int mem_base;
10647 xmlListPtr l1; /* the original list */
10648 int n_l1;
10649 xmlListPtr l2; /* the new list */
10650 int n_l2;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010651
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010652 for (n_l1 = 0;n_l1 < gen_nb_xmlListPtr;n_l1++) {
10653 for (n_l2 = 0;n_l2 < gen_nb_xmlListPtr;n_l2++) {
10654 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010655 l1 = gen_xmlListPtr(n_l1, 0);
10656 l2 = gen_xmlListPtr(n_l2, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010657
10658 xmlListMerge(l1, l2);
10659 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010660 des_xmlListPtr(n_l1, l1, 0);
10661 des_xmlListPtr(n_l2, l2, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010662 xmlResetLastError();
10663 if (mem_base != xmlMemBlocks()) {
10664 printf("Leak of %d blocks found in xmlListMerge",
10665 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010666 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010667 printf(" %d", n_l1);
10668 printf(" %d", n_l2);
10669 printf("\n");
10670 }
10671 }
10672 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010673 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010674
Daniel Veillard42595322004-11-08 10:52:06 +000010675 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010676}
10677
10678
10679static int
10680test_xmlListPopBack(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010681 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010682
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010683 int mem_base;
10684 xmlListPtr l; /* a list */
10685 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010686
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010687 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10688 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010689 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010690
10691 xmlListPopBack(l);
10692 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010693 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010694 xmlResetLastError();
10695 if (mem_base != xmlMemBlocks()) {
10696 printf("Leak of %d blocks found in xmlListPopBack",
10697 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010698 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010699 printf(" %d", n_l);
10700 printf("\n");
10701 }
10702 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010703 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010704
Daniel Veillard42595322004-11-08 10:52:06 +000010705 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010706}
10707
10708
10709static int
10710test_xmlListPopFront(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010711 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010712
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010713 int mem_base;
10714 xmlListPtr l; /* a list */
10715 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010716
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010717 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10718 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010719 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010720
10721 xmlListPopFront(l);
10722 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010723 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010724 xmlResetLastError();
10725 if (mem_base != xmlMemBlocks()) {
10726 printf("Leak of %d blocks found in xmlListPopFront",
10727 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010728 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010729 printf(" %d", n_l);
10730 printf("\n");
10731 }
10732 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010733 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010734
Daniel Veillard42595322004-11-08 10:52:06 +000010735 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010736}
10737
10738
10739static int
10740test_xmlListPushBack(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010741 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010742
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010743 int mem_base;
10744 int ret_val;
10745 xmlListPtr l; /* a list */
10746 int n_l;
10747 void * data; /* new data */
10748 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010749
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010750 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10751 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10752 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010753 l = gen_xmlListPtr(n_l, 0);
10754 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010755
10756 ret_val = xmlListPushBack(l, data);
10757 desret_int(ret_val);
10758 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010759 des_xmlListPtr(n_l, l, 0);
10760 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010761 xmlResetLastError();
10762 if (mem_base != xmlMemBlocks()) {
10763 printf("Leak of %d blocks found in xmlListPushBack",
10764 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010765 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010766 printf(" %d", n_l);
10767 printf(" %d", n_data);
10768 printf("\n");
10769 }
10770 }
10771 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010772 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010773
Daniel Veillard42595322004-11-08 10:52:06 +000010774 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010775}
10776
10777
10778static int
10779test_xmlListPushFront(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010780 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010781
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010782 int mem_base;
10783 int ret_val;
10784 xmlListPtr l; /* a list */
10785 int n_l;
10786 void * data; /* new data */
10787 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010788
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010789 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10790 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10791 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010792 l = gen_xmlListPtr(n_l, 0);
10793 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010794
10795 ret_val = xmlListPushFront(l, data);
10796 desret_int(ret_val);
10797 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010798 des_xmlListPtr(n_l, l, 0);
10799 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010800 xmlResetLastError();
10801 if (mem_base != xmlMemBlocks()) {
10802 printf("Leak of %d blocks found in xmlListPushFront",
10803 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010804 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010805 printf(" %d", n_l);
10806 printf(" %d", n_data);
10807 printf("\n");
10808 }
10809 }
10810 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010811 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010812
Daniel Veillard42595322004-11-08 10:52:06 +000010813 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010814}
10815
10816
10817static int
10818test_xmlListRemoveAll(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010819 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010820
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010821 int mem_base;
10822 int ret_val;
10823 xmlListPtr l; /* a list */
10824 int n_l;
10825 void * data; /* list data */
10826 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010827
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010828 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10829 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10830 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010831 l = gen_xmlListPtr(n_l, 0);
10832 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010833
10834 ret_val = xmlListRemoveAll(l, data);
10835 desret_int(ret_val);
10836 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010837 des_xmlListPtr(n_l, l, 0);
10838 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010839 xmlResetLastError();
10840 if (mem_base != xmlMemBlocks()) {
10841 printf("Leak of %d blocks found in xmlListRemoveAll",
10842 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010843 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010844 printf(" %d", n_l);
10845 printf(" %d", n_data);
10846 printf("\n");
10847 }
10848 }
10849 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010850 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010851
Daniel Veillard42595322004-11-08 10:52:06 +000010852 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010853}
10854
10855
10856static int
10857test_xmlListRemoveFirst(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010858 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010859
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010860 int mem_base;
10861 int ret_val;
10862 xmlListPtr l; /* a list */
10863 int n_l;
10864 void * data; /* list data */
10865 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010866
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010867 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10868 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10869 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010870 l = gen_xmlListPtr(n_l, 0);
10871 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010872
10873 ret_val = xmlListRemoveFirst(l, data);
10874 desret_int(ret_val);
10875 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010876 des_xmlListPtr(n_l, l, 0);
10877 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010878 xmlResetLastError();
10879 if (mem_base != xmlMemBlocks()) {
10880 printf("Leak of %d blocks found in xmlListRemoveFirst",
10881 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010882 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010883 printf(" %d", n_l);
10884 printf(" %d", n_data);
10885 printf("\n");
10886 }
10887 }
10888 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010889 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010890
Daniel Veillard42595322004-11-08 10:52:06 +000010891 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010892}
10893
10894
10895static int
10896test_xmlListRemoveLast(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010897 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010898
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010899 int mem_base;
10900 int ret_val;
10901 xmlListPtr l; /* a list */
10902 int n_l;
10903 void * data; /* list data */
10904 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010905
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010906 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10907 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10908 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010909 l = gen_xmlListPtr(n_l, 0);
10910 data = gen_userdata(n_data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010911
10912 ret_val = xmlListRemoveLast(l, data);
10913 desret_int(ret_val);
10914 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010915 des_xmlListPtr(n_l, l, 0);
10916 des_userdata(n_data, data, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010917 xmlResetLastError();
10918 if (mem_base != xmlMemBlocks()) {
10919 printf("Leak of %d blocks found in xmlListRemoveLast",
10920 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010921 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010922 printf(" %d", n_l);
10923 printf(" %d", n_data);
10924 printf("\n");
10925 }
10926 }
10927 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010928 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010929
Daniel Veillard42595322004-11-08 10:52:06 +000010930 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010931}
10932
10933
10934static int
10935test_xmlListReverse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010936 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010937
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010938 int mem_base;
10939 xmlListPtr l; /* a list */
10940 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010941
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010942 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10943 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010944 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010945
10946 xmlListReverse(l);
10947 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010948 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010949 xmlResetLastError();
10950 if (mem_base != xmlMemBlocks()) {
10951 printf("Leak of %d blocks found in xmlListReverse",
10952 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010953 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000010954 printf(" %d", n_l);
10955 printf("\n");
10956 }
10957 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010958 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010959
Daniel Veillard42595322004-11-08 10:52:06 +000010960 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000010961}
10962
10963
10964static int
10965test_xmlListReverseSearch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000010966 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010967
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010968 int mem_base;
10969 void * ret_val;
10970 xmlListPtr l; /* a list */
10971 int n_l;
10972 void * data; /* a search value */
10973 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000010974
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010975 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
10976 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
10977 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000010978 l = gen_xmlListPtr(n_l, 0);
10979 data = gen_userdata(n_data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010980
10981 ret_val = xmlListReverseSearch(l, data);
10982 desret_void_ptr(ret_val);
10983 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000010984 des_xmlListPtr(n_l, l, 0);
10985 des_userdata(n_data, data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010986 xmlResetLastError();
10987 if (mem_base != xmlMemBlocks()) {
10988 printf("Leak of %d blocks found in xmlListReverseSearch",
10989 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000010990 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000010991 printf(" %d", n_l);
10992 printf(" %d", n_data);
10993 printf("\n");
10994 }
10995 }
10996 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000010997 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000010998
Daniel Veillard42595322004-11-08 10:52:06 +000010999 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011000}
11001
11002
11003static int
11004test_xmlListReverseWalk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011005 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011006
11007
11008 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011009 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011010}
11011
11012
11013static int
11014test_xmlListSearch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011015 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011016
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011017 int mem_base;
11018 void * ret_val;
11019 xmlListPtr l; /* a list */
11020 int n_l;
11021 void * data; /* a search value */
11022 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011023
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011024 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11025 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
11026 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011027 l = gen_xmlListPtr(n_l, 0);
11028 data = gen_userdata(n_data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011029
11030 ret_val = xmlListSearch(l, data);
11031 desret_void_ptr(ret_val);
11032 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011033 des_xmlListPtr(n_l, l, 0);
11034 des_userdata(n_data, data, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011035 xmlResetLastError();
11036 if (mem_base != xmlMemBlocks()) {
11037 printf("Leak of %d blocks found in xmlListSearch",
11038 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011039 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011040 printf(" %d", n_l);
11041 printf(" %d", n_data);
11042 printf("\n");
11043 }
11044 }
11045 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011046 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011047
Daniel Veillard42595322004-11-08 10:52:06 +000011048 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011049}
11050
11051
11052static int
11053test_xmlListSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011054 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011055
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011056 int mem_base;
11057 int ret_val;
11058 xmlListPtr l; /* a list */
11059 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011060
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011061 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11062 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011063 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011064
11065 ret_val = xmlListSize(l);
11066 desret_int(ret_val);
11067 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011068 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011069 xmlResetLastError();
11070 if (mem_base != xmlMemBlocks()) {
11071 printf("Leak of %d blocks found in xmlListSize",
11072 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011073 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011074 printf(" %d", n_l);
11075 printf("\n");
11076 }
11077 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011078 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011079
Daniel Veillard42595322004-11-08 10:52:06 +000011080 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011081}
11082
11083
11084static int
11085test_xmlListSort(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011086 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011087
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011088 int mem_base;
11089 xmlListPtr l; /* a list */
11090 int n_l;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011091
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011092 for (n_l = 0;n_l < gen_nb_xmlListPtr;n_l++) {
11093 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011094 l = gen_xmlListPtr(n_l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011095
11096 xmlListSort(l);
11097 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011098 des_xmlListPtr(n_l, l, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011099 xmlResetLastError();
11100 if (mem_base != xmlMemBlocks()) {
11101 printf("Leak of %d blocks found in xmlListSort",
11102 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011103 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000011104 printf(" %d", n_l);
11105 printf("\n");
11106 }
11107 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000011108 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011109
Daniel Veillard42595322004-11-08 10:52:06 +000011110 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011111}
11112
11113
11114static int
11115test_xmlListWalk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011116 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011117
11118
11119 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011120 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011121}
11122
11123static int
11124test_list(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011125 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011126
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011127 if (quiet == 0) printf("Testing list : 19 of 26 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000011128 test_ret += test_xmlLinkGetData();
11129 test_ret += test_xmlListAppend();
11130 test_ret += test_xmlListClear();
11131 test_ret += test_xmlListCopy();
11132 test_ret += test_xmlListCreate();
11133 test_ret += test_xmlListDup();
11134 test_ret += test_xmlListEmpty();
11135 test_ret += test_xmlListEnd();
11136 test_ret += test_xmlListFront();
11137 test_ret += test_xmlListInsert();
11138 test_ret += test_xmlListMerge();
11139 test_ret += test_xmlListPopBack();
11140 test_ret += test_xmlListPopFront();
11141 test_ret += test_xmlListPushBack();
11142 test_ret += test_xmlListPushFront();
11143 test_ret += test_xmlListRemoveAll();
11144 test_ret += test_xmlListRemoveFirst();
11145 test_ret += test_xmlListRemoveLast();
11146 test_ret += test_xmlListReverse();
11147 test_ret += test_xmlListReverseSearch();
11148 test_ret += test_xmlListReverseWalk();
11149 test_ret += test_xmlListSearch();
11150 test_ret += test_xmlListSize();
11151 test_ret += test_xmlListSort();
11152 test_ret += test_xmlListWalk();
Daniel Veillardd93f6252004-11-02 15:53:51 +000011153
Daniel Veillard42595322004-11-08 10:52:06 +000011154 if (test_ret != 0)
11155 printf("Module list: %d errors\n", test_ret);
11156 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011157}
11158
11159static int
11160test_xmlNanoFTPCheckResponse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011161 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011162
William M. Brack21e4ef22005-01-02 09:53:13 +000011163#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011164 int mem_base;
11165 int ret_val;
11166 void * ctx; /* an FTP context */
11167 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011168
Daniel Veillard27f20102004-11-05 11:50:11 +000011169 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11170 mem_base = xmlMemBlocks();
11171 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11172
11173 ret_val = xmlNanoFTPCheckResponse(ctx);
11174 desret_int(ret_val);
11175 call_tests++;
11176 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11177 xmlResetLastError();
11178 if (mem_base != xmlMemBlocks()) {
11179 printf("Leak of %d blocks found in xmlNanoFTPCheckResponse",
11180 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011181 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011182 printf(" %d", n_ctx);
11183 printf("\n");
11184 }
11185 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011186 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011187#endif
11188
Daniel Veillard42595322004-11-08 10:52:06 +000011189 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011190}
11191
11192
11193static int
11194test_xmlNanoFTPCleanup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011195 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011196
William M. Brack21e4ef22005-01-02 09:53:13 +000011197#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000011198 int mem_base;
11199
11200 mem_base = xmlMemBlocks();
11201
11202 xmlNanoFTPCleanup();
11203 call_tests++;
11204 xmlResetLastError();
11205 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000011206 printf("Leak of %d blocks found in xmlNanoFTPCleanup",
Daniel Veillardd93f6252004-11-02 15:53:51 +000011207 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011208 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000011209 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000011210 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011211 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011212#endif
11213
Daniel Veillard42595322004-11-08 10:52:06 +000011214 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011215}
11216
11217
11218static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000011219test_xmlNanoFTPCloseConnection(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011220 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011221
William M. Brack21e4ef22005-01-02 09:53:13 +000011222#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011223 int mem_base;
Daniel Veillard27f20102004-11-05 11:50:11 +000011224 int ret_val;
11225 void * ctx; /* an FTP context */
11226 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011227
Daniel Veillard27f20102004-11-05 11:50:11 +000011228 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011229 mem_base = xmlMemBlocks();
Daniel Veillard27f20102004-11-05 11:50:11 +000011230 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011231
Daniel Veillard27f20102004-11-05 11:50:11 +000011232 ret_val = xmlNanoFTPCloseConnection(ctx);
11233 desret_int(ret_val);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011234 call_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011235 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011236 xmlResetLastError();
11237 if (mem_base != xmlMemBlocks()) {
Daniel Veillard27f20102004-11-05 11:50:11 +000011238 printf("Leak of %d blocks found in xmlNanoFTPCloseConnection",
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011239 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011240 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011241 printf(" %d", n_ctx);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011242 printf("\n");
11243 }
11244 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011245 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011246#endif
11247
Daniel Veillard42595322004-11-08 10:52:06 +000011248 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011249}
11250
11251
11252static int
11253test_xmlNanoFTPCwd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011254 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011255
William M. Brack21e4ef22005-01-02 09:53:13 +000011256#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011257 int mem_base;
11258 int ret_val;
11259 void * ctx; /* an FTP context */
11260 int n_ctx;
Daniel Veillardce682bc2004-11-05 17:22:25 +000011261 char * directory; /* a directory on the server */
Daniel Veillard27f20102004-11-05 11:50:11 +000011262 int n_directory;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011263
Daniel Veillard27f20102004-11-05 11:50:11 +000011264 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11265 for (n_directory = 0;n_directory < gen_nb_const_char_ptr;n_directory++) {
11266 mem_base = xmlMemBlocks();
11267 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11268 directory = gen_const_char_ptr(n_directory, 1);
11269
William M. Brackf13f77f2004-11-12 16:03:48 +000011270 ret_val = xmlNanoFTPCwd(ctx, (const char *)directory);
Daniel Veillard27f20102004-11-05 11:50:11 +000011271 desret_int(ret_val);
11272 call_tests++;
11273 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000011274 des_const_char_ptr(n_directory, (const char *)directory, 1);
Daniel Veillard27f20102004-11-05 11:50:11 +000011275 xmlResetLastError();
11276 if (mem_base != xmlMemBlocks()) {
11277 printf("Leak of %d blocks found in xmlNanoFTPCwd",
11278 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011279 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011280 printf(" %d", n_ctx);
11281 printf(" %d", n_directory);
11282 printf("\n");
11283 }
11284 }
11285 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011286 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011287#endif
11288
Daniel Veillard42595322004-11-08 10:52:06 +000011289 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011290}
11291
11292
11293static int
11294test_xmlNanoFTPDele(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011295 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011296
William M. Brack21e4ef22005-01-02 09:53:13 +000011297#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011298 int mem_base;
11299 int ret_val;
11300 void * ctx; /* an FTP context */
11301 int n_ctx;
11302 const char * file; /* a file or directory on the server */
11303 int n_file;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011304
Daniel Veillard27f20102004-11-05 11:50:11 +000011305 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11306 for (n_file = 0;n_file < gen_nb_filepath;n_file++) {
11307 mem_base = xmlMemBlocks();
11308 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11309 file = gen_filepath(n_file, 1);
11310
11311 ret_val = xmlNanoFTPDele(ctx, file);
11312 desret_int(ret_val);
11313 call_tests++;
11314 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11315 des_filepath(n_file, file, 1);
11316 xmlResetLastError();
11317 if (mem_base != xmlMemBlocks()) {
11318 printf("Leak of %d blocks found in xmlNanoFTPDele",
11319 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011320 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011321 printf(" %d", n_ctx);
11322 printf(" %d", n_file);
11323 printf("\n");
11324 }
11325 }
11326 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011327 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011328#endif
11329
Daniel Veillard42595322004-11-08 10:52:06 +000011330 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011331}
11332
11333
11334static int
11335test_xmlNanoFTPGet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011336 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011337
11338
11339 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011340 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011341}
11342
11343
11344static int
11345test_xmlNanoFTPGetConnection(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011346 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011347
William M. Brack21e4ef22005-01-02 09:53:13 +000011348#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011349 int mem_base;
11350 int ret_val;
11351 void * ctx; /* an FTP context */
11352 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011353
Daniel Veillard27f20102004-11-05 11:50:11 +000011354 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11355 mem_base = xmlMemBlocks();
11356 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11357
11358 ret_val = xmlNanoFTPGetConnection(ctx);
11359 desret_int(ret_val);
11360 call_tests++;
11361 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11362 xmlResetLastError();
11363 if (mem_base != xmlMemBlocks()) {
11364 printf("Leak of %d blocks found in xmlNanoFTPGetConnection",
11365 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011366 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011367 printf(" %d", n_ctx);
11368 printf("\n");
11369 }
11370 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011371 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011372#endif
11373
Daniel Veillard42595322004-11-08 10:52:06 +000011374 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011375}
11376
11377
11378static int
11379test_xmlNanoFTPGetResponse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011380 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011381
William M. Brack21e4ef22005-01-02 09:53:13 +000011382#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011383 int mem_base;
11384 int ret_val;
11385 void * ctx; /* an FTP context */
11386 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011387
Daniel Veillard27f20102004-11-05 11:50:11 +000011388 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11389 mem_base = xmlMemBlocks();
11390 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11391
11392 ret_val = xmlNanoFTPGetResponse(ctx);
11393 desret_int(ret_val);
11394 call_tests++;
11395 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11396 xmlResetLastError();
11397 if (mem_base != xmlMemBlocks()) {
11398 printf("Leak of %d blocks found in xmlNanoFTPGetResponse",
11399 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011400 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011401 printf(" %d", n_ctx);
11402 printf("\n");
11403 }
11404 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011405 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011406#endif
11407
Daniel Veillard42595322004-11-08 10:52:06 +000011408 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011409}
11410
11411
11412static int
11413test_xmlNanoFTPGetSocket(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011414 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011415
William M. Brack21e4ef22005-01-02 09:53:13 +000011416#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011417 int mem_base;
11418 int ret_val;
11419 void * ctx; /* an FTP context */
11420 int n_ctx;
11421 const char * filename; /* the file to retrieve (or NULL if path is in context). */
11422 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011423
Daniel Veillard27f20102004-11-05 11:50:11 +000011424 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11425 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
11426 mem_base = xmlMemBlocks();
11427 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11428 filename = gen_filepath(n_filename, 1);
11429
11430 ret_val = xmlNanoFTPGetSocket(ctx, filename);
11431 desret_int(ret_val);
11432 call_tests++;
11433 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11434 des_filepath(n_filename, filename, 1);
11435 xmlResetLastError();
11436 if (mem_base != xmlMemBlocks()) {
11437 printf("Leak of %d blocks found in xmlNanoFTPGetSocket",
11438 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011439 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011440 printf(" %d", n_ctx);
11441 printf(" %d", n_filename);
11442 printf("\n");
11443 }
11444 }
11445 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011446 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011447#endif
11448
Daniel Veillard42595322004-11-08 10:52:06 +000011449 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011450}
11451
11452
11453static int
11454test_xmlNanoFTPInit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011455 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011456
William M. Brack21e4ef22005-01-02 09:53:13 +000011457#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000011458 int mem_base;
11459
11460 mem_base = xmlMemBlocks();
11461
11462 xmlNanoFTPInit();
11463 call_tests++;
11464 xmlResetLastError();
11465 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000011466 printf("Leak of %d blocks found in xmlNanoFTPInit",
Daniel Veillardd93f6252004-11-02 15:53:51 +000011467 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011468 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000011469 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000011470 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011471 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011472#endif
11473
Daniel Veillard42595322004-11-08 10:52:06 +000011474 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011475}
11476
11477
11478static int
11479test_xmlNanoFTPList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011480 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011481
11482
11483 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011484 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011485}
11486
11487
11488static int
11489test_xmlNanoFTPNewCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011490 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011491
11492
11493 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000011494 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011495}
11496
11497
11498static int
11499test_xmlNanoFTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011500 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011501
William M. Brack21e4ef22005-01-02 09:53:13 +000011502#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011503 int mem_base;
11504 void * ret_val;
11505 const char * URL; /* the URL to the resource */
11506 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011507
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011508 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
11509 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000011510 URL = gen_filepath(n_URL, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011511
11512 ret_val = xmlNanoFTPOpen(URL);
11513 desret_void_ptr(ret_val);
11514 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011515 des_filepath(n_URL, URL, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011516 xmlResetLastError();
11517 if (mem_base != xmlMemBlocks()) {
11518 printf("Leak of %d blocks found in xmlNanoFTPOpen",
11519 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011520 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011521 printf(" %d", n_URL);
11522 printf("\n");
11523 }
11524 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011525 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000011526#endif
11527
Daniel Veillard42595322004-11-08 10:52:06 +000011528 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011529}
11530
11531
11532static int
11533test_xmlNanoFTPProxy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011534 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011535
William M. Brack21e4ef22005-01-02 09:53:13 +000011536#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000011537 char * host; /* the proxy host name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000011538 int n_host;
11539 int port; /* the proxy port */
11540 int n_port;
Daniel Veillardce682bc2004-11-05 17:22:25 +000011541 char * user; /* the proxy user name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000011542 int n_user;
Daniel Veillardce682bc2004-11-05 17:22:25 +000011543 char * passwd; /* the proxy password */
Daniel Veillardd93f6252004-11-02 15:53:51 +000011544 int n_passwd;
11545 int type; /* the type of proxy 1 for using SITE, 2 for USER a@b */
11546 int n_type;
11547
11548 for (n_host = 0;n_host < gen_nb_const_char_ptr;n_host++) {
11549 for (n_port = 0;n_port < gen_nb_int;n_port++) {
11550 for (n_user = 0;n_user < gen_nb_const_char_ptr;n_user++) {
11551 for (n_passwd = 0;n_passwd < gen_nb_const_char_ptr;n_passwd++) {
11552 for (n_type = 0;n_type < gen_nb_int;n_type++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +000011553 host = gen_const_char_ptr(n_host, 0);
11554 port = gen_int(n_port, 1);
11555 user = gen_const_char_ptr(n_user, 2);
11556 passwd = gen_const_char_ptr(n_passwd, 3);
11557 type = gen_int(n_type, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011558
William M. Brackf13f77f2004-11-12 16:03:48 +000011559 xmlNanoFTPProxy((const char *)host, port, (const char *)user, (const char *)passwd, type);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011560 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000011561 des_const_char_ptr(n_host, (const char *)host, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000011562 des_int(n_port, port, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000011563 des_const_char_ptr(n_user, (const char *)user, 2);
11564 des_const_char_ptr(n_passwd, (const char *)passwd, 3);
Daniel Veillard3d97e662004-11-04 10:49:00 +000011565 des_int(n_type, type, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011566 xmlResetLastError();
11567 }
11568 }
11569 }
11570 }
11571 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011572 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011573#endif
11574
Daniel Veillard42595322004-11-08 10:52:06 +000011575 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011576}
11577
11578
11579static int
11580test_xmlNanoFTPQuit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011581 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011582
William M. Brack21e4ef22005-01-02 09:53:13 +000011583#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011584 int mem_base;
11585 int ret_val;
11586 void * ctx; /* an FTP context */
11587 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011588
Daniel Veillard27f20102004-11-05 11:50:11 +000011589 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11590 mem_base = xmlMemBlocks();
11591 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11592
11593 ret_val = xmlNanoFTPQuit(ctx);
11594 desret_int(ret_val);
11595 call_tests++;
11596 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11597 xmlResetLastError();
11598 if (mem_base != xmlMemBlocks()) {
11599 printf("Leak of %d blocks found in xmlNanoFTPQuit",
11600 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011601 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011602 printf(" %d", n_ctx);
11603 printf("\n");
11604 }
11605 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011606 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011607#endif
11608
Daniel Veillard42595322004-11-08 10:52:06 +000011609 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011610}
11611
11612
11613static int
11614test_xmlNanoFTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011615 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011616
William M. Brack21e4ef22005-01-02 09:53:13 +000011617#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011618 int mem_base;
11619 int ret_val;
11620 void * ctx; /* the FTP context */
11621 int n_ctx;
11622 void * dest; /* a buffer */
11623 int n_dest;
11624 int len; /* the buffer length */
11625 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011626
Daniel Veillard27f20102004-11-05 11:50:11 +000011627 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11628 for (n_dest = 0;n_dest < gen_nb_void_ptr;n_dest++) {
11629 for (n_len = 0;n_len < gen_nb_int;n_len++) {
11630 mem_base = xmlMemBlocks();
11631 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11632 dest = gen_void_ptr(n_dest, 1);
11633 len = gen_int(n_len, 2);
11634
11635 ret_val = xmlNanoFTPRead(ctx, dest, len);
11636 desret_int(ret_val);
11637 call_tests++;
11638 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11639 des_void_ptr(n_dest, dest, 1);
11640 des_int(n_len, len, 2);
11641 xmlResetLastError();
11642 if (mem_base != xmlMemBlocks()) {
11643 printf("Leak of %d blocks found in xmlNanoFTPRead",
11644 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011645 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011646 printf(" %d", n_ctx);
11647 printf(" %d", n_dest);
11648 printf(" %d", n_len);
11649 printf("\n");
11650 }
11651 }
11652 }
11653 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011654 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011655#endif
11656
Daniel Veillard42595322004-11-08 10:52:06 +000011657 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011658}
11659
11660
11661static int
11662test_xmlNanoFTPScanProxy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011663 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011664
William M. Brack21e4ef22005-01-02 09:53:13 +000011665#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000011666 const char * URL; /* The proxy URL used to initialize the proxy context */
11667 int n_URL;
11668
11669 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +000011670 URL = gen_filepath(n_URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011671
11672 xmlNanoFTPScanProxy(URL);
11673 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000011674 des_filepath(n_URL, URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011675 xmlResetLastError();
11676 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011677 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011678#endif
11679
Daniel Veillard42595322004-11-08 10:52:06 +000011680 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011681}
11682
11683
11684static int
11685test_xmlNanoFTPUpdateURL(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011686 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011687
William M. Brack21e4ef22005-01-02 09:53:13 +000011688#if defined(LIBXML_FTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011689 int mem_base;
11690 int ret_val;
11691 void * ctx; /* an FTP context */
11692 int n_ctx;
11693 const char * URL; /* The URL used to update the context */
11694 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011695
Daniel Veillard27f20102004-11-05 11:50:11 +000011696 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoFTPCtxtPtr;n_ctx++) {
11697 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
11698 mem_base = xmlMemBlocks();
11699 ctx = gen_xmlNanoFTPCtxtPtr(n_ctx, 0);
11700 URL = gen_filepath(n_URL, 1);
11701
11702 ret_val = xmlNanoFTPUpdateURL(ctx, URL);
11703 desret_int(ret_val);
11704 call_tests++;
11705 des_xmlNanoFTPCtxtPtr(n_ctx, ctx, 0);
11706 des_filepath(n_URL, URL, 1);
11707 xmlResetLastError();
11708 if (mem_base != xmlMemBlocks()) {
11709 printf("Leak of %d blocks found in xmlNanoFTPUpdateURL",
11710 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011711 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011712 printf(" %d", n_ctx);
11713 printf(" %d", n_URL);
11714 printf("\n");
11715 }
11716 }
11717 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011718 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011719#endif
11720
Daniel Veillard42595322004-11-08 10:52:06 +000011721 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011722}
11723
11724static int
11725test_nanoftp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011726 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011727
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011728 if (quiet == 0) printf("Testing nanoftp : 15 of 22 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000011729 test_ret += test_xmlNanoFTPCheckResponse();
11730 test_ret += test_xmlNanoFTPCleanup();
11731 test_ret += test_xmlNanoFTPCloseConnection();
11732 test_ret += test_xmlNanoFTPCwd();
11733 test_ret += test_xmlNanoFTPDele();
11734 test_ret += test_xmlNanoFTPGet();
11735 test_ret += test_xmlNanoFTPGetConnection();
11736 test_ret += test_xmlNanoFTPGetResponse();
11737 test_ret += test_xmlNanoFTPGetSocket();
11738 test_ret += test_xmlNanoFTPInit();
11739 test_ret += test_xmlNanoFTPList();
11740 test_ret += test_xmlNanoFTPNewCtxt();
11741 test_ret += test_xmlNanoFTPOpen();
11742 test_ret += test_xmlNanoFTPProxy();
11743 test_ret += test_xmlNanoFTPQuit();
11744 test_ret += test_xmlNanoFTPRead();
11745 test_ret += test_xmlNanoFTPScanProxy();
11746 test_ret += test_xmlNanoFTPUpdateURL();
Daniel Veillardd93f6252004-11-02 15:53:51 +000011747
Daniel Veillard42595322004-11-08 10:52:06 +000011748 if (test_ret != 0)
11749 printf("Module nanoftp: %d errors\n", test_ret);
11750 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011751}
11752
11753static int
11754test_xmlNanoHTTPAuthHeader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011755 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011756
William M. Brack21e4ef22005-01-02 09:53:13 +000011757#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011758 int mem_base;
11759 const char * ret_val;
11760 void * ctx; /* the HTTP context */
11761 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011762
Daniel Veillard27f20102004-11-05 11:50:11 +000011763 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
11764 mem_base = xmlMemBlocks();
11765 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
11766
11767 ret_val = xmlNanoHTTPAuthHeader(ctx);
11768 desret_const_char_ptr(ret_val);
11769 call_tests++;
11770 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
11771 xmlResetLastError();
11772 if (mem_base != xmlMemBlocks()) {
11773 printf("Leak of %d blocks found in xmlNanoHTTPAuthHeader",
11774 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011775 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011776 printf(" %d", n_ctx);
11777 printf("\n");
11778 }
11779 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011780 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011781#endif
11782
Daniel Veillard42595322004-11-08 10:52:06 +000011783 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011784}
11785
11786
11787static int
11788test_xmlNanoHTTPCleanup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011789 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011790
William M. Brack21e4ef22005-01-02 09:53:13 +000011791#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000011792 int mem_base;
11793
11794 mem_base = xmlMemBlocks();
11795
11796 xmlNanoHTTPCleanup();
11797 call_tests++;
11798 xmlResetLastError();
11799 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000011800 printf("Leak of %d blocks found in xmlNanoHTTPCleanup",
Daniel Veillardd93f6252004-11-02 15:53:51 +000011801 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011802 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000011803 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000011804 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011805 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011806#endif
11807
Daniel Veillard42595322004-11-08 10:52:06 +000011808 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011809}
11810
11811
11812static int
11813test_xmlNanoHTTPClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011814 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011815
William M. Brack21e4ef22005-01-02 09:53:13 +000011816#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011817 int mem_base;
11818 void * ctx; /* the HTTP context */
11819 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011820
Daniel Veillard27f20102004-11-05 11:50:11 +000011821 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
11822 mem_base = xmlMemBlocks();
11823 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
11824
11825 xmlNanoHTTPClose(ctx);
11826 call_tests++;
11827 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
11828 xmlResetLastError();
11829 if (mem_base != xmlMemBlocks()) {
11830 printf("Leak of %d blocks found in xmlNanoHTTPClose",
11831 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011832 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011833 printf(" %d", n_ctx);
11834 printf("\n");
11835 }
11836 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011837 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011838#endif
11839
Daniel Veillard42595322004-11-08 10:52:06 +000011840 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011841}
11842
11843
11844static int
11845test_xmlNanoHTTPContentLength(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011846 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011847
William M. Brack21e4ef22005-01-02 09:53:13 +000011848#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011849 int mem_base;
11850 int ret_val;
11851 void * ctx; /* the HTTP context */
11852 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011853
Daniel Veillard27f20102004-11-05 11:50:11 +000011854 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
11855 mem_base = xmlMemBlocks();
11856 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
11857
11858 ret_val = xmlNanoHTTPContentLength(ctx);
11859 desret_int(ret_val);
11860 call_tests++;
11861 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
11862 xmlResetLastError();
11863 if (mem_base != xmlMemBlocks()) {
11864 printf("Leak of %d blocks found in xmlNanoHTTPContentLength",
11865 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011866 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011867 printf(" %d", n_ctx);
11868 printf("\n");
11869 }
11870 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011871 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011872#endif
11873
Daniel Veillard42595322004-11-08 10:52:06 +000011874 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011875}
11876
11877
11878static int
11879test_xmlNanoHTTPEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011880 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011881
William M. Brack21e4ef22005-01-02 09:53:13 +000011882#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000011883 int mem_base;
11884 const char * ret_val;
11885 void * ctx; /* the HTTP context */
11886 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011887
Daniel Veillard27f20102004-11-05 11:50:11 +000011888 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
11889 mem_base = xmlMemBlocks();
11890 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
11891
11892 ret_val = xmlNanoHTTPEncoding(ctx);
11893 desret_const_char_ptr(ret_val);
11894 call_tests++;
11895 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
11896 xmlResetLastError();
11897 if (mem_base != xmlMemBlocks()) {
11898 printf("Leak of %d blocks found in xmlNanoHTTPEncoding",
11899 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011900 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011901 printf(" %d", n_ctx);
11902 printf("\n");
11903 }
11904 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011905 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000011906#endif
11907
Daniel Veillard42595322004-11-08 10:52:06 +000011908 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011909}
11910
11911
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000011912#define gen_nb_char_ptr_ptr 1
11913static char ** gen_char_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
11914 return(NULL);
11915}
11916static void des_char_ptr_ptr(int no ATTRIBUTE_UNUSED, char ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
11917}
11918
Daniel Veillardd93f6252004-11-02 15:53:51 +000011919static int
11920test_xmlNanoHTTPFetch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011921 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011922
William M. Brack21e4ef22005-01-02 09:53:13 +000011923#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000011924 int mem_base;
11925 int ret_val;
11926 const char * URL; /* The URL to load */
11927 int n_URL;
11928 const char * filename; /* the filename where the content should be saved */
11929 int n_filename;
11930 char ** contentType; /* if available the Content-Type information will be returned at that location */
11931 int n_contentType;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011932
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000011933 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
11934 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
11935 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
11936 mem_base = xmlMemBlocks();
11937 URL = gen_filepath(n_URL, 0);
11938 filename = gen_filepath(n_filename, 1);
11939 contentType = gen_char_ptr_ptr(n_contentType, 2);
11940
11941 ret_val = xmlNanoHTTPFetch(URL, filename, contentType);
11942 desret_int(ret_val);
11943 call_tests++;
11944 des_filepath(n_URL, URL, 0);
11945 des_filepath(n_filename, filename, 1);
11946 des_char_ptr_ptr(n_contentType, contentType, 2);
11947 xmlResetLastError();
11948 if (mem_base != xmlMemBlocks()) {
11949 printf("Leak of %d blocks found in xmlNanoHTTPFetch",
11950 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011951 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000011952 printf(" %d", n_URL);
11953 printf(" %d", n_filename);
11954 printf(" %d", n_contentType);
11955 printf("\n");
11956 }
11957 }
11958 }
11959 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011960 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000011961#endif
11962
Daniel Veillard42595322004-11-08 10:52:06 +000011963 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011964}
11965
11966
11967static int
11968test_xmlNanoHTTPInit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011969 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011970
William M. Brack21e4ef22005-01-02 09:53:13 +000011971#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000011972 int mem_base;
11973
11974 mem_base = xmlMemBlocks();
11975
11976 xmlNanoHTTPInit();
11977 call_tests++;
11978 xmlResetLastError();
11979 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000011980 printf("Leak of %d blocks found in xmlNanoHTTPInit",
Daniel Veillardd93f6252004-11-02 15:53:51 +000011981 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000011982 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000011983 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000011984 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000011985 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011986#endif
11987
Daniel Veillard42595322004-11-08 10:52:06 +000011988 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000011989}
11990
11991
11992static int
11993test_xmlNanoHTTPMethod(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000011994 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000011995
William M. Brack21e4ef22005-01-02 09:53:13 +000011996#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000011997 int mem_base;
11998 void * ret_val;
11999 const char * URL; /* The URL to load */
12000 int n_URL;
12001 char * method; /* the HTTP method to use */
12002 int n_method;
12003 char * input; /* the input string if any */
12004 int n_input;
12005 char ** contentType; /* the Content-Type information IN and OUT */
12006 int n_contentType;
12007 char * headers; /* the extra headers */
12008 int n_headers;
12009 int ilen; /* input length */
12010 int n_ilen;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012011
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012012 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12013 for (n_method = 0;n_method < gen_nb_const_char_ptr;n_method++) {
12014 for (n_input = 0;n_input < gen_nb_const_char_ptr;n_input++) {
12015 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
12016 for (n_headers = 0;n_headers < gen_nb_const_char_ptr;n_headers++) {
12017 for (n_ilen = 0;n_ilen < gen_nb_int;n_ilen++) {
12018 mem_base = xmlMemBlocks();
12019 URL = gen_filepath(n_URL, 0);
12020 method = gen_const_char_ptr(n_method, 1);
12021 input = gen_const_char_ptr(n_input, 2);
12022 contentType = gen_char_ptr_ptr(n_contentType, 3);
12023 headers = gen_const_char_ptr(n_headers, 4);
12024 ilen = gen_int(n_ilen, 5);
12025
William M. Brackf13f77f2004-11-12 16:03:48 +000012026 ret_val = xmlNanoHTTPMethod(URL, (const char *)method, (const char *)input, contentType, (const char *)headers, ilen);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012027 desret_void_ptr(ret_val);
12028 call_tests++;
12029 des_filepath(n_URL, URL, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000012030 des_const_char_ptr(n_method, (const char *)method, 1);
12031 des_const_char_ptr(n_input, (const char *)input, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012032 des_char_ptr_ptr(n_contentType, contentType, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000012033 des_const_char_ptr(n_headers, (const char *)headers, 4);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012034 des_int(n_ilen, ilen, 5);
12035 xmlResetLastError();
12036 if (mem_base != xmlMemBlocks()) {
12037 printf("Leak of %d blocks found in xmlNanoHTTPMethod",
12038 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012039 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012040 printf(" %d", n_URL);
12041 printf(" %d", n_method);
12042 printf(" %d", n_input);
12043 printf(" %d", n_contentType);
12044 printf(" %d", n_headers);
12045 printf(" %d", n_ilen);
12046 printf("\n");
12047 }
12048 }
12049 }
12050 }
12051 }
12052 }
12053 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012054 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012055#endif
12056
Daniel Veillard42595322004-11-08 10:52:06 +000012057 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012058}
12059
12060
12061static int
12062test_xmlNanoHTTPMethodRedir(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012063 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012064
William M. Brack21e4ef22005-01-02 09:53:13 +000012065#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012066 int mem_base;
12067 void * ret_val;
12068 const char * URL; /* The URL to load */
12069 int n_URL;
12070 char * method; /* the HTTP method to use */
12071 int n_method;
12072 char * input; /* the input string if any */
12073 int n_input;
12074 char ** contentType; /* the Content-Type information IN and OUT */
12075 int n_contentType;
12076 char ** redir; /* the redirected URL OUT */
12077 int n_redir;
12078 char * headers; /* the extra headers */
12079 int n_headers;
12080 int ilen; /* input length */
12081 int n_ilen;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012082
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012083 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12084 for (n_method = 0;n_method < gen_nb_const_char_ptr;n_method++) {
12085 for (n_input = 0;n_input < gen_nb_const_char_ptr;n_input++) {
12086 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
12087 for (n_redir = 0;n_redir < gen_nb_char_ptr_ptr;n_redir++) {
12088 for (n_headers = 0;n_headers < gen_nb_const_char_ptr;n_headers++) {
12089 for (n_ilen = 0;n_ilen < gen_nb_int;n_ilen++) {
12090 mem_base = xmlMemBlocks();
12091 URL = gen_filepath(n_URL, 0);
12092 method = gen_const_char_ptr(n_method, 1);
12093 input = gen_const_char_ptr(n_input, 2);
12094 contentType = gen_char_ptr_ptr(n_contentType, 3);
12095 redir = gen_char_ptr_ptr(n_redir, 4);
12096 headers = gen_const_char_ptr(n_headers, 5);
12097 ilen = gen_int(n_ilen, 6);
12098
William M. Brackf13f77f2004-11-12 16:03:48 +000012099 ret_val = xmlNanoHTTPMethodRedir(URL, (const char *)method, (const char *)input, contentType, redir, (const char *)headers, ilen);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012100 desret_void_ptr(ret_val);
12101 call_tests++;
12102 des_filepath(n_URL, URL, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000012103 des_const_char_ptr(n_method, (const char *)method, 1);
12104 des_const_char_ptr(n_input, (const char *)input, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012105 des_char_ptr_ptr(n_contentType, contentType, 3);
12106 des_char_ptr_ptr(n_redir, redir, 4);
William M. Brackf13f77f2004-11-12 16:03:48 +000012107 des_const_char_ptr(n_headers, (const char *)headers, 5);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012108 des_int(n_ilen, ilen, 6);
12109 xmlResetLastError();
12110 if (mem_base != xmlMemBlocks()) {
12111 printf("Leak of %d blocks found in xmlNanoHTTPMethodRedir",
12112 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012113 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012114 printf(" %d", n_URL);
12115 printf(" %d", n_method);
12116 printf(" %d", n_input);
12117 printf(" %d", n_contentType);
12118 printf(" %d", n_redir);
12119 printf(" %d", n_headers);
12120 printf(" %d", n_ilen);
12121 printf("\n");
12122 }
12123 }
12124 }
12125 }
12126 }
12127 }
12128 }
12129 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012130 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012131#endif
12132
Daniel Veillard42595322004-11-08 10:52:06 +000012133 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012134}
12135
12136
12137static int
12138test_xmlNanoHTTPMimeType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012139 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012140
William M. Brack21e4ef22005-01-02 09:53:13 +000012141#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000012142 int mem_base;
12143 const char * ret_val;
12144 void * ctx; /* the HTTP context */
12145 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012146
Daniel Veillard27f20102004-11-05 11:50:11 +000012147 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
12148 mem_base = xmlMemBlocks();
12149 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
12150
12151 ret_val = xmlNanoHTTPMimeType(ctx);
12152 desret_const_char_ptr(ret_val);
12153 call_tests++;
12154 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
12155 xmlResetLastError();
12156 if (mem_base != xmlMemBlocks()) {
12157 printf("Leak of %d blocks found in xmlNanoHTTPMimeType",
12158 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012159 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012160 printf(" %d", n_ctx);
12161 printf("\n");
12162 }
12163 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012164 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012165#endif
12166
Daniel Veillard42595322004-11-08 10:52:06 +000012167 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012168}
12169
12170
12171static int
12172test_xmlNanoHTTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012173 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012174
William M. Brack21e4ef22005-01-02 09:53:13 +000012175#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012176 int mem_base;
12177 void * ret_val;
12178 const char * URL; /* The URL to load */
12179 int n_URL;
12180 char ** contentType; /* if available the Content-Type information will be returned at that location */
12181 int n_contentType;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012182
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012183 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12184 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
12185 mem_base = xmlMemBlocks();
12186 URL = gen_filepath(n_URL, 0);
12187 contentType = gen_char_ptr_ptr(n_contentType, 1);
12188
12189 ret_val = xmlNanoHTTPOpen(URL, contentType);
12190 desret_void_ptr(ret_val);
12191 call_tests++;
12192 des_filepath(n_URL, URL, 0);
12193 des_char_ptr_ptr(n_contentType, contentType, 1);
12194 xmlResetLastError();
12195 if (mem_base != xmlMemBlocks()) {
12196 printf("Leak of %d blocks found in xmlNanoHTTPOpen",
12197 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012198 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012199 printf(" %d", n_URL);
12200 printf(" %d", n_contentType);
12201 printf("\n");
12202 }
12203 }
12204 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012205 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012206#endif
12207
Daniel Veillard42595322004-11-08 10:52:06 +000012208 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012209}
12210
12211
12212static int
12213test_xmlNanoHTTPOpenRedir(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012214 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012215
William M. Brack21e4ef22005-01-02 09:53:13 +000012216#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012217 int mem_base;
12218 void * ret_val;
12219 const char * URL; /* The URL to load */
12220 int n_URL;
12221 char ** contentType; /* if available the Content-Type information will be returned at that location */
12222 int n_contentType;
12223 char ** redir; /* if available the redirected URL will be returned */
12224 int n_redir;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012225
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012226 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12227 for (n_contentType = 0;n_contentType < gen_nb_char_ptr_ptr;n_contentType++) {
12228 for (n_redir = 0;n_redir < gen_nb_char_ptr_ptr;n_redir++) {
12229 mem_base = xmlMemBlocks();
12230 URL = gen_filepath(n_URL, 0);
12231 contentType = gen_char_ptr_ptr(n_contentType, 1);
12232 redir = gen_char_ptr_ptr(n_redir, 2);
12233
12234 ret_val = xmlNanoHTTPOpenRedir(URL, contentType, redir);
12235 desret_void_ptr(ret_val);
12236 call_tests++;
12237 des_filepath(n_URL, URL, 0);
12238 des_char_ptr_ptr(n_contentType, contentType, 1);
12239 des_char_ptr_ptr(n_redir, redir, 2);
12240 xmlResetLastError();
12241 if (mem_base != xmlMemBlocks()) {
12242 printf("Leak of %d blocks found in xmlNanoHTTPOpenRedir",
12243 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012244 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012245 printf(" %d", n_URL);
12246 printf(" %d", n_contentType);
12247 printf(" %d", n_redir);
12248 printf("\n");
12249 }
12250 }
12251 }
12252 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012253 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012254#endif
12255
Daniel Veillard42595322004-11-08 10:52:06 +000012256 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012257}
12258
12259
12260static int
12261test_xmlNanoHTTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012262 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012263
William M. Brack21e4ef22005-01-02 09:53:13 +000012264#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000012265 int mem_base;
12266 int ret_val;
12267 void * ctx; /* the HTTP context */
12268 int n_ctx;
12269 void * dest; /* a buffer */
12270 int n_dest;
12271 int len; /* the buffer length */
12272 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012273
Daniel Veillard27f20102004-11-05 11:50:11 +000012274 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
12275 for (n_dest = 0;n_dest < gen_nb_void_ptr;n_dest++) {
12276 for (n_len = 0;n_len < gen_nb_int;n_len++) {
12277 mem_base = xmlMemBlocks();
12278 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
12279 dest = gen_void_ptr(n_dest, 1);
12280 len = gen_int(n_len, 2);
12281
12282 ret_val = xmlNanoHTTPRead(ctx, dest, len);
12283 desret_int(ret_val);
12284 call_tests++;
12285 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
12286 des_void_ptr(n_dest, dest, 1);
12287 des_int(n_len, len, 2);
12288 xmlResetLastError();
12289 if (mem_base != xmlMemBlocks()) {
12290 printf("Leak of %d blocks found in xmlNanoHTTPRead",
12291 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012292 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012293 printf(" %d", n_ctx);
12294 printf(" %d", n_dest);
12295 printf(" %d", n_len);
12296 printf("\n");
12297 }
12298 }
12299 }
12300 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012301 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012302#endif
12303
Daniel Veillard42595322004-11-08 10:52:06 +000012304 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012305}
12306
12307
12308static int
12309test_xmlNanoHTTPRedir(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012310 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012311
12312
12313 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000012314 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012315}
12316
12317
12318static int
12319test_xmlNanoHTTPReturnCode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012320 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012321
William M. Brack21e4ef22005-01-02 09:53:13 +000012322#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000012323 int mem_base;
12324 int ret_val;
12325 void * ctx; /* the HTTP context */
12326 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012327
Daniel Veillard27f20102004-11-05 11:50:11 +000012328 for (n_ctx = 0;n_ctx < gen_nb_xmlNanoHTTPCtxtPtr;n_ctx++) {
12329 mem_base = xmlMemBlocks();
12330 ctx = gen_xmlNanoHTTPCtxtPtr(n_ctx, 0);
12331
12332 ret_val = xmlNanoHTTPReturnCode(ctx);
12333 desret_int(ret_val);
12334 call_tests++;
12335 des_xmlNanoHTTPCtxtPtr(n_ctx, ctx, 0);
12336 xmlResetLastError();
12337 if (mem_base != xmlMemBlocks()) {
12338 printf("Leak of %d blocks found in xmlNanoHTTPReturnCode",
12339 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012340 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012341 printf(" %d", n_ctx);
12342 printf("\n");
12343 }
12344 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012345 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000012346#endif
12347
Daniel Veillard42595322004-11-08 10:52:06 +000012348 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012349}
12350
12351
12352static int
12353test_xmlNanoHTTPSave(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012354 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012355
William M. Brack21e4ef22005-01-02 09:53:13 +000012356#if defined(LIBXML_HTTP_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012357 int mem_base;
12358 int ret_val;
12359 void * ctxt; /* the HTTP context */
12360 int n_ctxt;
12361 const char * filename; /* the filename where the content should be saved */
12362 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012363
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012364 for (n_ctxt = 0;n_ctxt < gen_nb_void_ptr;n_ctxt++) {
12365 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
12366 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012367 ctxt = gen_void_ptr(n_ctxt, 0);
12368 filename = gen_fileoutput(n_filename, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012369
12370 ret_val = xmlNanoHTTPSave(ctxt, filename);
12371 desret_int(ret_val);
12372 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012373 des_void_ptr(n_ctxt, ctxt, 0);
12374 des_fileoutput(n_filename, filename, 1);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012375 xmlResetLastError();
12376 if (mem_base != xmlMemBlocks()) {
12377 printf("Leak of %d blocks found in xmlNanoHTTPSave",
12378 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012379 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012380 printf(" %d", n_ctxt);
12381 printf(" %d", n_filename);
12382 printf("\n");
12383 }
12384 }
12385 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012386 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012387#endif
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012388
Daniel Veillard42595322004-11-08 10:52:06 +000012389 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012390}
12391
12392
12393static int
12394test_xmlNanoHTTPScanProxy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012395 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012396
William M. Brack21e4ef22005-01-02 09:53:13 +000012397#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000012398 const char * URL; /* The proxy URL used to initialize the proxy context */
12399 int n_URL;
12400
12401 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
Daniel Veillard3d97e662004-11-04 10:49:00 +000012402 URL = gen_filepath(n_URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012403
12404 xmlNanoHTTPScanProxy(URL);
12405 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012406 des_filepath(n_URL, URL, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012407 xmlResetLastError();
12408 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012409 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012410#endif
12411
Daniel Veillard42595322004-11-08 10:52:06 +000012412 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012413}
12414
12415static int
12416test_nanohttp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012417 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012418
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012419 if (quiet == 0) printf("Testing nanohttp : 16 of 17 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000012420 test_ret += test_xmlNanoHTTPAuthHeader();
12421 test_ret += test_xmlNanoHTTPCleanup();
12422 test_ret += test_xmlNanoHTTPClose();
12423 test_ret += test_xmlNanoHTTPContentLength();
12424 test_ret += test_xmlNanoHTTPEncoding();
12425 test_ret += test_xmlNanoHTTPFetch();
12426 test_ret += test_xmlNanoHTTPInit();
12427 test_ret += test_xmlNanoHTTPMethod();
12428 test_ret += test_xmlNanoHTTPMethodRedir();
12429 test_ret += test_xmlNanoHTTPMimeType();
12430 test_ret += test_xmlNanoHTTPOpen();
12431 test_ret += test_xmlNanoHTTPOpenRedir();
12432 test_ret += test_xmlNanoHTTPRead();
12433 test_ret += test_xmlNanoHTTPRedir();
12434 test_ret += test_xmlNanoHTTPReturnCode();
12435 test_ret += test_xmlNanoHTTPSave();
12436 test_ret += test_xmlNanoHTTPScanProxy();
Daniel Veillardd93f6252004-11-02 15:53:51 +000012437
Daniel Veillard42595322004-11-08 10:52:06 +000012438 if (test_ret != 0)
12439 printf("Module nanohttp: %d errors\n", test_ret);
12440 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012441}
12442
12443static int
12444test_xmlByteConsumed(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012445 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012446
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000012447 int mem_base;
12448 long ret_val;
12449 xmlParserCtxtPtr ctxt; /* an XML parser context */
12450 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012451
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000012452 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12453 mem_base = xmlMemBlocks();
12454 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12455
12456 ret_val = xmlByteConsumed(ctxt);
12457 desret_long(ret_val);
12458 call_tests++;
12459 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
12460 xmlResetLastError();
12461 if (mem_base != xmlMemBlocks()) {
12462 printf("Leak of %d blocks found in xmlByteConsumed",
12463 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012464 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000012465 printf(" %d", n_ctxt);
12466 printf("\n");
12467 }
12468 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000012469 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012470
Daniel Veillard42595322004-11-08 10:52:06 +000012471 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012472}
12473
12474
12475static int
12476test_xmlClearNodeInfoSeq(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012477 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012478
Daniel Veillardce682bc2004-11-05 17:22:25 +000012479 int mem_base;
12480 xmlParserNodeInfoSeqPtr seq; /* a node info sequence pointer */
12481 int n_seq;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012482
Daniel Veillardce682bc2004-11-05 17:22:25 +000012483 for (n_seq = 0;n_seq < gen_nb_xmlParserNodeInfoSeqPtr;n_seq++) {
12484 mem_base = xmlMemBlocks();
12485 seq = gen_xmlParserNodeInfoSeqPtr(n_seq, 0);
12486
12487 xmlClearNodeInfoSeq(seq);
12488 call_tests++;
12489 des_xmlParserNodeInfoSeqPtr(n_seq, seq, 0);
12490 xmlResetLastError();
12491 if (mem_base != xmlMemBlocks()) {
12492 printf("Leak of %d blocks found in xmlClearNodeInfoSeq",
12493 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012494 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012495 printf(" %d", n_seq);
12496 printf("\n");
12497 }
12498 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000012499 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012500
Daniel Veillard42595322004-11-08 10:52:06 +000012501 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012502}
12503
12504
12505static int
12506test_xmlClearParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012507 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012508
12509 int mem_base;
12510 xmlParserCtxtPtr ctxt; /* an XML parser context */
12511 int n_ctxt;
12512
12513 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12514 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012515 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012516
12517 xmlClearParserCtxt(ctxt);
12518 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012519 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012520 xmlResetLastError();
12521 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012522 printf("Leak of %d blocks found in xmlClearParserCtxt",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012523 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012524 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012525 printf(" %d", n_ctxt);
12526 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012527 }
12528 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012529 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012530
Daniel Veillard42595322004-11-08 10:52:06 +000012531 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012532}
12533
12534
12535static int
12536test_xmlCreateDocParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012537 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012538
Daniel Veillard34099b42004-11-04 17:34:35 +000012539 int mem_base;
12540 xmlParserCtxtPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012541 xmlChar * cur; /* a pointer to an array of xmlChar */
Daniel Veillard34099b42004-11-04 17:34:35 +000012542 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012543
Daniel Veillard34099b42004-11-04 17:34:35 +000012544 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
12545 mem_base = xmlMemBlocks();
12546 cur = gen_const_xmlChar_ptr(n_cur, 0);
12547
William M. Brackf13f77f2004-11-12 16:03:48 +000012548 ret_val = xmlCreateDocParserCtxt((const xmlChar *)cur);
Daniel Veillard34099b42004-11-04 17:34:35 +000012549 desret_xmlParserCtxtPtr(ret_val);
12550 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000012551 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard34099b42004-11-04 17:34:35 +000012552 xmlResetLastError();
12553 if (mem_base != xmlMemBlocks()) {
12554 printf("Leak of %d blocks found in xmlCreateDocParserCtxt",
12555 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012556 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000012557 printf(" %d", n_cur);
12558 printf("\n");
12559 }
12560 }
Daniel Veillard34099b42004-11-04 17:34:35 +000012561 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012562
Daniel Veillard42595322004-11-08 10:52:06 +000012563 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012564}
12565
12566
12567static int
12568test_xmlCreatePushParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012569 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012570
William M. Brack21e4ef22005-01-02 09:53:13 +000012571#if defined(LIBXML_PUSH_ENABLED)
Daniel Veillard34099b42004-11-04 17:34:35 +000012572 int mem_base;
12573 xmlParserCtxtPtr ret_val;
12574 xmlSAXHandlerPtr sax; /* a SAX handler */
12575 int n_sax;
12576 void * user_data; /* The user data returned on SAX callbacks */
12577 int n_user_data;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012578 char * chunk; /* a pointer to an array of chars */
Daniel Veillard34099b42004-11-04 17:34:35 +000012579 int n_chunk;
12580 int size; /* number of chars in the array */
12581 int n_size;
12582 const char * filename; /* an optional file name or URI */
12583 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012584
Daniel Veillard34099b42004-11-04 17:34:35 +000012585 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
12586 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
12587 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
12588 for (n_size = 0;n_size < gen_nb_int;n_size++) {
Daniel Veillard42595322004-11-08 10:52:06 +000012589 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
Daniel Veillard34099b42004-11-04 17:34:35 +000012590 mem_base = xmlMemBlocks();
12591 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
12592 user_data = gen_userdata(n_user_data, 1);
12593 chunk = gen_const_char_ptr(n_chunk, 2);
12594 size = gen_int(n_size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000012595 filename = gen_fileoutput(n_filename, 4);
Daniel Veillard34099b42004-11-04 17:34:35 +000012596
William M. Brackf13f77f2004-11-12 16:03:48 +000012597 ret_val = xmlCreatePushParserCtxt(sax, user_data, (const char *)chunk, size, filename);
Daniel Veillard34099b42004-11-04 17:34:35 +000012598 desret_xmlParserCtxtPtr(ret_val);
12599 call_tests++;
12600 des_xmlSAXHandlerPtr(n_sax, sax, 0);
12601 des_userdata(n_user_data, user_data, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000012602 des_const_char_ptr(n_chunk, (const char *)chunk, 2);
Daniel Veillard34099b42004-11-04 17:34:35 +000012603 des_int(n_size, size, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000012604 des_fileoutput(n_filename, filename, 4);
Daniel Veillard34099b42004-11-04 17:34:35 +000012605 xmlResetLastError();
12606 if (mem_base != xmlMemBlocks()) {
12607 printf("Leak of %d blocks found in xmlCreatePushParserCtxt",
12608 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012609 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000012610 printf(" %d", n_sax);
12611 printf(" %d", n_user_data);
12612 printf(" %d", n_chunk);
12613 printf(" %d", n_size);
12614 printf(" %d", n_filename);
12615 printf("\n");
12616 }
12617 }
12618 }
12619 }
12620 }
12621 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012622 function_tests++;
Daniel Veillard34099b42004-11-04 17:34:35 +000012623#endif
12624
Daniel Veillard42595322004-11-08 10:52:06 +000012625 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012626}
12627
12628
12629static int
12630test_xmlCtxtReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012631 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012632
12633 int mem_base;
12634 xmlDocPtr ret_val;
12635 xmlParserCtxtPtr ctxt; /* an XML parser context */
12636 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012637 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012638 int n_cur;
12639 const char * URL; /* the base URL to use for the document */
12640 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012641 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012642 int n_encoding;
12643 int options; /* a combination of xmlParserOption */
12644 int n_options;
12645
12646 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12647 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
12648 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12649 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000012650 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000012651 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012652 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12653 cur = gen_const_xmlChar_ptr(n_cur, 1);
12654 URL = gen_filepath(n_URL, 2);
12655 encoding = gen_const_char_ptr(n_encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000012656 options = gen_parseroptions(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012657
William M. Brackf13f77f2004-11-12 16:03:48 +000012658 ret_val = xmlCtxtReadDoc(ctxt, (const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012659 desret_xmlDocPtr(ret_val);
12660 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012661 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000012662 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000012663 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000012664 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000012665 des_parseroptions(n_options, options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012666 xmlResetLastError();
12667 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012668 printf("Leak of %d blocks found in xmlCtxtReadDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012669 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012670 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012671 printf(" %d", n_ctxt);
12672 printf(" %d", n_cur);
12673 printf(" %d", n_URL);
12674 printf(" %d", n_encoding);
12675 printf(" %d", n_options);
12676 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012677 }
12678 }
12679 }
12680 }
12681 }
12682 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012683 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012684
Daniel Veillard42595322004-11-08 10:52:06 +000012685 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012686}
12687
12688
12689static int
12690test_xmlCtxtReadFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012691 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012692
12693 int mem_base;
12694 xmlDocPtr ret_val;
12695 xmlParserCtxtPtr ctxt; /* an XML parser context */
12696 int n_ctxt;
12697 const char * filename; /* a file or URL */
12698 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012699 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012700 int n_encoding;
12701 int options; /* a combination of xmlParserOption */
12702 int n_options;
12703
12704 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12705 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
12706 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000012707 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000012708 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012709 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12710 filename = gen_filepath(n_filename, 1);
12711 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000012712 options = gen_parseroptions(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012713
William M. Brackf13f77f2004-11-12 16:03:48 +000012714 ret_val = xmlCtxtReadFile(ctxt, filename, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012715 desret_xmlDocPtr(ret_val);
12716 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012717 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
12718 des_filepath(n_filename, filename, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000012719 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000012720 des_parseroptions(n_options, options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012721 xmlResetLastError();
12722 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012723 printf("Leak of %d blocks found in xmlCtxtReadFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012724 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012725 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012726 printf(" %d", n_ctxt);
12727 printf(" %d", n_filename);
12728 printf(" %d", n_encoding);
12729 printf(" %d", n_options);
12730 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012731 }
12732 }
12733 }
12734 }
12735 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012736 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012737
Daniel Veillard42595322004-11-08 10:52:06 +000012738 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012739}
12740
12741
12742static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000012743test_xmlCtxtReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012744 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012745
12746 int mem_base;
12747 xmlDocPtr ret_val;
12748 xmlParserCtxtPtr ctxt; /* an XML parser context */
12749 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012750 char * buffer; /* a pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012751 int n_buffer;
12752 int size; /* the size of the array */
12753 int n_size;
12754 const char * URL; /* the base URL to use for the document */
12755 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012756 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012757 int n_encoding;
12758 int options; /* a combination of xmlParserOption */
12759 int n_options;
12760
12761 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12762 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
12763 for (n_size = 0;n_size < gen_nb_int;n_size++) {
12764 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
12765 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000012766 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000012767 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012768 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12769 buffer = gen_const_char_ptr(n_buffer, 1);
12770 size = gen_int(n_size, 2);
12771 URL = gen_filepath(n_URL, 3);
12772 encoding = gen_const_char_ptr(n_encoding, 4);
Daniel Veillard6128c012004-11-08 17:16:15 +000012773 options = gen_parseroptions(n_options, 5);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012774
William M. Brackf13f77f2004-11-12 16:03:48 +000012775 ret_val = xmlCtxtReadMemory(ctxt, (const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012776 desret_xmlDocPtr(ret_val);
12777 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012778 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000012779 des_const_char_ptr(n_buffer, (const char *)buffer, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000012780 des_int(n_size, size, 2);
12781 des_filepath(n_URL, URL, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000012782 des_const_char_ptr(n_encoding, (const char *)encoding, 4);
Daniel Veillard6128c012004-11-08 17:16:15 +000012783 des_parseroptions(n_options, options, 5);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012784 xmlResetLastError();
12785 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012786 printf("Leak of %d blocks found in xmlCtxtReadMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012787 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012788 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012789 printf(" %d", n_ctxt);
12790 printf(" %d", n_buffer);
12791 printf(" %d", n_size);
12792 printf(" %d", n_URL);
12793 printf(" %d", n_encoding);
12794 printf(" %d", n_options);
12795 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012796 }
12797 }
12798 }
12799 }
12800 }
12801 }
12802 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012803 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012804
Daniel Veillard42595322004-11-08 10:52:06 +000012805 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012806}
12807
12808
12809static int
12810test_xmlCtxtReset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012811 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012812
12813 int mem_base;
12814 xmlParserCtxtPtr ctxt; /* an XML parser context */
12815 int n_ctxt;
12816
12817 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12818 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012819 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012820
12821 xmlCtxtReset(ctxt);
12822 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012823 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012824 xmlResetLastError();
12825 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012826 printf("Leak of %d blocks found in xmlCtxtReset",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012827 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012828 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012829 printf(" %d", n_ctxt);
12830 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012831 }
12832 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012833 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012834
Daniel Veillard42595322004-11-08 10:52:06 +000012835 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012836}
12837
12838
12839static int
12840test_xmlCtxtResetPush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012841 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012842
12843 int mem_base;
12844 int ret_val;
12845 xmlParserCtxtPtr ctxt; /* an XML parser context */
12846 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012847 char * chunk; /* a pointer to an array of chars */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012848 int n_chunk;
12849 int size; /* number of chars in the array */
12850 int n_size;
12851 const char * filename; /* an optional file name or URI */
12852 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012853 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000012854 int n_encoding;
12855
12856 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12857 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
12858 for (n_size = 0;n_size < gen_nb_int;n_size++) {
12859 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
12860 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
12861 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012862 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12863 chunk = gen_const_char_ptr(n_chunk, 1);
12864 size = gen_int(n_size, 2);
12865 filename = gen_filepath(n_filename, 3);
12866 encoding = gen_const_char_ptr(n_encoding, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012867
William M. Brackf13f77f2004-11-12 16:03:48 +000012868 ret_val = xmlCtxtResetPush(ctxt, (const char *)chunk, size, filename, (const char *)encoding);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012869 desret_int(ret_val);
12870 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012871 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000012872 des_const_char_ptr(n_chunk, (const char *)chunk, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000012873 des_int(n_size, size, 2);
12874 des_filepath(n_filename, filename, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000012875 des_const_char_ptr(n_encoding, (const char *)encoding, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012876 xmlResetLastError();
12877 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012878 printf("Leak of %d blocks found in xmlCtxtResetPush",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012879 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012880 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012881 printf(" %d", n_ctxt);
12882 printf(" %d", n_chunk);
12883 printf(" %d", n_size);
12884 printf(" %d", n_filename);
12885 printf(" %d", n_encoding);
12886 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012887 }
12888 }
12889 }
12890 }
12891 }
12892 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012893 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012894
Daniel Veillard42595322004-11-08 10:52:06 +000012895 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012896}
12897
12898
12899static int
12900test_xmlCtxtUseOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012901 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012902
12903 int mem_base;
12904 int ret_val;
12905 xmlParserCtxtPtr ctxt; /* an XML parser context */
12906 int n_ctxt;
12907 int options; /* a combination of xmlParserOption */
12908 int n_options;
12909
12910 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000012911 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000012912 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012913 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillard6128c012004-11-08 17:16:15 +000012914 options = gen_parseroptions(n_options, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012915
12916 ret_val = xmlCtxtUseOptions(ctxt, options);
12917 desret_int(ret_val);
12918 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012919 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillard6128c012004-11-08 17:16:15 +000012920 des_parseroptions(n_options, options, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012921 xmlResetLastError();
12922 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000012923 printf("Leak of %d blocks found in xmlCtxtUseOptions",
Daniel Veillardd93f6252004-11-02 15:53:51 +000012924 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012925 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000012926 printf(" %d", n_ctxt);
12927 printf(" %d", n_options);
12928 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000012929 }
12930 }
12931 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000012932 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012933
Daniel Veillard42595322004-11-08 10:52:06 +000012934 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012935}
12936
12937
12938static int
12939test_xmlGetExternalEntityLoader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012940 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012941
12942
12943 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000012944 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012945}
12946
12947
12948static int
12949test_xmlGetFeature(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000012950 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012951
William M. Brack21e4ef22005-01-02 09:53:13 +000012952#if defined(LIBXML_LEGACY_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000012953#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012954 int mem_base;
12955 int ret_val;
12956 xmlParserCtxtPtr ctxt; /* an XML/HTML parser context */
12957 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000012958 char * name; /* the feature name */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012959 int n_name;
12960 void * result; /* location to store the result */
12961 int n_result;
Daniel Veillardd93f6252004-11-02 15:53:51 +000012962
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012963 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
12964 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
12965 for (n_result = 0;n_result < gen_nb_void_ptr;n_result++) {
12966 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000012967 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
12968 name = gen_const_char_ptr(n_name, 1);
12969 result = gen_void_ptr(n_result, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012970
William M. Brackf13f77f2004-11-12 16:03:48 +000012971 ret_val = xmlGetFeature(ctxt, (const char *)name, result);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012972 desret_int(ret_val);
12973 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000012974 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000012975 des_const_char_ptr(n_name, (const char *)name, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000012976 des_void_ptr(n_result, result, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012977 xmlResetLastError();
12978 if (mem_base != xmlMemBlocks()) {
12979 printf("Leak of %d blocks found in xmlGetFeature",
12980 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000012981 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012982 printf(" %d", n_ctxt);
12983 printf(" %d", n_name);
12984 printf(" %d", n_result);
12985 printf("\n");
12986 }
12987 }
12988 }
12989 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000012990 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000012991#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000012992#endif
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000012993
Daniel Veillard42595322004-11-08 10:52:06 +000012994 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000012995}
12996
12997
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000012998#define gen_nb_const_char_ptr_ptr 1
12999static char ** gen_const_char_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13000 return(NULL);
13001}
13002static void des_const_char_ptr_ptr(int no ATTRIBUTE_UNUSED, const char ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13003}
13004
Daniel Veillardd93f6252004-11-02 15:53:51 +000013005static int
13006test_xmlGetFeaturesList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013007 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013008
William M. Brack21e4ef22005-01-02 09:53:13 +000013009#if defined(LIBXML_LEGACY_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013010#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013011 int mem_base;
13012 int ret_val;
13013 int * len; /* the length of the features name array (input/output) */
13014 int n_len;
13015 char ** result; /* an array of string to be filled with the features name. */
13016 int n_result;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013017
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013018 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
13019 for (n_result = 0;n_result < gen_nb_const_char_ptr_ptr;n_result++) {
13020 mem_base = xmlMemBlocks();
13021 len = gen_int_ptr(n_len, 0);
13022 result = gen_const_char_ptr_ptr(n_result, 1);
13023
William M. Brackf13f77f2004-11-12 16:03:48 +000013024 ret_val = xmlGetFeaturesList(len, (const char **)result);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013025 desret_int(ret_val);
13026 call_tests++;
13027 des_int_ptr(n_len, len, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000013028 des_const_char_ptr_ptr(n_result, (const char **)result, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013029 xmlResetLastError();
13030 if (mem_base != xmlMemBlocks()) {
13031 printf("Leak of %d blocks found in xmlGetFeaturesList",
13032 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013033 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013034 printf(" %d", n_len);
13035 printf(" %d", n_result);
13036 printf("\n");
13037 }
13038 }
13039 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013040 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013041#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013042#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000013043
Daniel Veillard42595322004-11-08 10:52:06 +000013044 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013045}
13046
13047
13048static int
13049test_xmlIOParseDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013050 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013051
William M. Brack21e4ef22005-01-02 09:53:13 +000013052#if defined(LIBXML_VALID_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013053#ifdef LIBXML_VALID_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000013054 int mem_base;
13055 xmlDtdPtr ret_val;
13056 xmlSAXHandlerPtr sax; /* the SAX handler block or NULL */
13057 int n_sax;
13058 xmlParserInputBufferPtr input; /* an Input Buffer */
13059 int n_input;
13060 xmlCharEncoding enc; /* the charset encoding if known */
13061 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013062
Daniel Veillard34099b42004-11-04 17:34:35 +000013063 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
13064 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
13065 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
13066 mem_base = xmlMemBlocks();
13067 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
13068 input = gen_xmlParserInputBufferPtr(n_input, 1);
13069 enc = gen_xmlCharEncoding(n_enc, 2);
13070
13071 ret_val = xmlIOParseDTD(sax, input, enc);
13072 input = NULL;
13073 desret_xmlDtdPtr(ret_val);
13074 call_tests++;
13075 des_xmlSAXHandlerPtr(n_sax, sax, 0);
13076 des_xmlParserInputBufferPtr(n_input, input, 1);
13077 des_xmlCharEncoding(n_enc, enc, 2);
13078 xmlResetLastError();
13079 if (mem_base != xmlMemBlocks()) {
13080 printf("Leak of %d blocks found in xmlIOParseDTD",
13081 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013082 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000013083 printf(" %d", n_sax);
13084 printf(" %d", n_input);
13085 printf(" %d", n_enc);
13086 printf("\n");
13087 }
13088 }
13089 }
13090 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013091 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013092#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013093#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000013094
Daniel Veillard42595322004-11-08 10:52:06 +000013095 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013096}
13097
13098
13099static int
13100test_xmlInitNodeInfoSeq(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013101 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013102
Daniel Veillardce682bc2004-11-05 17:22:25 +000013103 int mem_base;
13104 xmlParserNodeInfoSeqPtr seq; /* a node info sequence pointer */
13105 int n_seq;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013106
Daniel Veillardce682bc2004-11-05 17:22:25 +000013107 for (n_seq = 0;n_seq < gen_nb_xmlParserNodeInfoSeqPtr;n_seq++) {
13108 mem_base = xmlMemBlocks();
13109 seq = gen_xmlParserNodeInfoSeqPtr(n_seq, 0);
13110
13111 xmlInitNodeInfoSeq(seq);
13112 call_tests++;
13113 des_xmlParserNodeInfoSeqPtr(n_seq, seq, 0);
13114 xmlResetLastError();
13115 if (mem_base != xmlMemBlocks()) {
13116 printf("Leak of %d blocks found in xmlInitNodeInfoSeq",
13117 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013118 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013119 printf(" %d", n_seq);
13120 printf("\n");
13121 }
13122 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000013123 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013124
Daniel Veillard42595322004-11-08 10:52:06 +000013125 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013126}
13127
13128
13129static int
13130test_xmlInitParser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013131 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013132
13133 int mem_base;
13134
13135 mem_base = xmlMemBlocks();
13136
13137 xmlInitParser();
13138 call_tests++;
13139 xmlResetLastError();
13140 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013141 printf("Leak of %d blocks found in xmlInitParser",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013142 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013143 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013144 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013145 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013146 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013147
Daniel Veillard42595322004-11-08 10:52:06 +000013148 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013149}
13150
13151
13152static int
13153test_xmlInitParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013154 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013155
13156 int mem_base;
13157 int ret_val;
13158 xmlParserCtxtPtr ctxt; /* an XML parser context */
13159 int n_ctxt;
13160
13161 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13162 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013163 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013164
13165 ret_val = xmlInitParserCtxt(ctxt);
13166 desret_int(ret_val);
13167 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013168 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013169 xmlResetLastError();
13170 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013171 printf("Leak of %d blocks found in xmlInitParserCtxt",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013172 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013173 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013174 printf(" %d", n_ctxt);
13175 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013176 }
13177 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013178 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013179
Daniel Veillard42595322004-11-08 10:52:06 +000013180 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013181}
13182
13183
13184static int
13185test_xmlKeepBlanksDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013186 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013187
13188 int mem_base;
13189 int ret_val;
13190 int val; /* int 0 or 1 */
13191 int n_val;
13192
13193 for (n_val = 0;n_val < gen_nb_int;n_val++) {
13194 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013195 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013196
13197 ret_val = xmlKeepBlanksDefault(val);
13198 desret_int(ret_val);
13199 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013200 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013201 xmlResetLastError();
13202 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013203 printf("Leak of %d blocks found in xmlKeepBlanksDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013204 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013205 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013206 printf(" %d", n_val);
13207 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013208 }
13209 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013210 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013211
Daniel Veillard42595322004-11-08 10:52:06 +000013212 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013213}
13214
13215
13216static int
13217test_xmlLineNumbersDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013218 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013219
13220 int mem_base;
13221 int ret_val;
13222 int val; /* int 0 or 1 */
13223 int n_val;
13224
13225 for (n_val = 0;n_val < gen_nb_int;n_val++) {
13226 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013227 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013228
13229 ret_val = xmlLineNumbersDefault(val);
13230 desret_int(ret_val);
13231 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013232 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013233 xmlResetLastError();
13234 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013235 printf("Leak of %d blocks found in xmlLineNumbersDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013236 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013237 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013238 printf(" %d", n_val);
13239 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013240 }
13241 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013242 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013243
Daniel Veillard42595322004-11-08 10:52:06 +000013244 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013245}
13246
13247
13248static int
13249test_xmlLoadExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013250 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013251
Daniel Veillard42595322004-11-08 10:52:06 +000013252 int mem_base;
13253 xmlParserInputPtr ret_val;
13254 const char * URL; /* the URL for the entity to load */
13255 int n_URL;
13256 char * ID; /* the Public ID for the entity to load */
13257 int n_ID;
13258 xmlParserCtxtPtr ctxt; /* the context in which the entity is called or NULL */
13259 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013260
Daniel Veillard42595322004-11-08 10:52:06 +000013261 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
13262 for (n_ID = 0;n_ID < gen_nb_const_char_ptr;n_ID++) {
13263 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13264 mem_base = xmlMemBlocks();
13265 URL = gen_filepath(n_URL, 0);
13266 ID = gen_const_char_ptr(n_ID, 1);
13267 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 2);
13268
William M. Brackf13f77f2004-11-12 16:03:48 +000013269 ret_val = xmlLoadExternalEntity(URL, (const char *)ID, ctxt);
Daniel Veillard42595322004-11-08 10:52:06 +000013270 desret_xmlParserInputPtr(ret_val);
13271 call_tests++;
13272 des_filepath(n_URL, URL, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000013273 des_const_char_ptr(n_ID, (const char *)ID, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000013274 des_xmlParserCtxtPtr(n_ctxt, ctxt, 2);
13275 xmlResetLastError();
13276 if (mem_base != xmlMemBlocks()) {
13277 printf("Leak of %d blocks found in xmlLoadExternalEntity",
13278 xmlMemBlocks() - mem_base);
13279 test_ret++;
13280 printf(" %d", n_URL);
13281 printf(" %d", n_ID);
13282 printf(" %d", n_ctxt);
13283 printf("\n");
13284 }
13285 }
13286 }
13287 }
Daniel Veillard42595322004-11-08 10:52:06 +000013288 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013289
Daniel Veillard42595322004-11-08 10:52:06 +000013290 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013291}
13292
13293
13294static int
13295test_xmlNewIOInputStream(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013296 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013297
Daniel Veillard42595322004-11-08 10:52:06 +000013298 int mem_base;
13299 xmlParserInputPtr ret_val;
13300 xmlParserCtxtPtr ctxt; /* an XML parser context */
13301 int n_ctxt;
13302 xmlParserInputBufferPtr input; /* an I/O Input */
13303 int n_input;
13304 xmlCharEncoding enc; /* the charset encoding if known */
13305 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013306
Daniel Veillard42595322004-11-08 10:52:06 +000013307 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13308 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
13309 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
13310 mem_base = xmlMemBlocks();
13311 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
13312 input = gen_xmlParserInputBufferPtr(n_input, 1);
13313 enc = gen_xmlCharEncoding(n_enc, 2);
13314
13315 ret_val = xmlNewIOInputStream(ctxt, input, enc);
13316 if (ret_val != NULL) input = NULL;
13317 desret_xmlParserInputPtr(ret_val);
13318 call_tests++;
13319 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
13320 des_xmlParserInputBufferPtr(n_input, input, 1);
13321 des_xmlCharEncoding(n_enc, enc, 2);
13322 xmlResetLastError();
13323 if (mem_base != xmlMemBlocks()) {
13324 printf("Leak of %d blocks found in xmlNewIOInputStream",
13325 xmlMemBlocks() - mem_base);
13326 test_ret++;
13327 printf(" %d", n_ctxt);
13328 printf(" %d", n_input);
13329 printf(" %d", n_enc);
13330 printf("\n");
13331 }
13332 }
13333 }
13334 }
Daniel Veillard42595322004-11-08 10:52:06 +000013335 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013336
Daniel Veillard42595322004-11-08 10:52:06 +000013337 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013338}
13339
13340
13341static int
13342test_xmlNewParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013343 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013344
Daniel Veillard34099b42004-11-04 17:34:35 +000013345 int mem_base;
13346 xmlParserCtxtPtr ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013347
Daniel Veillard34099b42004-11-04 17:34:35 +000013348 mem_base = xmlMemBlocks();
13349
13350 ret_val = xmlNewParserCtxt();
13351 desret_xmlParserCtxtPtr(ret_val);
13352 call_tests++;
13353 xmlResetLastError();
13354 if (mem_base != xmlMemBlocks()) {
13355 printf("Leak of %d blocks found in xmlNewParserCtxt",
13356 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013357 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000013358 printf("\n");
13359 }
Daniel Veillard34099b42004-11-04 17:34:35 +000013360 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013361
Daniel Veillard42595322004-11-08 10:52:06 +000013362 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013363}
13364
13365
Daniel Veillardce682bc2004-11-05 17:22:25 +000013366#define gen_nb_xmlNodePtr_ptr 1
13367static xmlNodePtr * gen_xmlNodePtr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13368 return(NULL);
13369}
13370static void des_xmlNodePtr_ptr(int no ATTRIBUTE_UNUSED, xmlNodePtr * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
13371}
13372
Daniel Veillardd93f6252004-11-02 15:53:51 +000013373static int
13374test_xmlParseBalancedChunkMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013375 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013376
William M. Brack21e4ef22005-01-02 09:53:13 +000013377#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013378#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013379 int mem_base;
13380 int ret_val;
13381 xmlDocPtr doc; /* the document the chunk pertains to */
13382 int n_doc;
13383 xmlSAXHandlerPtr sax; /* the SAX handler bloc (possibly NULL) */
13384 int n_sax;
13385 void * user_data; /* The user data returned on SAX callbacks (possibly NULL) */
13386 int n_user_data;
13387 int depth; /* Used for loop detection, use 0 */
13388 int n_depth;
13389 xmlChar * string; /* the input string in UTF8 or ISO-Latin (zero terminated) */
13390 int n_string;
13391 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13392 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013393
Daniel Veillardce682bc2004-11-05 17:22:25 +000013394 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
13395 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
13396 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
13397 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
13398 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
13399 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13400 mem_base = xmlMemBlocks();
13401 doc = gen_xmlDocPtr(n_doc, 0);
13402 sax = gen_xmlSAXHandlerPtr(n_sax, 1);
13403 user_data = gen_userdata(n_user_data, 2);
13404 depth = gen_int(n_depth, 3);
13405 string = gen_const_xmlChar_ptr(n_string, 4);
13406 lst = gen_xmlNodePtr_ptr(n_lst, 5);
Daniel Veillarda521d282004-11-09 14:59:59 +000013407
13408#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013409 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
Daniel Veillarda521d282004-11-09 14:59:59 +000013410#endif
13411
Daniel Veillardce682bc2004-11-05 17:22:25 +000013412
William M. Brackf13f77f2004-11-12 16:03:48 +000013413 ret_val = xmlParseBalancedChunkMemory(doc, sax, user_data, depth, (const xmlChar *)string, lst);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013414 desret_int(ret_val);
13415 call_tests++;
13416 des_xmlDocPtr(n_doc, doc, 0);
13417 des_xmlSAXHandlerPtr(n_sax, sax, 1);
13418 des_userdata(n_user_data, user_data, 2);
13419 des_int(n_depth, depth, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000013420 des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 4);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013421 des_xmlNodePtr_ptr(n_lst, lst, 5);
13422 xmlResetLastError();
13423 if (mem_base != xmlMemBlocks()) {
13424 printf("Leak of %d blocks found in xmlParseBalancedChunkMemory",
13425 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013426 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013427 printf(" %d", n_doc);
13428 printf(" %d", n_sax);
13429 printf(" %d", n_user_data);
13430 printf(" %d", n_depth);
13431 printf(" %d", n_string);
13432 printf(" %d", n_lst);
13433 printf("\n");
13434 }
13435 }
13436 }
13437 }
13438 }
13439 }
13440 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013441 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013442#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013443#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000013444
Daniel Veillard42595322004-11-08 10:52:06 +000013445 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013446}
13447
13448
13449static int
13450test_xmlParseBalancedChunkMemoryRecover(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013451 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013452
William M. Brack21e4ef22005-01-02 09:53:13 +000013453#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013454#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013455 int mem_base;
13456 int ret_val;
13457 xmlDocPtr doc; /* the document the chunk pertains to */
13458 int n_doc;
13459 xmlSAXHandlerPtr sax; /* the SAX handler bloc (possibly NULL) */
13460 int n_sax;
13461 void * user_data; /* The user data returned on SAX callbacks (possibly NULL) */
13462 int n_user_data;
13463 int depth; /* Used for loop detection, use 0 */
13464 int n_depth;
13465 xmlChar * string; /* the input string in UTF8 or ISO-Latin (zero terminated) */
13466 int n_string;
13467 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13468 int n_lst;
13469 int recover; /* return nodes even if the data is broken (use 0) */
13470 int n_recover;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013471
Daniel Veillardce682bc2004-11-05 17:22:25 +000013472 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
13473 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
13474 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
13475 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
13476 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
13477 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13478 for (n_recover = 0;n_recover < gen_nb_int;n_recover++) {
13479 mem_base = xmlMemBlocks();
13480 doc = gen_xmlDocPtr(n_doc, 0);
13481 sax = gen_xmlSAXHandlerPtr(n_sax, 1);
13482 user_data = gen_userdata(n_user_data, 2);
13483 depth = gen_int(n_depth, 3);
13484 string = gen_const_xmlChar_ptr(n_string, 4);
13485 lst = gen_xmlNodePtr_ptr(n_lst, 5);
13486 recover = gen_int(n_recover, 6);
Daniel Veillarda521d282004-11-09 14:59:59 +000013487
13488#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013489 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
Daniel Veillarda521d282004-11-09 14:59:59 +000013490#endif
13491
Daniel Veillardce682bc2004-11-05 17:22:25 +000013492
William M. Brackf13f77f2004-11-12 16:03:48 +000013493 ret_val = xmlParseBalancedChunkMemoryRecover(doc, sax, user_data, depth, (const xmlChar *)string, lst, recover);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013494 desret_int(ret_val);
13495 call_tests++;
13496 des_xmlDocPtr(n_doc, doc, 0);
13497 des_xmlSAXHandlerPtr(n_sax, sax, 1);
13498 des_userdata(n_user_data, user_data, 2);
13499 des_int(n_depth, depth, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000013500 des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 4);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013501 des_xmlNodePtr_ptr(n_lst, lst, 5);
13502 des_int(n_recover, recover, 6);
13503 xmlResetLastError();
13504 if (mem_base != xmlMemBlocks()) {
13505 printf("Leak of %d blocks found in xmlParseBalancedChunkMemoryRecover",
13506 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013507 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013508 printf(" %d", n_doc);
13509 printf(" %d", n_sax);
13510 printf(" %d", n_user_data);
13511 printf(" %d", n_depth);
13512 printf(" %d", n_string);
13513 printf(" %d", n_lst);
13514 printf(" %d", n_recover);
13515 printf("\n");
13516 }
13517 }
13518 }
13519 }
13520 }
13521 }
13522 }
13523 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013524 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013525#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013526#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000013527
Daniel Veillard42595322004-11-08 10:52:06 +000013528 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013529}
13530
13531
13532static int
13533test_xmlParseChunk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013534 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013535
William M. Brack21e4ef22005-01-02 09:53:13 +000013536#if defined(LIBXML_PUSH_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000013537 int mem_base;
13538 int ret_val;
13539 xmlParserCtxtPtr ctxt; /* an XML parser context */
13540 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013541 char * chunk; /* an char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000013542 int n_chunk;
13543 int size; /* the size in byte of the chunk */
13544 int n_size;
13545 int terminate; /* last chunk indicator */
13546 int n_terminate;
13547
13548 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13549 for (n_chunk = 0;n_chunk < gen_nb_const_char_ptr;n_chunk++) {
13550 for (n_size = 0;n_size < gen_nb_int;n_size++) {
13551 for (n_terminate = 0;n_terminate < gen_nb_int;n_terminate++) {
13552 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013553 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
13554 chunk = gen_const_char_ptr(n_chunk, 1);
13555 size = gen_int(n_size, 2);
13556 terminate = gen_int(n_terminate, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013557
William M. Brackf13f77f2004-11-12 16:03:48 +000013558 ret_val = xmlParseChunk(ctxt, (const char *)chunk, size, terminate);
Daniel Veillarda521d282004-11-09 14:59:59 +000013559 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillardd93f6252004-11-02 15:53:51 +000013560 desret_int(ret_val);
13561 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013562 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000013563 des_const_char_ptr(n_chunk, (const char *)chunk, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000013564 des_int(n_size, size, 2);
13565 des_int(n_terminate, terminate, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013566 xmlResetLastError();
13567 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013568 printf("Leak of %d blocks found in xmlParseChunk",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013569 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013570 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013571 printf(" %d", n_ctxt);
13572 printf(" %d", n_chunk);
13573 printf(" %d", n_size);
13574 printf(" %d", n_terminate);
13575 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013576 }
13577 }
13578 }
13579 }
13580 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013581 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013582#endif
13583
Daniel Veillard42595322004-11-08 10:52:06 +000013584 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013585}
13586
13587
13588static int
13589test_xmlParseCtxtExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013590 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013591
Daniel Veillardce682bc2004-11-05 17:22:25 +000013592 int mem_base;
13593 int ret_val;
13594 xmlParserCtxtPtr ctx; /* the existing parsing context */
13595 int n_ctx;
13596 xmlChar * URL; /* the URL for the entity to load */
13597 int n_URL;
13598 xmlChar * ID; /* the System ID for the entity to load */
13599 int n_ID;
13600 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13601 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013602
Daniel Veillardce682bc2004-11-05 17:22:25 +000013603 for (n_ctx = 0;n_ctx < gen_nb_xmlParserCtxtPtr;n_ctx++) {
13604 for (n_URL = 0;n_URL < gen_nb_const_xmlChar_ptr;n_URL++) {
13605 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
13606 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13607 mem_base = xmlMemBlocks();
13608 ctx = gen_xmlParserCtxtPtr(n_ctx, 0);
13609 URL = gen_const_xmlChar_ptr(n_URL, 1);
13610 ID = gen_const_xmlChar_ptr(n_ID, 2);
13611 lst = gen_xmlNodePtr_ptr(n_lst, 3);
13612
William M. Brackf13f77f2004-11-12 16:03:48 +000013613 ret_val = xmlParseCtxtExternalEntity(ctx, (const xmlChar *)URL, (const xmlChar *)ID, lst);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013614 desret_int(ret_val);
13615 call_tests++;
13616 des_xmlParserCtxtPtr(n_ctx, ctx, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000013617 des_const_xmlChar_ptr(n_URL, (const xmlChar *)URL, 1);
13618 des_const_xmlChar_ptr(n_ID, (const xmlChar *)ID, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013619 des_xmlNodePtr_ptr(n_lst, lst, 3);
13620 xmlResetLastError();
13621 if (mem_base != xmlMemBlocks()) {
13622 printf("Leak of %d blocks found in xmlParseCtxtExternalEntity",
13623 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013624 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013625 printf(" %d", n_ctx);
13626 printf(" %d", n_URL);
13627 printf(" %d", n_ID);
13628 printf(" %d", n_lst);
13629 printf("\n");
13630 }
13631 }
13632 }
13633 }
13634 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000013635 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013636
Daniel Veillard42595322004-11-08 10:52:06 +000013637 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013638}
13639
13640
13641static int
13642test_xmlParseDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013643 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013644
William M. Brack21e4ef22005-01-02 09:53:13 +000013645#if defined(LIBXML_VALID_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013646#ifdef LIBXML_VALID_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000013647 int mem_base;
13648 xmlDtdPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013649 xmlChar * ExternalID; /* a NAME* containing the External ID of the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000013650 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013651 xmlChar * SystemID; /* a NAME* containing the URL to the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000013652 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013653
Daniel Veillard34099b42004-11-04 17:34:35 +000013654 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
13655 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
13656 mem_base = xmlMemBlocks();
13657 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 0);
13658 SystemID = gen_const_xmlChar_ptr(n_SystemID, 1);
13659
William M. Brackf13f77f2004-11-12 16:03:48 +000013660 ret_val = xmlParseDTD((const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard34099b42004-11-04 17:34:35 +000013661 desret_xmlDtdPtr(ret_val);
13662 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000013663 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 0);
13664 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 1);
Daniel Veillard34099b42004-11-04 17:34:35 +000013665 xmlResetLastError();
13666 if (mem_base != xmlMemBlocks()) {
13667 printf("Leak of %d blocks found in xmlParseDTD",
13668 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013669 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000013670 printf(" %d", n_ExternalID);
13671 printf(" %d", n_SystemID);
13672 printf("\n");
13673 }
13674 }
13675 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013676 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013677#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013678#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000013679
Daniel Veillard42595322004-11-08 10:52:06 +000013680 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013681}
13682
13683
13684static int
13685test_xmlParseDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013686 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013687
William M. Brack21e4ef22005-01-02 09:53:13 +000013688#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013689#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013690 int mem_base;
13691 xmlDocPtr ret_val;
13692 xmlChar * cur; /* a pointer to an array of xmlChar */
13693 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013694
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013695 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
13696 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013697 cur = gen_xmlChar_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013698
13699 ret_val = xmlParseDoc(cur);
13700 desret_xmlDocPtr(ret_val);
13701 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013702 des_xmlChar_ptr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013703 xmlResetLastError();
13704 if (mem_base != xmlMemBlocks()) {
13705 printf("Leak of %d blocks found in xmlParseDoc",
13706 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013707 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013708 printf(" %d", n_cur);
13709 printf("\n");
13710 }
13711 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013712 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013713#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013714#endif
Daniel Veillard8a32fe42004-11-02 22:10:16 +000013715
Daniel Veillard42595322004-11-08 10:52:06 +000013716 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013717}
13718
13719
13720static int
13721test_xmlParseDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013722 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013723
13724 int mem_base;
13725 int ret_val;
13726 xmlParserCtxtPtr ctxt; /* an XML parser context */
13727 int n_ctxt;
13728
13729 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13730 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013731 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013732
13733 ret_val = xmlParseDocument(ctxt);
Daniel Veillarda521d282004-11-09 14:59:59 +000013734 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillardd93f6252004-11-02 15:53:51 +000013735 desret_int(ret_val);
13736 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013737 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013738 xmlResetLastError();
13739 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013740 printf("Leak of %d blocks found in xmlParseDocument",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013741 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013742 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013743 printf(" %d", n_ctxt);
13744 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013745 }
13746 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013747 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013748
Daniel Veillard42595322004-11-08 10:52:06 +000013749 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013750}
13751
13752
13753static int
13754test_xmlParseEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013755 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013756
William M. Brack21e4ef22005-01-02 09:53:13 +000013757#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013758#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000013759 int mem_base;
13760 xmlDocPtr ret_val;
13761 const char * filename; /* the filename */
13762 int n_filename;
13763
13764 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
13765 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013766 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013767
13768 ret_val = xmlParseEntity(filename);
13769 desret_xmlDocPtr(ret_val);
13770 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013771 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013772 xmlResetLastError();
13773 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013774 printf("Leak of %d blocks found in xmlParseEntity",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013775 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013776 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013777 printf(" %d", n_filename);
13778 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013779 }
13780 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013781 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013782#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013783#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000013784
Daniel Veillard42595322004-11-08 10:52:06 +000013785 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013786}
13787
13788
13789static int
13790test_xmlParseExtParsedEnt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013791 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013792
13793 int mem_base;
13794 int ret_val;
13795 xmlParserCtxtPtr ctxt; /* an XML parser context */
13796 int n_ctxt;
13797
13798 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
13799 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013800 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013801
13802 ret_val = xmlParseExtParsedEnt(ctxt);
Daniel Veillarda521d282004-11-09 14:59:59 +000013803 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;}
Daniel Veillardd93f6252004-11-02 15:53:51 +000013804 desret_int(ret_val);
13805 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013806 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013807 xmlResetLastError();
13808 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013809 printf("Leak of %d blocks found in xmlParseExtParsedEnt",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013810 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013811 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013812 printf(" %d", n_ctxt);
13813 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013814 }
13815 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000013816 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013817
Daniel Veillard42595322004-11-08 10:52:06 +000013818 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013819}
13820
13821
13822static int
13823test_xmlParseExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013824 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013825
William M. Brack21e4ef22005-01-02 09:53:13 +000013826#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013827#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000013828 int mem_base;
13829 int ret_val;
13830 xmlDocPtr doc; /* the document the chunk pertains to */
13831 int n_doc;
13832 xmlSAXHandlerPtr sax; /* the SAX handler bloc (possibly NULL) */
13833 int n_sax;
13834 void * user_data; /* The user data returned on SAX callbacks (possibly NULL) */
13835 int n_user_data;
13836 int depth; /* Used for loop detection, use 0 */
13837 int n_depth;
13838 xmlChar * URL; /* the URL for the entity to load */
13839 int n_URL;
13840 xmlChar * ID; /* the System ID for the entity to load */
13841 int n_ID;
13842 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13843 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013844
Daniel Veillardce682bc2004-11-05 17:22:25 +000013845 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
13846 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
13847 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
13848 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
13849 for (n_URL = 0;n_URL < gen_nb_const_xmlChar_ptr;n_URL++) {
13850 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
13851 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13852 mem_base = xmlMemBlocks();
13853 doc = gen_xmlDocPtr(n_doc, 0);
13854 sax = gen_xmlSAXHandlerPtr(n_sax, 1);
13855 user_data = gen_userdata(n_user_data, 2);
13856 depth = gen_int(n_depth, 3);
13857 URL = gen_const_xmlChar_ptr(n_URL, 4);
13858 ID = gen_const_xmlChar_ptr(n_ID, 5);
13859 lst = gen_xmlNodePtr_ptr(n_lst, 6);
13860
William M. Brackf13f77f2004-11-12 16:03:48 +000013861 ret_val = xmlParseExternalEntity(doc, sax, user_data, depth, (const xmlChar *)URL, (const xmlChar *)ID, lst);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013862 desret_int(ret_val);
13863 call_tests++;
13864 des_xmlDocPtr(n_doc, doc, 0);
13865 des_xmlSAXHandlerPtr(n_sax, sax, 1);
13866 des_userdata(n_user_data, user_data, 2);
13867 des_int(n_depth, depth, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000013868 des_const_xmlChar_ptr(n_URL, (const xmlChar *)URL, 4);
13869 des_const_xmlChar_ptr(n_ID, (const xmlChar *)ID, 5);
Daniel Veillardce682bc2004-11-05 17:22:25 +000013870 des_xmlNodePtr_ptr(n_lst, lst, 6);
13871 xmlResetLastError();
13872 if (mem_base != xmlMemBlocks()) {
13873 printf("Leak of %d blocks found in xmlParseExternalEntity",
13874 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013875 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000013876 printf(" %d", n_doc);
13877 printf(" %d", n_sax);
13878 printf(" %d", n_user_data);
13879 printf(" %d", n_depth);
13880 printf(" %d", n_URL);
13881 printf(" %d", n_ID);
13882 printf(" %d", n_lst);
13883 printf("\n");
13884 }
13885 }
13886 }
13887 }
13888 }
13889 }
13890 }
13891 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013892 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013893#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013894#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000013895
Daniel Veillard42595322004-11-08 10:52:06 +000013896 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013897}
13898
13899
13900static int
13901test_xmlParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013902 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013903
William M. Brack21e4ef22005-01-02 09:53:13 +000013904#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000013905#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000013906 int mem_base;
13907 xmlDocPtr ret_val;
13908 const char * filename; /* the filename */
13909 int n_filename;
13910
13911 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
13912 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000013913 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013914
13915 ret_val = xmlParseFile(filename);
13916 desret_xmlDocPtr(ret_val);
13917 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000013918 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013919 xmlResetLastError();
13920 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000013921 printf("Leak of %d blocks found in xmlParseFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000013922 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013923 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000013924 printf(" %d", n_filename);
13925 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000013926 }
13927 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013928 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000013929#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000013930#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000013931
Daniel Veillard42595322004-11-08 10:52:06 +000013932 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013933}
13934
13935
13936static int
13937test_xmlParseInNodeContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013938 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013939
Daniel Veillard57b25162004-11-06 14:50:18 +000013940 int mem_base;
13941 xmlParserErrors ret_val;
13942 xmlNodePtr node; /* the context node */
13943 int n_node;
13944 char * data; /* the input string */
13945 int n_data;
13946 int datalen; /* the input string length in bytes */
13947 int n_datalen;
13948 int options; /* a combination of xmlParserOption */
13949 int n_options;
13950 xmlNodePtr * lst; /* the return value for the set of parsed nodes */
13951 int n_lst;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013952
Daniel Veillard57b25162004-11-06 14:50:18 +000013953 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
13954 for (n_data = 0;n_data < gen_nb_const_char_ptr;n_data++) {
13955 for (n_datalen = 0;n_datalen < gen_nb_int;n_datalen++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000013956 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillard57b25162004-11-06 14:50:18 +000013957 for (n_lst = 0;n_lst < gen_nb_xmlNodePtr_ptr;n_lst++) {
13958 mem_base = xmlMemBlocks();
13959 node = gen_xmlNodePtr(n_node, 0);
13960 data = gen_const_char_ptr(n_data, 1);
13961 datalen = gen_int(n_datalen, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000013962 options = gen_parseroptions(n_options, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000013963 lst = gen_xmlNodePtr_ptr(n_lst, 4);
13964
William M. Brackf13f77f2004-11-12 16:03:48 +000013965 ret_val = xmlParseInNodeContext(node, (const char *)data, datalen, options, lst);
Daniel Veillard57b25162004-11-06 14:50:18 +000013966 desret_xmlParserErrors(ret_val);
13967 call_tests++;
13968 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000013969 des_const_char_ptr(n_data, (const char *)data, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +000013970 des_int(n_datalen, datalen, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000013971 des_parseroptions(n_options, options, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000013972 des_xmlNodePtr_ptr(n_lst, lst, 4);
13973 xmlResetLastError();
13974 if (mem_base != xmlMemBlocks()) {
13975 printf("Leak of %d blocks found in xmlParseInNodeContext",
13976 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000013977 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000013978 printf(" %d", n_node);
13979 printf(" %d", n_data);
13980 printf(" %d", n_datalen);
13981 printf(" %d", n_options);
13982 printf(" %d", n_lst);
13983 printf("\n");
13984 }
13985 }
13986 }
13987 }
13988 }
13989 }
Daniel Veillard57b25162004-11-06 14:50:18 +000013990 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000013991
Daniel Veillard42595322004-11-08 10:52:06 +000013992 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000013993}
13994
13995
13996static int
13997test_xmlParseMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000013998 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000013999
William M. Brack21e4ef22005-01-02 09:53:13 +000014000#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014001#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000014002 int mem_base;
14003 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014004 char * buffer; /* an pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014005 int n_buffer;
14006 int size; /* the size of the array */
14007 int n_size;
14008
14009 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14010 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14011 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014012 buffer = gen_const_char_ptr(n_buffer, 0);
14013 size = gen_int(n_size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014014
William M. Brackf13f77f2004-11-12 16:03:48 +000014015 ret_val = xmlParseMemory((const char *)buffer, size);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014016 desret_xmlDocPtr(ret_val);
14017 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000014018 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000014019 des_int(n_size, size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014020 xmlResetLastError();
14021 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014022 printf("Leak of %d blocks found in xmlParseMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014023 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014024 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014025 printf(" %d", n_buffer);
14026 printf(" %d", n_size);
14027 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014028 }
14029 }
14030 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014031 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014032#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014033#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000014034
Daniel Veillard42595322004-11-08 10:52:06 +000014035 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014036}
14037
14038
Daniel Veillardce682bc2004-11-05 17:22:25 +000014039#define gen_nb_const_xmlParserNodeInfoPtr 1
14040static xmlParserNodeInfoPtr gen_const_xmlParserNodeInfoPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14041 return(NULL);
14042}
14043static void des_const_xmlParserNodeInfoPtr(int no ATTRIBUTE_UNUSED, const xmlParserNodeInfoPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14044}
14045
Daniel Veillardd93f6252004-11-02 15:53:51 +000014046static int
14047test_xmlParserAddNodeInfo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014048 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014049
Daniel Veillardce682bc2004-11-05 17:22:25 +000014050 int mem_base;
14051 xmlParserCtxtPtr ctxt; /* an XML parser context */
14052 int n_ctxt;
14053 xmlParserNodeInfoPtr info; /* a node info sequence pointer */
14054 int n_info;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014055
Daniel Veillardce682bc2004-11-05 17:22:25 +000014056 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
14057 for (n_info = 0;n_info < gen_nb_const_xmlParserNodeInfoPtr;n_info++) {
14058 mem_base = xmlMemBlocks();
14059 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
14060 info = gen_const_xmlParserNodeInfoPtr(n_info, 1);
14061
William M. Brackf13f77f2004-11-12 16:03:48 +000014062 xmlParserAddNodeInfo(ctxt, (const xmlParserNodeInfoPtr)info);
Daniel Veillardce682bc2004-11-05 17:22:25 +000014063 call_tests++;
14064 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000014065 des_const_xmlParserNodeInfoPtr(n_info, (const xmlParserNodeInfoPtr)info, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000014066 xmlResetLastError();
14067 if (mem_base != xmlMemBlocks()) {
14068 printf("Leak of %d blocks found in xmlParserAddNodeInfo",
14069 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014070 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014071 printf(" %d", n_ctxt);
14072 printf(" %d", n_info);
14073 printf("\n");
14074 }
14075 }
14076 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000014077 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014078
Daniel Veillard42595322004-11-08 10:52:06 +000014079 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014080}
14081
14082
Daniel Veillardce682bc2004-11-05 17:22:25 +000014083#define gen_nb_const_xmlParserCtxtPtr 1
14084static xmlParserCtxtPtr gen_const_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14085 return(NULL);
14086}
14087static void des_const_xmlParserCtxtPtr(int no ATTRIBUTE_UNUSED, const xmlParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14088}
14089
Daniel Veillarda521d282004-11-09 14:59:59 +000014090#define gen_nb_const_xmlNodePtr 1
14091static xmlNodePtr gen_const_xmlNodePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14092 return(NULL);
14093}
14094static void des_const_xmlNodePtr(int no ATTRIBUTE_UNUSED, const xmlNodePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14095}
14096
Daniel Veillardd93f6252004-11-02 15:53:51 +000014097static int
14098test_xmlParserFindNodeInfo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014099 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014100
William M. Brack094dd862004-11-14 14:28:34 +000014101 int mem_base;
14102 const xmlParserNodeInfo * ret_val;
14103 xmlParserCtxtPtr ctx; /* an XML parser context */
14104 int n_ctx;
14105 xmlNodePtr node; /* an XML node within the tree */
14106 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014107
William M. Brack094dd862004-11-14 14:28:34 +000014108 for (n_ctx = 0;n_ctx < gen_nb_const_xmlParserCtxtPtr;n_ctx++) {
14109 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
14110 mem_base = xmlMemBlocks();
14111 ctx = gen_const_xmlParserCtxtPtr(n_ctx, 0);
14112 node = gen_const_xmlNodePtr(n_node, 1);
14113
14114 ret_val = xmlParserFindNodeInfo((const xmlParserCtxtPtr)ctx, (const xmlNodePtr)node);
14115 desret_const_xmlParserNodeInfo_ptr(ret_val);
14116 call_tests++;
14117 des_const_xmlParserCtxtPtr(n_ctx, (const xmlParserCtxtPtr)ctx, 0);
14118 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 1);
14119 xmlResetLastError();
14120 if (mem_base != xmlMemBlocks()) {
14121 printf("Leak of %d blocks found in xmlParserFindNodeInfo",
14122 xmlMemBlocks() - mem_base);
14123 test_ret++;
14124 printf(" %d", n_ctx);
14125 printf(" %d", n_node);
14126 printf("\n");
14127 }
14128 }
14129 }
14130 function_tests++;
14131
Daniel Veillard42595322004-11-08 10:52:06 +000014132 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014133}
14134
14135
Daniel Veillardce682bc2004-11-05 17:22:25 +000014136#define gen_nb_const_xmlParserNodeInfoSeqPtr 1
14137static xmlParserNodeInfoSeqPtr gen_const_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14138 return(NULL);
14139}
14140static void des_const_xmlParserNodeInfoSeqPtr(int no ATTRIBUTE_UNUSED, const xmlParserNodeInfoSeqPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14141}
14142
Daniel Veillardd93f6252004-11-02 15:53:51 +000014143static int
14144test_xmlParserFindNodeInfoIndex(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014145 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014146
William M. Brack094dd862004-11-14 14:28:34 +000014147 int mem_base;
14148 unsigned long ret_val;
14149 xmlParserNodeInfoSeqPtr seq; /* a node info sequence pointer */
14150 int n_seq;
14151 xmlNodePtr node; /* an XML node pointer */
14152 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014153
William M. Brack094dd862004-11-14 14:28:34 +000014154 for (n_seq = 0;n_seq < gen_nb_const_xmlParserNodeInfoSeqPtr;n_seq++) {
14155 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
14156 mem_base = xmlMemBlocks();
14157 seq = gen_const_xmlParserNodeInfoSeqPtr(n_seq, 0);
14158 node = gen_const_xmlNodePtr(n_node, 1);
14159
14160 ret_val = xmlParserFindNodeInfoIndex((const xmlParserNodeInfoSeqPtr)seq, (const xmlNodePtr)node);
14161 desret_unsigned_long(ret_val);
14162 call_tests++;
14163 des_const_xmlParserNodeInfoSeqPtr(n_seq, (const xmlParserNodeInfoSeqPtr)seq, 0);
14164 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 1);
14165 xmlResetLastError();
14166 if (mem_base != xmlMemBlocks()) {
14167 printf("Leak of %d blocks found in xmlParserFindNodeInfoIndex",
14168 xmlMemBlocks() - mem_base);
14169 test_ret++;
14170 printf(" %d", n_seq);
14171 printf(" %d", n_node);
14172 printf("\n");
14173 }
14174 }
14175 }
14176 function_tests++;
14177
Daniel Veillard42595322004-11-08 10:52:06 +000014178 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014179}
14180
14181
Daniel Veillardce682bc2004-11-05 17:22:25 +000014182#define gen_nb_xmlParserInputPtr 1
14183static xmlParserInputPtr gen_xmlParserInputPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14184 return(NULL);
14185}
14186static void des_xmlParserInputPtr(int no ATTRIBUTE_UNUSED, xmlParserInputPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
14187}
14188
Daniel Veillardd93f6252004-11-02 15:53:51 +000014189static int
14190test_xmlParserInputGrow(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014191 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014192
Daniel Veillardce682bc2004-11-05 17:22:25 +000014193 int mem_base;
14194 int ret_val;
14195 xmlParserInputPtr in; /* an XML parser input */
14196 int n_in;
14197 int len; /* an indicative size for the lookahead */
14198 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014199
Daniel Veillardce682bc2004-11-05 17:22:25 +000014200 for (n_in = 0;n_in < gen_nb_xmlParserInputPtr;n_in++) {
14201 for (n_len = 0;n_len < gen_nb_int;n_len++) {
14202 mem_base = xmlMemBlocks();
14203 in = gen_xmlParserInputPtr(n_in, 0);
14204 len = gen_int(n_len, 1);
14205
14206 ret_val = xmlParserInputGrow(in, len);
14207 desret_int(ret_val);
14208 call_tests++;
14209 des_xmlParserInputPtr(n_in, in, 0);
14210 des_int(n_len, len, 1);
14211 xmlResetLastError();
14212 if (mem_base != xmlMemBlocks()) {
14213 printf("Leak of %d blocks found in xmlParserInputGrow",
14214 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014215 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014216 printf(" %d", n_in);
14217 printf(" %d", n_len);
14218 printf("\n");
14219 }
14220 }
14221 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000014222 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014223
Daniel Veillard42595322004-11-08 10:52:06 +000014224 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014225}
14226
14227
14228static int
14229test_xmlParserInputRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014230 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014231
Daniel Veillardce682bc2004-11-05 17:22:25 +000014232 int mem_base;
14233 int ret_val;
14234 xmlParserInputPtr in; /* an XML parser input */
14235 int n_in;
14236 int len; /* an indicative size for the lookahead */
14237 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014238
Daniel Veillardce682bc2004-11-05 17:22:25 +000014239 for (n_in = 0;n_in < gen_nb_xmlParserInputPtr;n_in++) {
14240 for (n_len = 0;n_len < gen_nb_int;n_len++) {
14241 mem_base = xmlMemBlocks();
14242 in = gen_xmlParserInputPtr(n_in, 0);
14243 len = gen_int(n_len, 1);
14244
14245 ret_val = xmlParserInputRead(in, len);
14246 desret_int(ret_val);
14247 call_tests++;
14248 des_xmlParserInputPtr(n_in, in, 0);
14249 des_int(n_len, len, 1);
14250 xmlResetLastError();
14251 if (mem_base != xmlMemBlocks()) {
14252 printf("Leak of %d blocks found in xmlParserInputRead",
14253 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014254 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014255 printf(" %d", n_in);
14256 printf(" %d", n_len);
14257 printf("\n");
14258 }
14259 }
14260 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000014261 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014262
Daniel Veillard42595322004-11-08 10:52:06 +000014263 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014264}
14265
14266
14267static int
14268test_xmlPedanticParserDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014269 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014270
14271 int mem_base;
14272 int ret_val;
14273 int val; /* int 0 or 1 */
14274 int n_val;
14275
14276 for (n_val = 0;n_val < gen_nb_int;n_val++) {
14277 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014278 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014279
14280 ret_val = xmlPedanticParserDefault(val);
14281 desret_int(ret_val);
14282 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014283 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014284 xmlResetLastError();
14285 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014286 printf("Leak of %d blocks found in xmlPedanticParserDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014287 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014288 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014289 printf(" %d", n_val);
14290 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014291 }
14292 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000014293 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014294
Daniel Veillard42595322004-11-08 10:52:06 +000014295 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014296}
14297
14298
14299static int
14300test_xmlReadDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014301 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014302
14303 int mem_base;
14304 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014305 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014306 int n_cur;
14307 const char * URL; /* the base URL to use for the document */
14308 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014309 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014310 int n_encoding;
14311 int options; /* a combination of xmlParserOption */
14312 int n_options;
14313
14314 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
14315 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
14316 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000014317 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000014318 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014319 cur = gen_const_xmlChar_ptr(n_cur, 0);
14320 URL = gen_filepath(n_URL, 1);
14321 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000014322 options = gen_parseroptions(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014323
William M. Brackf13f77f2004-11-12 16:03:48 +000014324 ret_val = xmlReadDoc((const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014325 desret_xmlDocPtr(ret_val);
14326 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000014327 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000014328 des_filepath(n_URL, URL, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000014329 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000014330 des_parseroptions(n_options, options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014331 xmlResetLastError();
14332 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014333 printf("Leak of %d blocks found in xmlReadDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014334 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014335 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014336 printf(" %d", n_cur);
14337 printf(" %d", n_URL);
14338 printf(" %d", n_encoding);
14339 printf(" %d", n_options);
14340 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014341 }
14342 }
14343 }
14344 }
14345 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000014346 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014347
Daniel Veillard42595322004-11-08 10:52:06 +000014348 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014349}
14350
14351
14352static int
14353test_xmlReadFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014354 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014355
14356 int mem_base;
14357 xmlDocPtr ret_val;
14358 const char * filename; /* a file or URL */
14359 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014360 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014361 int n_encoding;
14362 int options; /* a combination of xmlParserOption */
14363 int n_options;
14364
14365 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14366 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000014367 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000014368 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014369 filename = gen_filepath(n_filename, 0);
14370 encoding = gen_const_char_ptr(n_encoding, 1);
Daniel Veillard6128c012004-11-08 17:16:15 +000014371 options = gen_parseroptions(n_options, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014372
William M. Brackf13f77f2004-11-12 16:03:48 +000014373 ret_val = xmlReadFile(filename, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014374 desret_xmlDocPtr(ret_val);
14375 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014376 des_filepath(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000014377 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillard6128c012004-11-08 17:16:15 +000014378 des_parseroptions(n_options, options, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014379 xmlResetLastError();
14380 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014381 printf("Leak of %d blocks found in xmlReadFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014382 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014383 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014384 printf(" %d", n_filename);
14385 printf(" %d", n_encoding);
14386 printf(" %d", n_options);
14387 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014388 }
14389 }
14390 }
14391 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000014392 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014393
Daniel Veillard42595322004-11-08 10:52:06 +000014394 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014395}
14396
14397
14398static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000014399test_xmlReadMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014400 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014401
14402 int mem_base;
14403 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014404 char * buffer; /* a pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014405 int n_buffer;
14406 int size; /* the size of the array */
14407 int n_size;
14408 const char * URL; /* the base URL to use for the document */
14409 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014410 char * encoding; /* the document encoding, or NULL */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014411 int n_encoding;
14412 int options; /* a combination of xmlParserOption */
14413 int n_options;
14414
14415 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14416 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14417 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
14418 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000014419 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000014420 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014421 buffer = gen_const_char_ptr(n_buffer, 0);
14422 size = gen_int(n_size, 1);
14423 URL = gen_filepath(n_URL, 2);
14424 encoding = gen_const_char_ptr(n_encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000014425 options = gen_parseroptions(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014426
William M. Brackf13f77f2004-11-12 16:03:48 +000014427 ret_val = xmlReadMemory((const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014428 desret_xmlDocPtr(ret_val);
14429 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000014430 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000014431 des_int(n_size, size, 1);
14432 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000014433 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000014434 des_parseroptions(n_options, options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014435 xmlResetLastError();
14436 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014437 printf("Leak of %d blocks found in xmlReadMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014438 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014439 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014440 printf(" %d", n_buffer);
14441 printf(" %d", n_size);
14442 printf(" %d", n_URL);
14443 printf(" %d", n_encoding);
14444 printf(" %d", n_options);
14445 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014446 }
14447 }
14448 }
14449 }
14450 }
14451 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000014452 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014453
Daniel Veillard42595322004-11-08 10:52:06 +000014454 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014455}
14456
14457
14458static int
14459test_xmlRecoverDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014460 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014461
William M. Brack21e4ef22005-01-02 09:53:13 +000014462#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014463#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014464 int mem_base;
14465 xmlDocPtr ret_val;
14466 xmlChar * cur; /* a pointer to an array of xmlChar */
14467 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014468
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014469 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
14470 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014471 cur = gen_xmlChar_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014472
14473 ret_val = xmlRecoverDoc(cur);
14474 desret_xmlDocPtr(ret_val);
14475 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014476 des_xmlChar_ptr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014477 xmlResetLastError();
14478 if (mem_base != xmlMemBlocks()) {
14479 printf("Leak of %d blocks found in xmlRecoverDoc",
14480 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014481 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014482 printf(" %d", n_cur);
14483 printf("\n");
14484 }
14485 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014486 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014487#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014488#endif
Daniel Veillard8a32fe42004-11-02 22:10:16 +000014489
Daniel Veillard42595322004-11-08 10:52:06 +000014490 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014491}
14492
14493
14494static int
14495test_xmlRecoverFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014496 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014497
William M. Brack21e4ef22005-01-02 09:53:13 +000014498#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014499#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000014500 int mem_base;
14501 xmlDocPtr ret_val;
14502 const char * filename; /* the filename */
14503 int n_filename;
14504
14505 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14506 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014507 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014508
14509 ret_val = xmlRecoverFile(filename);
14510 desret_xmlDocPtr(ret_val);
14511 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000014512 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014513 xmlResetLastError();
14514 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014515 printf("Leak of %d blocks found in xmlRecoverFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014516 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014517 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014518 printf(" %d", n_filename);
14519 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014520 }
14521 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014522 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014523#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014524#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000014525
Daniel Veillard42595322004-11-08 10:52:06 +000014526 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014527}
14528
14529
14530static int
14531test_xmlRecoverMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014532 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014533
William M. Brack21e4ef22005-01-02 09:53:13 +000014534#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014535#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000014536 int mem_base;
14537 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014538 char * buffer; /* an pointer to a char array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000014539 int n_buffer;
14540 int size; /* the size of the array */
14541 int n_size;
14542
14543 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14544 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14545 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000014546 buffer = gen_const_char_ptr(n_buffer, 0);
14547 size = gen_int(n_size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014548
William M. Brackf13f77f2004-11-12 16:03:48 +000014549 ret_val = xmlRecoverMemory((const char *)buffer, size);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014550 desret_xmlDocPtr(ret_val);
14551 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000014552 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000014553 des_int(n_size, size, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014554 xmlResetLastError();
14555 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000014556 printf("Leak of %d blocks found in xmlRecoverMemory",
Daniel Veillardd93f6252004-11-02 15:53:51 +000014557 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014558 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000014559 printf(" %d", n_buffer);
14560 printf(" %d", n_size);
14561 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000014562 }
14563 }
14564 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014565 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014566#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014567#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000014568
Daniel Veillard42595322004-11-08 10:52:06 +000014569 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014570}
14571
14572
14573static int
14574test_xmlSAXParseDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014575 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014576
William M. Brack21e4ef22005-01-02 09:53:13 +000014577#if defined(LIBXML_VALID_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014578#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014579 int mem_base;
14580 xmlDtdPtr ret_val;
14581 xmlSAXHandlerPtr sax; /* the SAX handler block */
14582 int n_sax;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014583 xmlChar * ExternalID; /* a NAME* containing the External ID of the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000014584 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014585 xmlChar * SystemID; /* a NAME* containing the URL to the DTD */
Daniel Veillard34099b42004-11-04 17:34:35 +000014586 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014587
Daniel Veillard34099b42004-11-04 17:34:35 +000014588 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14589 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
14590 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
14591 mem_base = xmlMemBlocks();
14592 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14593 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 1);
14594 SystemID = gen_const_xmlChar_ptr(n_SystemID, 2);
14595
William M. Brackf13f77f2004-11-12 16:03:48 +000014596 ret_val = xmlSAXParseDTD(sax, (const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard34099b42004-11-04 17:34:35 +000014597 desret_xmlDtdPtr(ret_val);
14598 call_tests++;
14599 des_xmlSAXHandlerPtr(n_sax, sax, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000014600 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 1);
14601 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 2);
Daniel Veillard34099b42004-11-04 17:34:35 +000014602 xmlResetLastError();
14603 if (mem_base != xmlMemBlocks()) {
14604 printf("Leak of %d blocks found in xmlSAXParseDTD",
14605 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014606 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014607 printf(" %d", n_sax);
14608 printf(" %d", n_ExternalID);
14609 printf(" %d", n_SystemID);
14610 printf("\n");
14611 }
14612 }
14613 }
14614 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014615 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014616#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014617#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014618
Daniel Veillard42595322004-11-08 10:52:06 +000014619 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014620}
14621
14622
14623static int
14624test_xmlSAXParseDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014625 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014626
William M. Brack21e4ef22005-01-02 09:53:13 +000014627#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014628#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014629 int mem_base;
14630 xmlDocPtr ret_val;
14631 xmlSAXHandlerPtr sax; /* the SAX handler block */
14632 int n_sax;
14633 xmlChar * cur; /* a pointer to an array of xmlChar */
14634 int n_cur;
14635 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
14636 int n_recovery;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014637
Daniel Veillard34099b42004-11-04 17:34:35 +000014638 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14639 for (n_cur = 0;n_cur < gen_nb_xmlChar_ptr;n_cur++) {
14640 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14641 mem_base = xmlMemBlocks();
14642 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14643 cur = gen_xmlChar_ptr(n_cur, 1);
14644 recovery = gen_int(n_recovery, 2);
14645
14646 ret_val = xmlSAXParseDoc(sax, cur, recovery);
14647 desret_xmlDocPtr(ret_val);
14648 call_tests++;
14649 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14650 des_xmlChar_ptr(n_cur, cur, 1);
14651 des_int(n_recovery, recovery, 2);
14652 xmlResetLastError();
14653 if (mem_base != xmlMemBlocks()) {
14654 printf("Leak of %d blocks found in xmlSAXParseDoc",
14655 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014656 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014657 printf(" %d", n_sax);
14658 printf(" %d", n_cur);
14659 printf(" %d", n_recovery);
14660 printf("\n");
14661 }
14662 }
14663 }
14664 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014665 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014666#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014667#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014668
Daniel Veillard42595322004-11-08 10:52:06 +000014669 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014670}
14671
14672
14673static int
14674test_xmlSAXParseEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014675 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014676
William M. Brack21e4ef22005-01-02 09:53:13 +000014677#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014678#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014679 int mem_base;
14680 xmlDocPtr ret_val;
14681 xmlSAXHandlerPtr sax; /* the SAX handler block */
14682 int n_sax;
14683 const char * filename; /* the filename */
14684 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014685
Daniel Veillard34099b42004-11-04 17:34:35 +000014686 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14687 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14688 mem_base = xmlMemBlocks();
14689 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14690 filename = gen_filepath(n_filename, 1);
14691
14692 ret_val = xmlSAXParseEntity(sax, filename);
14693 desret_xmlDocPtr(ret_val);
14694 call_tests++;
14695 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14696 des_filepath(n_filename, filename, 1);
14697 xmlResetLastError();
14698 if (mem_base != xmlMemBlocks()) {
14699 printf("Leak of %d blocks found in xmlSAXParseEntity",
14700 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014701 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014702 printf(" %d", n_sax);
14703 printf(" %d", n_filename);
14704 printf("\n");
14705 }
14706 }
14707 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014708 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014709#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014710#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014711
Daniel Veillard42595322004-11-08 10:52:06 +000014712 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014713}
14714
14715
14716static int
14717test_xmlSAXParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014718 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014719
William M. Brack21e4ef22005-01-02 09:53:13 +000014720#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014721#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014722 int mem_base;
14723 xmlDocPtr ret_val;
14724 xmlSAXHandlerPtr sax; /* the SAX handler block */
14725 int n_sax;
14726 const char * filename; /* the filename */
14727 int n_filename;
14728 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
14729 int n_recovery;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014730
Daniel Veillard34099b42004-11-04 17:34:35 +000014731 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14732 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14733 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14734 mem_base = xmlMemBlocks();
14735 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14736 filename = gen_filepath(n_filename, 1);
14737 recovery = gen_int(n_recovery, 2);
14738
14739 ret_val = xmlSAXParseFile(sax, filename, recovery);
14740 desret_xmlDocPtr(ret_val);
14741 call_tests++;
14742 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14743 des_filepath(n_filename, filename, 1);
14744 des_int(n_recovery, recovery, 2);
14745 xmlResetLastError();
14746 if (mem_base != xmlMemBlocks()) {
14747 printf("Leak of %d blocks found in xmlSAXParseFile",
14748 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014749 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014750 printf(" %d", n_sax);
14751 printf(" %d", n_filename);
14752 printf(" %d", n_recovery);
14753 printf("\n");
14754 }
14755 }
14756 }
14757 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014758 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014759#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014760#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014761
Daniel Veillard42595322004-11-08 10:52:06 +000014762 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014763}
14764
14765
14766static int
14767test_xmlSAXParseFileWithData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014768 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014769
William M. Brack21e4ef22005-01-02 09:53:13 +000014770#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014771#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014772 int mem_base;
14773 xmlDocPtr ret_val;
14774 xmlSAXHandlerPtr sax; /* the SAX handler block */
14775 int n_sax;
14776 const char * filename; /* the filename */
14777 int n_filename;
14778 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
14779 int n_recovery;
14780 void * data; /* the userdata */
14781 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014782
Daniel Veillard34099b42004-11-04 17:34:35 +000014783 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14784 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14785 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14786 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
14787 mem_base = xmlMemBlocks();
14788 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14789 filename = gen_filepath(n_filename, 1);
14790 recovery = gen_int(n_recovery, 2);
14791 data = gen_userdata(n_data, 3);
14792
14793 ret_val = xmlSAXParseFileWithData(sax, filename, recovery, data);
14794 desret_xmlDocPtr(ret_val);
14795 call_tests++;
14796 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14797 des_filepath(n_filename, filename, 1);
14798 des_int(n_recovery, recovery, 2);
14799 des_userdata(n_data, data, 3);
14800 xmlResetLastError();
14801 if (mem_base != xmlMemBlocks()) {
14802 printf("Leak of %d blocks found in xmlSAXParseFileWithData",
14803 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014804 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014805 printf(" %d", n_sax);
14806 printf(" %d", n_filename);
14807 printf(" %d", n_recovery);
14808 printf(" %d", n_data);
14809 printf("\n");
14810 }
14811 }
14812 }
14813 }
14814 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014815 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014816#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014817#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014818
Daniel Veillard42595322004-11-08 10:52:06 +000014819 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014820}
14821
14822
14823static int
14824test_xmlSAXParseMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014825 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014826
William M. Brack21e4ef22005-01-02 09:53:13 +000014827#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014828#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014829 int mem_base;
14830 xmlDocPtr ret_val;
14831 xmlSAXHandlerPtr sax; /* the SAX handler block */
14832 int n_sax;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014833 char * buffer; /* an pointer to a char array */
Daniel Veillard34099b42004-11-04 17:34:35 +000014834 int n_buffer;
14835 int size; /* the size of the array */
14836 int n_size;
14837 int recovery; /* work in recovery mode, i.e. tries to read not Well Formed documents */
14838 int n_recovery;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014839
Daniel Veillard34099b42004-11-04 17:34:35 +000014840 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14841 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14842 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14843 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14844 mem_base = xmlMemBlocks();
14845 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14846 buffer = gen_const_char_ptr(n_buffer, 1);
14847 size = gen_int(n_size, 2);
14848 recovery = gen_int(n_recovery, 3);
14849
William M. Brackf13f77f2004-11-12 16:03:48 +000014850 ret_val = xmlSAXParseMemory(sax, (const char *)buffer, size, recovery);
Daniel Veillard34099b42004-11-04 17:34:35 +000014851 desret_xmlDocPtr(ret_val);
14852 call_tests++;
14853 des_xmlSAXHandlerPtr(n_sax, sax, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000014854 des_const_char_ptr(n_buffer, (const char *)buffer, 1);
Daniel Veillard34099b42004-11-04 17:34:35 +000014855 des_int(n_size, size, 2);
14856 des_int(n_recovery, recovery, 3);
14857 xmlResetLastError();
14858 if (mem_base != xmlMemBlocks()) {
14859 printf("Leak of %d blocks found in xmlSAXParseMemory",
14860 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014861 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014862 printf(" %d", n_sax);
14863 printf(" %d", n_buffer);
14864 printf(" %d", n_size);
14865 printf(" %d", n_recovery);
14866 printf("\n");
14867 }
14868 }
14869 }
14870 }
14871 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014872 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014873#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014874#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014875
Daniel Veillard42595322004-11-08 10:52:06 +000014876 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014877}
14878
14879
14880static int
14881test_xmlSAXParseMemoryWithData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014882 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014883
William M. Brack21e4ef22005-01-02 09:53:13 +000014884#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014885#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014886 int mem_base;
14887 xmlDocPtr ret_val;
14888 xmlSAXHandlerPtr sax; /* the SAX handler block */
14889 int n_sax;
Daniel Veillardce682bc2004-11-05 17:22:25 +000014890 char * buffer; /* an pointer to a char array */
Daniel Veillard34099b42004-11-04 17:34:35 +000014891 int n_buffer;
14892 int size; /* the size of the array */
14893 int n_size;
14894 int recovery; /* work in recovery mode, i.e. tries to read no Well Formed documents */
14895 int n_recovery;
14896 void * data; /* the userdata */
14897 int n_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014898
Daniel Veillard34099b42004-11-04 17:34:35 +000014899 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14900 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
14901 for (n_size = 0;n_size < gen_nb_int;n_size++) {
14902 for (n_recovery = 0;n_recovery < gen_nb_int;n_recovery++) {
14903 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
14904 mem_base = xmlMemBlocks();
14905 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14906 buffer = gen_const_char_ptr(n_buffer, 1);
14907 size = gen_int(n_size, 2);
14908 recovery = gen_int(n_recovery, 3);
14909 data = gen_userdata(n_data, 4);
14910
William M. Brackf13f77f2004-11-12 16:03:48 +000014911 ret_val = xmlSAXParseMemoryWithData(sax, (const char *)buffer, size, recovery, data);
Daniel Veillard34099b42004-11-04 17:34:35 +000014912 desret_xmlDocPtr(ret_val);
14913 call_tests++;
14914 des_xmlSAXHandlerPtr(n_sax, sax, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000014915 des_const_char_ptr(n_buffer, (const char *)buffer, 1);
Daniel Veillard34099b42004-11-04 17:34:35 +000014916 des_int(n_size, size, 2);
14917 des_int(n_recovery, recovery, 3);
14918 des_userdata(n_data, data, 4);
14919 xmlResetLastError();
14920 if (mem_base != xmlMemBlocks()) {
14921 printf("Leak of %d blocks found in xmlSAXParseMemoryWithData",
14922 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014923 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014924 printf(" %d", n_sax);
14925 printf(" %d", n_buffer);
14926 printf(" %d", n_size);
14927 printf(" %d", n_recovery);
14928 printf(" %d", n_data);
14929 printf("\n");
14930 }
14931 }
14932 }
14933 }
14934 }
14935 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014936 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014937#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014938#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014939
Daniel Veillard42595322004-11-08 10:52:06 +000014940 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014941}
14942
14943
14944static int
14945test_xmlSAXUserParseFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000014946 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014947
William M. Brack21e4ef22005-01-02 09:53:13 +000014948#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000014949#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000014950 int mem_base;
14951 int ret_val;
14952 xmlSAXHandlerPtr sax; /* a SAX handler */
14953 int n_sax;
14954 void * user_data; /* The user data returned on SAX callbacks */
14955 int n_user_data;
14956 const char * filename; /* a file name */
14957 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000014958
Daniel Veillard34099b42004-11-04 17:34:35 +000014959 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
14960 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
14961 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
14962 mem_base = xmlMemBlocks();
14963 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
14964 user_data = gen_userdata(n_user_data, 1);
14965 filename = gen_filepath(n_filename, 2);
Daniel Veillarda521d282004-11-09 14:59:59 +000014966
14967#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce244ad2004-11-05 10:03:46 +000014968 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
Daniel Veillarda521d282004-11-09 14:59:59 +000014969#endif
14970
Daniel Veillard34099b42004-11-04 17:34:35 +000014971
14972 ret_val = xmlSAXUserParseFile(sax, user_data, filename);
14973 desret_int(ret_val);
14974 call_tests++;
14975 des_xmlSAXHandlerPtr(n_sax, sax, 0);
14976 des_userdata(n_user_data, user_data, 1);
14977 des_filepath(n_filename, filename, 2);
14978 xmlResetLastError();
14979 if (mem_base != xmlMemBlocks()) {
14980 printf("Leak of %d blocks found in xmlSAXUserParseFile",
14981 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000014982 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000014983 printf(" %d", n_sax);
14984 printf(" %d", n_user_data);
14985 printf(" %d", n_filename);
14986 printf("\n");
14987 }
14988 }
14989 }
14990 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000014991 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000014992#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000014993#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000014994
Daniel Veillard42595322004-11-08 10:52:06 +000014995 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000014996}
14997
14998
14999static int
15000test_xmlSAXUserParseMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015001 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015002
William M. Brack21e4ef22005-01-02 09:53:13 +000015003#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000015004#ifdef LIBXML_SAX1_ENABLED
Daniel Veillard34099b42004-11-04 17:34:35 +000015005 int mem_base;
15006 int ret_val;
15007 xmlSAXHandlerPtr sax; /* a SAX handler */
15008 int n_sax;
15009 void * user_data; /* The user data returned on SAX callbacks */
15010 int n_user_data;
Daniel Veillardce682bc2004-11-05 17:22:25 +000015011 char * buffer; /* an in-memory XML document input */
Daniel Veillard34099b42004-11-04 17:34:35 +000015012 int n_buffer;
15013 int size; /* the length of the XML document in bytes */
15014 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015015
Daniel Veillard34099b42004-11-04 17:34:35 +000015016 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
15017 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
15018 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
15019 for (n_size = 0;n_size < gen_nb_int;n_size++) {
15020 mem_base = xmlMemBlocks();
15021 sax = gen_xmlSAXHandlerPtr(n_sax, 0);
15022 user_data = gen_userdata(n_user_data, 1);
15023 buffer = gen_const_char_ptr(n_buffer, 2);
15024 size = gen_int(n_size, 3);
Daniel Veillarda521d282004-11-09 14:59:59 +000015025
15026#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardce244ad2004-11-05 10:03:46 +000015027 if (sax == (xmlSAXHandlerPtr)&xmlDefaultSAXHandler) user_data = NULL;
Daniel Veillarda521d282004-11-09 14:59:59 +000015028#endif
15029
Daniel Veillard34099b42004-11-04 17:34:35 +000015030
William M. Brackf13f77f2004-11-12 16:03:48 +000015031 ret_val = xmlSAXUserParseMemory(sax, user_data, (const char *)buffer, size);
Daniel Veillard34099b42004-11-04 17:34:35 +000015032 desret_int(ret_val);
15033 call_tests++;
15034 des_xmlSAXHandlerPtr(n_sax, sax, 0);
15035 des_userdata(n_user_data, user_data, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000015036 des_const_char_ptr(n_buffer, (const char *)buffer, 2);
Daniel Veillard34099b42004-11-04 17:34:35 +000015037 des_int(n_size, size, 3);
15038 xmlResetLastError();
15039 if (mem_base != xmlMemBlocks()) {
15040 printf("Leak of %d blocks found in xmlSAXUserParseMemory",
15041 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015042 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000015043 printf(" %d", n_sax);
15044 printf(" %d", n_user_data);
15045 printf(" %d", n_buffer);
15046 printf(" %d", n_size);
15047 printf("\n");
15048 }
15049 }
15050 }
15051 }
15052 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015053 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000015054#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000015055#endif
Daniel Veillard34099b42004-11-04 17:34:35 +000015056
Daniel Veillard42595322004-11-08 10:52:06 +000015057 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015058}
15059
15060
15061static int
15062test_xmlSetExternalEntityLoader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015063 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015064
15065
15066 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000015067 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015068}
15069
15070
15071static int
15072test_xmlSetFeature(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015073 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015074
William M. Brack21e4ef22005-01-02 09:53:13 +000015075#if defined(LIBXML_LEGACY_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000015076#ifdef LIBXML_LEGACY_ENABLED
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015077 int mem_base;
15078 int ret_val;
15079 xmlParserCtxtPtr ctxt; /* an XML/HTML parser context */
15080 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000015081 char * name; /* the feature name */
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015082 int n_name;
15083 void * value; /* pointer to the location of the new value */
15084 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015085
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015086 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15087 for (n_name = 0;n_name < gen_nb_const_char_ptr;n_name++) {
15088 for (n_value = 0;n_value < gen_nb_void_ptr;n_value++) {
15089 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015090 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15091 name = gen_const_char_ptr(n_name, 1);
15092 value = gen_void_ptr(n_value, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015093
William M. Brackf13f77f2004-11-12 16:03:48 +000015094 ret_val = xmlSetFeature(ctxt, (const char *)name, value);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015095 desret_int(ret_val);
15096 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015097 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000015098 des_const_char_ptr(n_name, (const char *)name, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000015099 des_void_ptr(n_value, value, 2);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015100 xmlResetLastError();
15101 if (mem_base != xmlMemBlocks()) {
15102 printf("Leak of %d blocks found in xmlSetFeature",
15103 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015104 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015105 printf(" %d", n_ctxt);
15106 printf(" %d", n_name);
15107 printf(" %d", n_value);
15108 printf("\n");
15109 }
15110 }
15111 }
15112 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015113 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000015114#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000015115#endif
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000015116
Daniel Veillard42595322004-11-08 10:52:06 +000015117 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015118}
15119
15120
15121static int
15122test_xmlSetupParserForBuffer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015123 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015124
William M. Brack21e4ef22005-01-02 09:53:13 +000015125#if defined(LIBXML_SAX1_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000015126#ifdef LIBXML_SAX1_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000015127 int mem_base;
15128 xmlParserCtxtPtr ctxt; /* an XML parser context */
15129 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000015130 xmlChar * buffer; /* a xmlChar * buffer */
Daniel Veillardd93f6252004-11-02 15:53:51 +000015131 int n_buffer;
15132 const char * filename; /* a file name */
15133 int n_filename;
15134
15135 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15136 for (n_buffer = 0;n_buffer < gen_nb_const_xmlChar_ptr;n_buffer++) {
15137 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
15138 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015139 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15140 buffer = gen_const_xmlChar_ptr(n_buffer, 1);
15141 filename = gen_filepath(n_filename, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015142
William M. Brackf13f77f2004-11-12 16:03:48 +000015143 xmlSetupParserForBuffer(ctxt, (const xmlChar *)buffer, filename);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015144 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015145 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000015146 des_const_xmlChar_ptr(n_buffer, (const xmlChar *)buffer, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000015147 des_filepath(n_filename, filename, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015148 xmlResetLastError();
15149 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000015150 printf("Leak of %d blocks found in xmlSetupParserForBuffer",
Daniel Veillardd93f6252004-11-02 15:53:51 +000015151 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015152 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000015153 printf(" %d", n_ctxt);
15154 printf(" %d", n_buffer);
15155 printf(" %d", n_filename);
15156 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000015157 }
15158 }
15159 }
15160 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015161 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000015162#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000015163#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000015164
Daniel Veillard42595322004-11-08 10:52:06 +000015165 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015166}
15167
15168
15169static int
15170test_xmlStopParser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015171 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015172
William M. Brack21e4ef22005-01-02 09:53:13 +000015173#if defined(LIBXML_PUSH_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000015174#ifdef LIBXML_PUSH_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000015175 int mem_base;
15176 xmlParserCtxtPtr ctxt; /* an XML parser context */
15177 int n_ctxt;
15178
15179 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15180 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015181 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015182
15183 xmlStopParser(ctxt);
15184 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015185 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015186 xmlResetLastError();
15187 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000015188 printf("Leak of %d blocks found in xmlStopParser",
Daniel Veillardd93f6252004-11-02 15:53:51 +000015189 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015190 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000015191 printf(" %d", n_ctxt);
15192 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000015193 }
15194 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015195 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000015196#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000015197#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000015198
Daniel Veillard42595322004-11-08 10:52:06 +000015199 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015200}
15201
15202
15203static int
15204test_xmlSubstituteEntitiesDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015205 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015206
15207 int mem_base;
15208 int ret_val;
15209 int val; /* int 0 or 1 */
15210 int n_val;
15211
15212 for (n_val = 0;n_val < gen_nb_int;n_val++) {
15213 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000015214 val = gen_int(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015215
15216 ret_val = xmlSubstituteEntitiesDefault(val);
15217 desret_int(ret_val);
15218 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000015219 des_int(n_val, val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015220 xmlResetLastError();
15221 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000015222 printf("Leak of %d blocks found in xmlSubstituteEntitiesDefault",
Daniel Veillardd93f6252004-11-02 15:53:51 +000015223 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000015224 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000015225 printf(" %d", n_val);
15226 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000015227 }
15228 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000015229 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015230
Daniel Veillard42595322004-11-08 10:52:06 +000015231 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015232}
15233
15234static int
15235test_parser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000015236 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000015237
William M. Brack094dd862004-11-14 14:28:34 +000015238 if (quiet == 0) printf("Testing parser : 60 of 69 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000015239 test_ret += test_xmlByteConsumed();
15240 test_ret += test_xmlClearNodeInfoSeq();
15241 test_ret += test_xmlClearParserCtxt();
15242 test_ret += test_xmlCreateDocParserCtxt();
15243 test_ret += test_xmlCreatePushParserCtxt();
15244 test_ret += test_xmlCtxtReadDoc();
15245 test_ret += test_xmlCtxtReadFile();
15246 test_ret += test_xmlCtxtReadMemory();
15247 test_ret += test_xmlCtxtReset();
15248 test_ret += test_xmlCtxtResetPush();
15249 test_ret += test_xmlCtxtUseOptions();
15250 test_ret += test_xmlGetExternalEntityLoader();
15251 test_ret += test_xmlGetFeature();
15252 test_ret += test_xmlGetFeaturesList();
15253 test_ret += test_xmlIOParseDTD();
15254 test_ret += test_xmlInitNodeInfoSeq();
15255 test_ret += test_xmlInitParser();
15256 test_ret += test_xmlInitParserCtxt();
15257 test_ret += test_xmlKeepBlanksDefault();
15258 test_ret += test_xmlLineNumbersDefault();
15259 test_ret += test_xmlLoadExternalEntity();
15260 test_ret += test_xmlNewIOInputStream();
15261 test_ret += test_xmlNewParserCtxt();
15262 test_ret += test_xmlParseBalancedChunkMemory();
15263 test_ret += test_xmlParseBalancedChunkMemoryRecover();
15264 test_ret += test_xmlParseChunk();
15265 test_ret += test_xmlParseCtxtExternalEntity();
15266 test_ret += test_xmlParseDTD();
15267 test_ret += test_xmlParseDoc();
15268 test_ret += test_xmlParseDocument();
15269 test_ret += test_xmlParseEntity();
15270 test_ret += test_xmlParseExtParsedEnt();
15271 test_ret += test_xmlParseExternalEntity();
15272 test_ret += test_xmlParseFile();
15273 test_ret += test_xmlParseInNodeContext();
15274 test_ret += test_xmlParseMemory();
15275 test_ret += test_xmlParserAddNodeInfo();
15276 test_ret += test_xmlParserFindNodeInfo();
15277 test_ret += test_xmlParserFindNodeInfoIndex();
15278 test_ret += test_xmlParserInputGrow();
15279 test_ret += test_xmlParserInputRead();
15280 test_ret += test_xmlPedanticParserDefault();
15281 test_ret += test_xmlReadDoc();
15282 test_ret += test_xmlReadFile();
15283 test_ret += test_xmlReadMemory();
15284 test_ret += test_xmlRecoverDoc();
15285 test_ret += test_xmlRecoverFile();
15286 test_ret += test_xmlRecoverMemory();
15287 test_ret += test_xmlSAXParseDTD();
15288 test_ret += test_xmlSAXParseDoc();
15289 test_ret += test_xmlSAXParseEntity();
15290 test_ret += test_xmlSAXParseFile();
15291 test_ret += test_xmlSAXParseFileWithData();
15292 test_ret += test_xmlSAXParseMemory();
15293 test_ret += test_xmlSAXParseMemoryWithData();
15294 test_ret += test_xmlSAXUserParseFile();
15295 test_ret += test_xmlSAXUserParseMemory();
15296 test_ret += test_xmlSetExternalEntityLoader();
15297 test_ret += test_xmlSetFeature();
15298 test_ret += test_xmlSetupParserForBuffer();
15299 test_ret += test_xmlStopParser();
15300 test_ret += test_xmlSubstituteEntitiesDefault();
Daniel Veillardd93f6252004-11-02 15:53:51 +000015301
Daniel Veillard42595322004-11-08 10:52:06 +000015302 if (test_ret != 0)
15303 printf("Module parser: %d errors\n", test_ret);
15304 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000015305}
15306
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015307static int
15308test_htmlCreateFileParserCtxt(void) {
15309 int test_ret = 0;
15310
William M. Brack21e4ef22005-01-02 09:53:13 +000015311#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015312 int mem_base;
15313 htmlParserCtxtPtr ret_val;
15314 const char * filename; /* the filename */
15315 int n_filename;
15316 char * encoding; /* a free form C string describing the HTML document encoding, or NULL */
15317 int n_encoding;
15318
15319 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
15320 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
15321 mem_base = xmlMemBlocks();
15322 filename = gen_fileoutput(n_filename, 0);
15323 encoding = gen_const_char_ptr(n_encoding, 1);
15324
William M. Brackf13f77f2004-11-12 16:03:48 +000015325 ret_val = htmlCreateFileParserCtxt(filename, (const char *)encoding);
Daniel Veillarda521d282004-11-09 14:59:59 +000015326 desret_htmlParserCtxtPtr(ret_val);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015327 call_tests++;
15328 des_fileoutput(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000015329 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015330 xmlResetLastError();
15331 if (mem_base != xmlMemBlocks()) {
15332 printf("Leak of %d blocks found in htmlCreateFileParserCtxt",
15333 xmlMemBlocks() - mem_base);
15334 test_ret++;
15335 printf(" %d", n_filename);
15336 printf(" %d", n_encoding);
15337 printf("\n");
15338 }
15339 }
15340 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015341 function_tests++;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015342#endif
15343
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015344 return(test_ret);
15345}
15346
15347
15348static int
15349test_htmlInitAutoClose(void) {
15350 int test_ret = 0;
15351
William M. Brack21e4ef22005-01-02 09:53:13 +000015352#if defined(LIBXML_HTML_ENABLED)
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015353 int mem_base;
15354
15355 mem_base = xmlMemBlocks();
15356
15357 htmlInitAutoClose();
15358 call_tests++;
15359 xmlResetLastError();
15360 if (mem_base != xmlMemBlocks()) {
15361 printf("Leak of %d blocks found in htmlInitAutoClose",
15362 xmlMemBlocks() - mem_base);
15363 test_ret++;
15364 printf("\n");
15365 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015366 function_tests++;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015367#endif
15368
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015369 return(test_ret);
15370}
15371
15372
15373static int
15374test_inputPop(void) {
15375 int test_ret = 0;
15376
15377 int mem_base;
15378 xmlParserInputPtr ret_val;
15379 xmlParserCtxtPtr ctxt; /* an XML parser context */
15380 int n_ctxt;
15381
15382 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15383 mem_base = xmlMemBlocks();
15384 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15385
15386 ret_val = inputPop(ctxt);
15387 desret_xmlParserInputPtr(ret_val);
15388 call_tests++;
15389 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15390 xmlResetLastError();
15391 if (mem_base != xmlMemBlocks()) {
15392 printf("Leak of %d blocks found in inputPop",
15393 xmlMemBlocks() - mem_base);
15394 test_ret++;
15395 printf(" %d", n_ctxt);
15396 printf("\n");
15397 }
15398 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015399 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015400
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015401 return(test_ret);
15402}
15403
15404
15405static int
15406test_inputPush(void) {
15407 int test_ret = 0;
15408
15409 int mem_base;
15410 int ret_val;
15411 xmlParserCtxtPtr ctxt; /* an XML parser context */
15412 int n_ctxt;
15413 xmlParserInputPtr value; /* the parser input */
15414 int n_value;
15415
15416 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15417 for (n_value = 0;n_value < gen_nb_xmlParserInputPtr;n_value++) {
15418 mem_base = xmlMemBlocks();
15419 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15420 value = gen_xmlParserInputPtr(n_value, 1);
15421
15422 ret_val = inputPush(ctxt, value);
15423 desret_int(ret_val);
15424 call_tests++;
15425 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15426 des_xmlParserInputPtr(n_value, value, 1);
15427 xmlResetLastError();
15428 if (mem_base != xmlMemBlocks()) {
15429 printf("Leak of %d blocks found in inputPush",
15430 xmlMemBlocks() - mem_base);
15431 test_ret++;
15432 printf(" %d", n_ctxt);
15433 printf(" %d", n_value);
15434 printf("\n");
15435 }
15436 }
15437 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015438 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015439
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015440 return(test_ret);
15441}
15442
15443
15444static int
15445test_namePop(void) {
15446 int test_ret = 0;
15447
15448 int mem_base;
15449 const xmlChar * ret_val;
15450 xmlParserCtxtPtr ctxt; /* an XML parser context */
15451 int n_ctxt;
15452
15453 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15454 mem_base = xmlMemBlocks();
15455 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15456
15457 ret_val = namePop(ctxt);
15458 desret_const_xmlChar_ptr(ret_val);
15459 call_tests++;
15460 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15461 xmlResetLastError();
15462 if (mem_base != xmlMemBlocks()) {
15463 printf("Leak of %d blocks found in namePop",
15464 xmlMemBlocks() - mem_base);
15465 test_ret++;
15466 printf(" %d", n_ctxt);
15467 printf("\n");
15468 }
15469 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015470 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015471
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015472 return(test_ret);
15473}
15474
15475
15476static int
15477test_namePush(void) {
15478 int test_ret = 0;
15479
15480 int mem_base;
15481 int ret_val;
15482 xmlParserCtxtPtr ctxt; /* an XML parser context */
15483 int n_ctxt;
15484 xmlChar * value; /* the element name */
15485 int n_value;
15486
15487 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15488 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
15489 mem_base = xmlMemBlocks();
15490 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15491 value = gen_const_xmlChar_ptr(n_value, 1);
15492
William M. Brackf13f77f2004-11-12 16:03:48 +000015493 ret_val = namePush(ctxt, (const xmlChar *)value);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015494 desret_int(ret_val);
15495 call_tests++;
15496 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000015497 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015498 xmlResetLastError();
15499 if (mem_base != xmlMemBlocks()) {
15500 printf("Leak of %d blocks found in namePush",
15501 xmlMemBlocks() - mem_base);
15502 test_ret++;
15503 printf(" %d", n_ctxt);
15504 printf(" %d", n_value);
15505 printf("\n");
15506 }
15507 }
15508 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015509 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015510
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015511 return(test_ret);
15512}
15513
15514
15515static int
15516test_nodePop(void) {
15517 int test_ret = 0;
15518
15519 int mem_base;
15520 xmlNodePtr ret_val;
15521 xmlParserCtxtPtr ctxt; /* an XML parser context */
15522 int n_ctxt;
15523
15524 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15525 mem_base = xmlMemBlocks();
15526 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15527
15528 ret_val = nodePop(ctxt);
15529 desret_xmlNodePtr(ret_val);
15530 call_tests++;
15531 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15532 xmlResetLastError();
15533 if (mem_base != xmlMemBlocks()) {
15534 printf("Leak of %d blocks found in nodePop",
15535 xmlMemBlocks() - mem_base);
15536 test_ret++;
15537 printf(" %d", n_ctxt);
15538 printf("\n");
15539 }
15540 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015541 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015542
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015543 return(test_ret);
15544}
15545
15546
15547static int
15548test_nodePush(void) {
15549 int test_ret = 0;
15550
15551 int mem_base;
15552 int ret_val;
15553 xmlParserCtxtPtr ctxt; /* an XML parser context */
15554 int n_ctxt;
15555 xmlNodePtr value; /* the element node */
15556 int n_value;
15557
15558 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15559 for (n_value = 0;n_value < gen_nb_xmlNodePtr;n_value++) {
15560 mem_base = xmlMemBlocks();
15561 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15562 value = gen_xmlNodePtr(n_value, 1);
15563
15564 ret_val = nodePush(ctxt, value);
15565 desret_int(ret_val);
15566 call_tests++;
15567 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15568 des_xmlNodePtr(n_value, value, 1);
15569 xmlResetLastError();
15570 if (mem_base != xmlMemBlocks()) {
15571 printf("Leak of %d blocks found in nodePush",
15572 xmlMemBlocks() - mem_base);
15573 test_ret++;
15574 printf(" %d", n_ctxt);
15575 printf(" %d", n_value);
15576 printf("\n");
15577 }
15578 }
15579 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015580 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015581
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015582 return(test_ret);
15583}
15584
15585
15586static int
15587test_xmlCheckLanguageID(void) {
15588 int test_ret = 0;
15589
15590 int mem_base;
15591 int ret_val;
15592 xmlChar * lang; /* pointer to the string value */
15593 int n_lang;
15594
15595 for (n_lang = 0;n_lang < gen_nb_const_xmlChar_ptr;n_lang++) {
15596 mem_base = xmlMemBlocks();
15597 lang = gen_const_xmlChar_ptr(n_lang, 0);
15598
William M. Brackf13f77f2004-11-12 16:03:48 +000015599 ret_val = xmlCheckLanguageID((const xmlChar *)lang);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015600 desret_int(ret_val);
15601 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000015602 des_const_xmlChar_ptr(n_lang, (const xmlChar *)lang, 0);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015603 xmlResetLastError();
15604 if (mem_base != xmlMemBlocks()) {
15605 printf("Leak of %d blocks found in xmlCheckLanguageID",
15606 xmlMemBlocks() - mem_base);
15607 test_ret++;
15608 printf(" %d", n_lang);
15609 printf("\n");
15610 }
15611 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015612 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015613
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015614 return(test_ret);
15615}
15616
15617
15618static int
15619test_xmlCopyChar(void) {
15620 int test_ret = 0;
15621
15622 int mem_base;
15623 int ret_val;
15624 int len; /* Ignored, compatibility */
15625 int n_len;
15626 xmlChar * out; /* pointer to an array of xmlChar */
15627 int n_out;
15628 int val; /* the char value */
15629 int n_val;
15630
15631 for (n_len = 0;n_len < gen_nb_int;n_len++) {
15632 for (n_out = 0;n_out < gen_nb_xmlChar_ptr;n_out++) {
15633 for (n_val = 0;n_val < gen_nb_int;n_val++) {
15634 mem_base = xmlMemBlocks();
15635 len = gen_int(n_len, 0);
15636 out = gen_xmlChar_ptr(n_out, 1);
15637 val = gen_int(n_val, 2);
15638
15639 ret_val = xmlCopyChar(len, out, val);
15640 desret_int(ret_val);
15641 call_tests++;
15642 des_int(n_len, len, 0);
15643 des_xmlChar_ptr(n_out, out, 1);
15644 des_int(n_val, val, 2);
15645 xmlResetLastError();
15646 if (mem_base != xmlMemBlocks()) {
15647 printf("Leak of %d blocks found in xmlCopyChar",
15648 xmlMemBlocks() - mem_base);
15649 test_ret++;
15650 printf(" %d", n_len);
15651 printf(" %d", n_out);
15652 printf(" %d", n_val);
15653 printf("\n");
15654 }
15655 }
15656 }
15657 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015658 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015659
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015660 return(test_ret);
15661}
15662
15663
15664static int
15665test_xmlCopyCharMultiByte(void) {
15666 int test_ret = 0;
15667
15668 int mem_base;
15669 int ret_val;
15670 xmlChar * out; /* pointer to an array of xmlChar */
15671 int n_out;
15672 int val; /* the char value */
15673 int n_val;
15674
15675 for (n_out = 0;n_out < gen_nb_xmlChar_ptr;n_out++) {
15676 for (n_val = 0;n_val < gen_nb_int;n_val++) {
15677 mem_base = xmlMemBlocks();
15678 out = gen_xmlChar_ptr(n_out, 0);
15679 val = gen_int(n_val, 1);
15680
15681 ret_val = xmlCopyCharMultiByte(out, val);
15682 desret_int(ret_val);
15683 call_tests++;
15684 des_xmlChar_ptr(n_out, out, 0);
15685 des_int(n_val, val, 1);
15686 xmlResetLastError();
15687 if (mem_base != xmlMemBlocks()) {
15688 printf("Leak of %d blocks found in xmlCopyCharMultiByte",
15689 xmlMemBlocks() - mem_base);
15690 test_ret++;
15691 printf(" %d", n_out);
15692 printf(" %d", n_val);
15693 printf("\n");
15694 }
15695 }
15696 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015697 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015698
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015699 return(test_ret);
15700}
15701
15702
15703static int
15704test_xmlCreateEntityParserCtxt(void) {
15705 int test_ret = 0;
15706
15707 int mem_base;
15708 xmlParserCtxtPtr ret_val;
15709 xmlChar * URL; /* the entity URL */
15710 int n_URL;
15711 xmlChar * ID; /* the entity PUBLIC ID */
15712 int n_ID;
15713 xmlChar * base; /* a possible base for the target URI */
15714 int n_base;
15715
15716 for (n_URL = 0;n_URL < gen_nb_const_xmlChar_ptr;n_URL++) {
15717 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
15718 for (n_base = 0;n_base < gen_nb_const_xmlChar_ptr;n_base++) {
15719 mem_base = xmlMemBlocks();
15720 URL = gen_const_xmlChar_ptr(n_URL, 0);
15721 ID = gen_const_xmlChar_ptr(n_ID, 1);
15722 base = gen_const_xmlChar_ptr(n_base, 2);
15723
William M. Brackf13f77f2004-11-12 16:03:48 +000015724 ret_val = xmlCreateEntityParserCtxt((const xmlChar *)URL, (const xmlChar *)ID, (const xmlChar *)base);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015725 desret_xmlParserCtxtPtr(ret_val);
15726 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000015727 des_const_xmlChar_ptr(n_URL, (const xmlChar *)URL, 0);
15728 des_const_xmlChar_ptr(n_ID, (const xmlChar *)ID, 1);
15729 des_const_xmlChar_ptr(n_base, (const xmlChar *)base, 2);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015730 xmlResetLastError();
15731 if (mem_base != xmlMemBlocks()) {
15732 printf("Leak of %d blocks found in xmlCreateEntityParserCtxt",
15733 xmlMemBlocks() - mem_base);
15734 test_ret++;
15735 printf(" %d", n_URL);
15736 printf(" %d", n_ID);
15737 printf(" %d", n_base);
15738 printf("\n");
15739 }
15740 }
15741 }
15742 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015743 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015744
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015745 return(test_ret);
15746}
15747
15748
15749static int
15750test_xmlCreateFileParserCtxt(void) {
15751 int test_ret = 0;
15752
15753 int mem_base;
15754 xmlParserCtxtPtr ret_val;
15755 const char * filename; /* the filename */
15756 int n_filename;
15757
15758 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
15759 mem_base = xmlMemBlocks();
15760 filename = gen_fileoutput(n_filename, 0);
15761
15762 ret_val = xmlCreateFileParserCtxt(filename);
15763 desret_xmlParserCtxtPtr(ret_val);
15764 call_tests++;
15765 des_fileoutput(n_filename, filename, 0);
15766 xmlResetLastError();
15767 if (mem_base != xmlMemBlocks()) {
15768 printf("Leak of %d blocks found in xmlCreateFileParserCtxt",
15769 xmlMemBlocks() - mem_base);
15770 test_ret++;
15771 printf(" %d", n_filename);
15772 printf("\n");
15773 }
15774 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015775 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015776
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015777 return(test_ret);
15778}
15779
15780
15781static int
15782test_xmlCreateMemoryParserCtxt(void) {
15783 int test_ret = 0;
15784
15785 int mem_base;
15786 xmlParserCtxtPtr ret_val;
15787 char * buffer; /* a pointer to a char array */
15788 int n_buffer;
15789 int size; /* the size of the array */
15790 int n_size;
15791
15792 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
15793 for (n_size = 0;n_size < gen_nb_int;n_size++) {
15794 mem_base = xmlMemBlocks();
15795 buffer = gen_const_char_ptr(n_buffer, 0);
15796 size = gen_int(n_size, 1);
15797
William M. Brackf13f77f2004-11-12 16:03:48 +000015798 ret_val = xmlCreateMemoryParserCtxt((const char *)buffer, size);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015799 desret_xmlParserCtxtPtr(ret_val);
15800 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000015801 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015802 des_int(n_size, size, 1);
15803 xmlResetLastError();
15804 if (mem_base != xmlMemBlocks()) {
15805 printf("Leak of %d blocks found in xmlCreateMemoryParserCtxt",
15806 xmlMemBlocks() - mem_base);
15807 test_ret++;
15808 printf(" %d", n_buffer);
15809 printf(" %d", n_size);
15810 printf("\n");
15811 }
15812 }
15813 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015814 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015815
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015816 return(test_ret);
15817}
15818
15819
15820static int
15821test_xmlCreateURLParserCtxt(void) {
15822 int test_ret = 0;
15823
15824 int mem_base;
15825 xmlParserCtxtPtr ret_val;
15826 const char * filename; /* the filename or URL */
15827 int n_filename;
15828 int options; /* a combination of xmlParserOption */
15829 int n_options;
15830
15831 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
15832 for (n_options = 0;n_options < gen_nb_int;n_options++) {
15833 mem_base = xmlMemBlocks();
15834 filename = gen_fileoutput(n_filename, 0);
15835 options = gen_int(n_options, 1);
15836
15837 ret_val = xmlCreateURLParserCtxt(filename, options);
15838 desret_xmlParserCtxtPtr(ret_val);
15839 call_tests++;
15840 des_fileoutput(n_filename, filename, 0);
15841 des_int(n_options, options, 1);
15842 xmlResetLastError();
15843 if (mem_base != xmlMemBlocks()) {
15844 printf("Leak of %d blocks found in xmlCreateURLParserCtxt",
15845 xmlMemBlocks() - mem_base);
15846 test_ret++;
15847 printf(" %d", n_filename);
15848 printf(" %d", n_options);
15849 printf("\n");
15850 }
15851 }
15852 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015853 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015854
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015855 return(test_ret);
15856}
15857
15858
15859static int
15860test_xmlCurrentChar(void) {
15861 int test_ret = 0;
15862
15863 int mem_base;
15864 int ret_val;
15865 xmlParserCtxtPtr ctxt; /* the XML parser context */
15866 int n_ctxt;
15867 int * len; /* pointer to the length of the char read */
15868 int n_len;
15869
15870 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15871 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
15872 mem_base = xmlMemBlocks();
15873 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15874 len = gen_int_ptr(n_len, 1);
15875
15876 ret_val = xmlCurrentChar(ctxt, len);
15877 desret_int(ret_val);
15878 call_tests++;
15879 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15880 des_int_ptr(n_len, len, 1);
15881 xmlResetLastError();
15882 if (mem_base != xmlMemBlocks()) {
15883 printf("Leak of %d blocks found in xmlCurrentChar",
15884 xmlMemBlocks() - mem_base);
15885 test_ret++;
15886 printf(" %d", n_ctxt);
15887 printf(" %d", n_len);
15888 printf("\n");
15889 }
15890 }
15891 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015892 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015893
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015894 return(test_ret);
15895}
15896
15897
15898static int
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015899test_xmlErrMemory(void) {
15900 int test_ret = 0;
15901
15902 int mem_base;
15903 xmlParserCtxtPtr ctxt; /* an XML parser context */
15904 int n_ctxt;
15905 char * extra; /* extra informations */
15906 int n_extra;
15907
15908 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15909 for (n_extra = 0;n_extra < gen_nb_const_char_ptr;n_extra++) {
15910 mem_base = xmlMemBlocks();
15911 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15912 extra = gen_const_char_ptr(n_extra, 1);
15913
William M. Brackf13f77f2004-11-12 16:03:48 +000015914 xmlErrMemory(ctxt, (const char *)extra);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015915 call_tests++;
15916 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000015917 des_const_char_ptr(n_extra, (const char *)extra, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015918 xmlResetLastError();
15919 if (mem_base != xmlMemBlocks()) {
15920 printf("Leak of %d blocks found in xmlErrMemory",
15921 xmlMemBlocks() - mem_base);
15922 test_ret++;
15923 printf(" %d", n_ctxt);
15924 printf(" %d", n_extra);
15925 printf("\n");
15926 }
15927 }
15928 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015929 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015930
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015931 return(test_ret);
15932}
15933
15934
15935static int
15936test_xmlIsLetter(void) {
15937 int test_ret = 0;
15938
15939 int mem_base;
15940 int ret_val;
15941 int c; /* an unicode character (int) */
15942 int n_c;
15943
15944 for (n_c = 0;n_c < gen_nb_int;n_c++) {
15945 mem_base = xmlMemBlocks();
15946 c = gen_int(n_c, 0);
15947
15948 ret_val = xmlIsLetter(c);
15949 desret_int(ret_val);
15950 call_tests++;
15951 des_int(n_c, c, 0);
15952 xmlResetLastError();
15953 if (mem_base != xmlMemBlocks()) {
15954 printf("Leak of %d blocks found in xmlIsLetter",
15955 xmlMemBlocks() - mem_base);
15956 test_ret++;
15957 printf(" %d", n_c);
15958 printf("\n");
15959 }
15960 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015961 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000015962
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000015963 return(test_ret);
15964}
15965
15966
15967static int
15968test_xmlNewEntityInputStream(void) {
15969 int test_ret = 0;
15970
15971 int mem_base;
15972 xmlParserInputPtr ret_val;
15973 xmlParserCtxtPtr ctxt; /* an XML parser context */
15974 int n_ctxt;
15975 xmlEntityPtr entity; /* an Entity pointer */
15976 int n_entity;
15977
15978 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
15979 for (n_entity = 0;n_entity < gen_nb_xmlEntityPtr;n_entity++) {
15980 mem_base = xmlMemBlocks();
15981 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
15982 entity = gen_xmlEntityPtr(n_entity, 1);
15983
15984 ret_val = xmlNewEntityInputStream(ctxt, entity);
15985 desret_xmlParserInputPtr(ret_val);
15986 call_tests++;
15987 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
15988 des_xmlEntityPtr(n_entity, entity, 1);
15989 xmlResetLastError();
15990 if (mem_base != xmlMemBlocks()) {
15991 printf("Leak of %d blocks found in xmlNewEntityInputStream",
15992 xmlMemBlocks() - mem_base);
15993 test_ret++;
15994 printf(" %d", n_ctxt);
15995 printf(" %d", n_entity);
15996 printf("\n");
15997 }
15998 }
15999 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016000 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016001
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016002 return(test_ret);
16003}
16004
16005
16006static int
16007test_xmlNewInputFromFile(void) {
16008 int test_ret = 0;
16009
16010 int mem_base;
16011 xmlParserInputPtr ret_val;
16012 xmlParserCtxtPtr ctxt; /* an XML parser context */
16013 int n_ctxt;
16014 const char * filename; /* the filename to use as entity */
16015 int n_filename;
16016
16017 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16018 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
16019 mem_base = xmlMemBlocks();
16020 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16021 filename = gen_filepath(n_filename, 1);
16022
16023 ret_val = xmlNewInputFromFile(ctxt, filename);
16024 desret_xmlParserInputPtr(ret_val);
16025 call_tests++;
16026 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16027 des_filepath(n_filename, filename, 1);
16028 xmlResetLastError();
16029 if (mem_base != xmlMemBlocks()) {
16030 printf("Leak of %d blocks found in xmlNewInputFromFile",
16031 xmlMemBlocks() - mem_base);
16032 test_ret++;
16033 printf(" %d", n_ctxt);
16034 printf(" %d", n_filename);
16035 printf("\n");
16036 }
16037 }
16038 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016039 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016040
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016041 return(test_ret);
16042}
16043
16044
16045static int
16046test_xmlNewInputStream(void) {
16047 int test_ret = 0;
16048
16049 int mem_base;
16050 xmlParserInputPtr ret_val;
16051 xmlParserCtxtPtr ctxt; /* an XML parser context */
16052 int n_ctxt;
16053
16054 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16055 mem_base = xmlMemBlocks();
16056 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16057
16058 ret_val = xmlNewInputStream(ctxt);
16059 desret_xmlParserInputPtr(ret_val);
16060 call_tests++;
16061 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16062 xmlResetLastError();
16063 if (mem_base != xmlMemBlocks()) {
16064 printf("Leak of %d blocks found in xmlNewInputStream",
16065 xmlMemBlocks() - mem_base);
16066 test_ret++;
16067 printf(" %d", n_ctxt);
16068 printf("\n");
16069 }
16070 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016071 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016072
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016073 return(test_ret);
16074}
16075
16076
16077static int
16078test_xmlNewStringInputStream(void) {
16079 int test_ret = 0;
16080
16081 int mem_base;
16082 xmlParserInputPtr ret_val;
16083 xmlParserCtxtPtr ctxt; /* an XML parser context */
16084 int n_ctxt;
16085 xmlChar * buffer; /* an memory buffer */
16086 int n_buffer;
16087
16088 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16089 for (n_buffer = 0;n_buffer < gen_nb_const_xmlChar_ptr;n_buffer++) {
16090 mem_base = xmlMemBlocks();
16091 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16092 buffer = gen_const_xmlChar_ptr(n_buffer, 1);
16093
William M. Brackf13f77f2004-11-12 16:03:48 +000016094 ret_val = xmlNewStringInputStream(ctxt, (const xmlChar *)buffer);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016095 desret_xmlParserInputPtr(ret_val);
16096 call_tests++;
16097 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000016098 des_const_xmlChar_ptr(n_buffer, (const xmlChar *)buffer, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016099 xmlResetLastError();
16100 if (mem_base != xmlMemBlocks()) {
16101 printf("Leak of %d blocks found in xmlNewStringInputStream",
16102 xmlMemBlocks() - mem_base);
16103 test_ret++;
16104 printf(" %d", n_ctxt);
16105 printf(" %d", n_buffer);
16106 printf("\n");
16107 }
16108 }
16109 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016110 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016111
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016112 return(test_ret);
16113}
16114
16115
16116static int
16117test_xmlNextChar(void) {
16118 int test_ret = 0;
16119
16120 int mem_base;
16121 xmlParserCtxtPtr ctxt; /* the XML parser context */
16122 int n_ctxt;
16123
16124 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16125 mem_base = xmlMemBlocks();
16126 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16127
16128 xmlNextChar(ctxt);
16129 call_tests++;
16130 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16131 xmlResetLastError();
16132 if (mem_base != xmlMemBlocks()) {
16133 printf("Leak of %d blocks found in xmlNextChar",
16134 xmlMemBlocks() - mem_base);
16135 test_ret++;
16136 printf(" %d", n_ctxt);
16137 printf("\n");
16138 }
16139 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016140 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016141
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016142 return(test_ret);
16143}
16144
16145
16146static int
16147test_xmlParserInputShrink(void) {
16148 int test_ret = 0;
16149
16150 int mem_base;
16151 xmlParserInputPtr in; /* an XML parser input */
16152 int n_in;
16153
16154 for (n_in = 0;n_in < gen_nb_xmlParserInputPtr;n_in++) {
16155 mem_base = xmlMemBlocks();
16156 in = gen_xmlParserInputPtr(n_in, 0);
16157
16158 xmlParserInputShrink(in);
16159 call_tests++;
16160 des_xmlParserInputPtr(n_in, in, 0);
16161 xmlResetLastError();
16162 if (mem_base != xmlMemBlocks()) {
16163 printf("Leak of %d blocks found in xmlParserInputShrink",
16164 xmlMemBlocks() - mem_base);
16165 test_ret++;
16166 printf(" %d", n_in);
16167 printf("\n");
16168 }
16169 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016170 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016171
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016172 return(test_ret);
16173}
16174
16175
16176static int
16177test_xmlPopInput(void) {
16178 int test_ret = 0;
16179
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016180 int mem_base;
16181 xmlChar ret_val;
16182 xmlParserCtxtPtr ctxt; /* an XML parser context */
16183 int n_ctxt;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016184
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016185 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16186 mem_base = xmlMemBlocks();
16187 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16188
16189 ret_val = xmlPopInput(ctxt);
16190 desret_xmlChar(ret_val);
16191 call_tests++;
16192 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16193 xmlResetLastError();
16194 if (mem_base != xmlMemBlocks()) {
16195 printf("Leak of %d blocks found in xmlPopInput",
16196 xmlMemBlocks() - mem_base);
16197 test_ret++;
16198 printf(" %d", n_ctxt);
16199 printf("\n");
16200 }
16201 }
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016202 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016203
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016204 return(test_ret);
16205}
16206
16207
16208static int
16209test_xmlPushInput(void) {
16210 int test_ret = 0;
16211
16212 int mem_base;
16213 xmlParserCtxtPtr ctxt; /* an XML parser context */
16214 int n_ctxt;
16215 xmlParserInputPtr input; /* an XML parser input fragment (entity, XML fragment ...). */
16216 int n_input;
16217
16218 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16219 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
16220 mem_base = xmlMemBlocks();
16221 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16222 input = gen_xmlParserInputPtr(n_input, 1);
16223
16224 xmlPushInput(ctxt, input);
16225 call_tests++;
16226 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16227 des_xmlParserInputPtr(n_input, input, 1);
16228 xmlResetLastError();
16229 if (mem_base != xmlMemBlocks()) {
16230 printf("Leak of %d blocks found in xmlPushInput",
16231 xmlMemBlocks() - mem_base);
16232 test_ret++;
16233 printf(" %d", n_ctxt);
16234 printf(" %d", n_input);
16235 printf("\n");
16236 }
16237 }
16238 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016239 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016240
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016241 return(test_ret);
16242}
16243
16244
16245static int
16246test_xmlSetEntityReferenceFunc(void) {
16247 int test_ret = 0;
16248
16249
16250 /* missing type support */
16251 return(test_ret);
16252}
16253
16254
16255static int
16256test_xmlSplitQName(void) {
16257 int test_ret = 0;
16258
16259 int mem_base;
16260 xmlChar * ret_val;
16261 xmlParserCtxtPtr ctxt; /* an XML parser context */
16262 int n_ctxt;
16263 xmlChar * name; /* an XML parser context */
16264 int n_name;
16265 xmlChar ** prefix; /* a xmlChar ** */
16266 int n_prefix;
16267
16268 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16269 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
16270 for (n_prefix = 0;n_prefix < gen_nb_xmlChar_ptr_ptr;n_prefix++) {
16271 mem_base = xmlMemBlocks();
16272 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16273 name = gen_const_xmlChar_ptr(n_name, 1);
16274 prefix = gen_xmlChar_ptr_ptr(n_prefix, 2);
16275
William M. Brackf13f77f2004-11-12 16:03:48 +000016276 ret_val = xmlSplitQName(ctxt, (const xmlChar *)name, prefix);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016277 desret_xmlChar_ptr(ret_val);
16278 call_tests++;
16279 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000016280 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016281 des_xmlChar_ptr_ptr(n_prefix, prefix, 2);
16282 xmlResetLastError();
16283 if (mem_base != xmlMemBlocks()) {
16284 printf("Leak of %d blocks found in xmlSplitQName",
16285 xmlMemBlocks() - mem_base);
16286 test_ret++;
16287 printf(" %d", n_ctxt);
16288 printf(" %d", n_name);
16289 printf(" %d", n_prefix);
16290 printf("\n");
16291 }
16292 }
16293 }
16294 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016295 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016296
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016297 return(test_ret);
16298}
16299
16300
16301static int
16302test_xmlStringCurrentChar(void) {
16303 int test_ret = 0;
16304
16305 int mem_base;
16306 int ret_val;
16307 xmlParserCtxtPtr ctxt; /* the XML parser context */
16308 int n_ctxt;
16309 xmlChar * cur; /* pointer to the beginning of the char */
16310 int n_cur;
16311 int * len; /* pointer to the length of the char read */
16312 int n_len;
16313
16314 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16315 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
16316 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
16317 mem_base = xmlMemBlocks();
16318 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16319 cur = gen_const_xmlChar_ptr(n_cur, 1);
16320 len = gen_int_ptr(n_len, 2);
16321
William M. Brackf13f77f2004-11-12 16:03:48 +000016322 ret_val = xmlStringCurrentChar(ctxt, (const xmlChar *)cur, len);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016323 desret_int(ret_val);
16324 call_tests++;
16325 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000016326 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 1);
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016327 des_int_ptr(n_len, len, 2);
16328 xmlResetLastError();
16329 if (mem_base != xmlMemBlocks()) {
16330 printf("Leak of %d blocks found in xmlStringCurrentChar",
16331 xmlMemBlocks() - mem_base);
16332 test_ret++;
16333 printf(" %d", n_ctxt);
16334 printf(" %d", n_cur);
16335 printf(" %d", n_len);
16336 printf("\n");
16337 }
16338 }
16339 }
16340 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016341 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016342
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016343 return(test_ret);
16344}
16345
16346
16347static int
16348test_xmlStringDecodeEntities(void) {
16349 int test_ret = 0;
16350
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016351 int mem_base;
16352 xmlChar * ret_val;
16353 xmlParserCtxtPtr ctxt; /* the parser context */
16354 int n_ctxt;
16355 xmlChar * str; /* the input string */
16356 int n_str;
16357 int what; /* combination of XML_SUBSTITUTE_REF and XML_SUBSTITUTE_PEREF */
16358 int n_what;
16359 xmlChar end; /* an end marker xmlChar, 0 if none */
16360 int n_end;
16361 xmlChar end2; /* an end marker xmlChar, 0 if none */
16362 int n_end2;
16363 xmlChar end3; /* an end marker xmlChar, 0 if none */
16364 int n_end3;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016365
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016366 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16367 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
16368 for (n_what = 0;n_what < gen_nb_int;n_what++) {
16369 for (n_end = 0;n_end < gen_nb_xmlChar;n_end++) {
16370 for (n_end2 = 0;n_end2 < gen_nb_xmlChar;n_end2++) {
16371 for (n_end3 = 0;n_end3 < gen_nb_xmlChar;n_end3++) {
16372 mem_base = xmlMemBlocks();
16373 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16374 str = gen_const_xmlChar_ptr(n_str, 1);
16375 what = gen_int(n_what, 2);
16376 end = gen_xmlChar(n_end, 3);
16377 end2 = gen_xmlChar(n_end2, 4);
16378 end3 = gen_xmlChar(n_end3, 5);
16379
William M. Brackf13f77f2004-11-12 16:03:48 +000016380 ret_val = xmlStringDecodeEntities(ctxt, (const xmlChar *)str, what, end, end2, end3);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016381 desret_xmlChar_ptr(ret_val);
16382 call_tests++;
16383 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000016384 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016385 des_int(n_what, what, 2);
16386 des_xmlChar(n_end, end, 3);
16387 des_xmlChar(n_end2, end2, 4);
16388 des_xmlChar(n_end3, end3, 5);
16389 xmlResetLastError();
16390 if (mem_base != xmlMemBlocks()) {
16391 printf("Leak of %d blocks found in xmlStringDecodeEntities",
16392 xmlMemBlocks() - mem_base);
16393 test_ret++;
16394 printf(" %d", n_ctxt);
16395 printf(" %d", n_str);
16396 printf(" %d", n_what);
16397 printf(" %d", n_end);
16398 printf(" %d", n_end2);
16399 printf(" %d", n_end3);
16400 printf("\n");
16401 }
16402 }
16403 }
16404 }
16405 }
16406 }
16407 }
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016408 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016409
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016410 return(test_ret);
16411}
16412
16413
16414static int
16415test_xmlStringLenDecodeEntities(void) {
16416 int test_ret = 0;
16417
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016418 int mem_base;
16419 xmlChar * ret_val;
16420 xmlParserCtxtPtr ctxt; /* the parser context */
16421 int n_ctxt;
16422 xmlChar * str; /* the input string */
16423 int n_str;
16424 int len; /* the string length */
16425 int n_len;
16426 int what; /* combination of XML_SUBSTITUTE_REF and XML_SUBSTITUTE_PEREF */
16427 int n_what;
16428 xmlChar end; /* an end marker xmlChar, 0 if none */
16429 int n_end;
16430 xmlChar end2; /* an end marker xmlChar, 0 if none */
16431 int n_end2;
16432 xmlChar end3; /* an end marker xmlChar, 0 if none */
16433 int n_end3;
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016434
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016435 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16436 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
16437 for (n_len = 0;n_len < gen_nb_int;n_len++) {
16438 for (n_what = 0;n_what < gen_nb_int;n_what++) {
16439 for (n_end = 0;n_end < gen_nb_xmlChar;n_end++) {
16440 for (n_end2 = 0;n_end2 < gen_nb_xmlChar;n_end2++) {
16441 for (n_end3 = 0;n_end3 < gen_nb_xmlChar;n_end3++) {
16442 mem_base = xmlMemBlocks();
16443 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16444 str = gen_const_xmlChar_ptr(n_str, 1);
16445 len = gen_int(n_len, 2);
16446 what = gen_int(n_what, 3);
16447 end = gen_xmlChar(n_end, 4);
16448 end2 = gen_xmlChar(n_end2, 5);
16449 end3 = gen_xmlChar(n_end3, 6);
16450
William M. Brackf13f77f2004-11-12 16:03:48 +000016451 ret_val = xmlStringLenDecodeEntities(ctxt, (const xmlChar *)str, len, what, end, end2, end3);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016452 desret_xmlChar_ptr(ret_val);
16453 call_tests++;
16454 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000016455 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016456 des_int(n_len, len, 2);
16457 des_int(n_what, what, 3);
16458 des_xmlChar(n_end, end, 4);
16459 des_xmlChar(n_end2, end2, 5);
16460 des_xmlChar(n_end3, end3, 6);
16461 xmlResetLastError();
16462 if (mem_base != xmlMemBlocks()) {
16463 printf("Leak of %d blocks found in xmlStringLenDecodeEntities",
16464 xmlMemBlocks() - mem_base);
16465 test_ret++;
16466 printf(" %d", n_ctxt);
16467 printf(" %d", n_str);
16468 printf(" %d", n_len);
16469 printf(" %d", n_what);
16470 printf(" %d", n_end);
16471 printf(" %d", n_end2);
16472 printf(" %d", n_end3);
16473 printf("\n");
16474 }
16475 }
16476 }
16477 }
16478 }
16479 }
16480 }
16481 }
Daniel Veillardf2a36f92004-11-08 17:55:01 +000016482 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016483
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016484 return(test_ret);
16485}
16486
16487
16488static int
16489test_xmlSwitchEncoding(void) {
16490 int test_ret = 0;
16491
16492 int mem_base;
16493 int ret_val;
16494 xmlParserCtxtPtr ctxt; /* the parser context */
16495 int n_ctxt;
16496 xmlCharEncoding enc; /* the encoding value (number) */
16497 int n_enc;
16498
16499 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16500 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
16501 mem_base = xmlMemBlocks();
16502 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16503 enc = gen_xmlCharEncoding(n_enc, 1);
16504
16505 ret_val = xmlSwitchEncoding(ctxt, enc);
16506 desret_int(ret_val);
16507 call_tests++;
16508 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16509 des_xmlCharEncoding(n_enc, enc, 1);
16510 xmlResetLastError();
16511 if (mem_base != xmlMemBlocks()) {
16512 printf("Leak of %d blocks found in xmlSwitchEncoding",
16513 xmlMemBlocks() - mem_base);
16514 test_ret++;
16515 printf(" %d", n_ctxt);
16516 printf(" %d", n_enc);
16517 printf("\n");
16518 }
16519 }
16520 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016521 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016522
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016523 return(test_ret);
16524}
16525
16526
16527static int
16528test_xmlSwitchInputEncoding(void) {
16529 int test_ret = 0;
16530
16531 int mem_base;
16532 int ret_val;
16533 xmlParserCtxtPtr ctxt; /* the parser context */
16534 int n_ctxt;
16535 xmlParserInputPtr input; /* the input stream */
16536 int n_input;
16537 xmlCharEncodingHandlerPtr handler; /* the encoding handler */
16538 int n_handler;
16539
16540 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16541 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
16542 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandlerPtr;n_handler++) {
16543 mem_base = xmlMemBlocks();
16544 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16545 input = gen_xmlParserInputPtr(n_input, 1);
16546 handler = gen_xmlCharEncodingHandlerPtr(n_handler, 2);
16547
16548 ret_val = xmlSwitchInputEncoding(ctxt, input, handler);
16549 desret_int(ret_val);
16550 call_tests++;
16551 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16552 des_xmlParserInputPtr(n_input, input, 1);
16553 des_xmlCharEncodingHandlerPtr(n_handler, handler, 2);
16554 xmlResetLastError();
16555 if (mem_base != xmlMemBlocks()) {
16556 printf("Leak of %d blocks found in xmlSwitchInputEncoding",
16557 xmlMemBlocks() - mem_base);
16558 test_ret++;
16559 printf(" %d", n_ctxt);
16560 printf(" %d", n_input);
16561 printf(" %d", n_handler);
16562 printf("\n");
16563 }
16564 }
16565 }
16566 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016567 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016568
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016569 return(test_ret);
16570}
16571
16572
16573static int
16574test_xmlSwitchToEncoding(void) {
16575 int test_ret = 0;
16576
16577 int mem_base;
16578 int ret_val;
16579 xmlParserCtxtPtr ctxt; /* the parser context */
16580 int n_ctxt;
16581 xmlCharEncodingHandlerPtr handler; /* the encoding handler */
16582 int n_handler;
16583
16584 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
16585 for (n_handler = 0;n_handler < gen_nb_xmlCharEncodingHandlerPtr;n_handler++) {
16586 mem_base = xmlMemBlocks();
16587 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
16588 handler = gen_xmlCharEncodingHandlerPtr(n_handler, 1);
16589
16590 ret_val = xmlSwitchToEncoding(ctxt, handler);
16591 desret_int(ret_val);
16592 call_tests++;
16593 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
16594 des_xmlCharEncodingHandlerPtr(n_handler, handler, 1);
16595 xmlResetLastError();
16596 if (mem_base != xmlMemBlocks()) {
16597 printf("Leak of %d blocks found in xmlSwitchToEncoding",
16598 xmlMemBlocks() - mem_base);
16599 test_ret++;
16600 printf(" %d", n_ctxt);
16601 printf(" %d", n_handler);
16602 printf("\n");
16603 }
16604 }
16605 }
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016606 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016607
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016608 return(test_ret);
16609}
16610
16611static int
16612test_parserInternals(void) {
16613 int test_ret = 0;
16614
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016615 if (quiet == 0) printf("Testing parserInternals : 33 of 90 functions ...\n");
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016616 test_ret += test_htmlCreateFileParserCtxt();
16617 test_ret += test_htmlInitAutoClose();
16618 test_ret += test_inputPop();
16619 test_ret += test_inputPush();
16620 test_ret += test_namePop();
16621 test_ret += test_namePush();
16622 test_ret += test_nodePop();
16623 test_ret += test_nodePush();
16624 test_ret += test_xmlCheckLanguageID();
16625 test_ret += test_xmlCopyChar();
16626 test_ret += test_xmlCopyCharMultiByte();
16627 test_ret += test_xmlCreateEntityParserCtxt();
16628 test_ret += test_xmlCreateFileParserCtxt();
16629 test_ret += test_xmlCreateMemoryParserCtxt();
16630 test_ret += test_xmlCreateURLParserCtxt();
16631 test_ret += test_xmlCurrentChar();
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000016632 test_ret += test_xmlErrMemory();
16633 test_ret += test_xmlIsLetter();
16634 test_ret += test_xmlNewEntityInputStream();
16635 test_ret += test_xmlNewInputFromFile();
16636 test_ret += test_xmlNewInputStream();
16637 test_ret += test_xmlNewStringInputStream();
16638 test_ret += test_xmlNextChar();
16639 test_ret += test_xmlParserInputShrink();
16640 test_ret += test_xmlPopInput();
16641 test_ret += test_xmlPushInput();
16642 test_ret += test_xmlSetEntityReferenceFunc();
16643 test_ret += test_xmlSplitQName();
16644 test_ret += test_xmlStringCurrentChar();
16645 test_ret += test_xmlStringDecodeEntities();
16646 test_ret += test_xmlStringLenDecodeEntities();
16647 test_ret += test_xmlSwitchEncoding();
16648 test_ret += test_xmlSwitchInputEncoding();
16649 test_ret += test_xmlSwitchToEncoding();
16650
16651 if (test_ret != 0)
16652 printf("Module parserInternals: %d errors\n", test_ret);
16653 return(test_ret);
16654}
16655
Daniel Veillardd93f6252004-11-02 15:53:51 +000016656static int
16657test_xmlPatternMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016658 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016659
William M. Brack21e4ef22005-01-02 09:53:13 +000016660#if defined(LIBXML_PATTERN_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000016661 int mem_base;
16662 int ret_val;
16663 xmlPatternPtr comp; /* the precompiled pattern */
16664 int n_comp;
16665 xmlNodePtr node; /* a node */
16666 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016667
Daniel Veillardce682bc2004-11-05 17:22:25 +000016668 for (n_comp = 0;n_comp < gen_nb_xmlPatternPtr;n_comp++) {
16669 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
16670 mem_base = xmlMemBlocks();
16671 comp = gen_xmlPatternPtr(n_comp, 0);
16672 node = gen_xmlNodePtr(n_node, 1);
16673
16674 ret_val = xmlPatternMatch(comp, node);
16675 desret_int(ret_val);
16676 call_tests++;
16677 des_xmlPatternPtr(n_comp, comp, 0);
16678 des_xmlNodePtr(n_node, node, 1);
16679 xmlResetLastError();
16680 if (mem_base != xmlMemBlocks()) {
16681 printf("Leak of %d blocks found in xmlPatternMatch",
16682 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016683 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016684 printf(" %d", n_comp);
16685 printf(" %d", n_node);
16686 printf("\n");
16687 }
16688 }
16689 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016690 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016691#endif
16692
Daniel Veillard42595322004-11-08 10:52:06 +000016693 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016694}
16695
16696
16697static int
16698test_xmlPatterncompile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016699 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016700
16701
16702 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000016703 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016704}
16705
16706static int
16707test_pattern(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016708 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016709
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016710 if (quiet == 0) printf("Testing pattern : 1 of 4 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000016711 test_ret += test_xmlPatternMatch();
16712 test_ret += test_xmlPatterncompile();
Daniel Veillardd93f6252004-11-02 15:53:51 +000016713
Daniel Veillard42595322004-11-08 10:52:06 +000016714 if (test_ret != 0)
16715 printf("Module pattern: %d errors\n", test_ret);
16716 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016717}
Daniel Veillarda521d282004-11-09 14:59:59 +000016718#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000016719
Daniel Veillardce682bc2004-11-05 17:22:25 +000016720#define gen_nb_xmlRelaxNGPtr 1
16721static xmlRelaxNGPtr gen_xmlRelaxNGPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16722 return(NULL);
16723}
16724static void des_xmlRelaxNGPtr(int no ATTRIBUTE_UNUSED, xmlRelaxNGPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16725}
Daniel Veillarda521d282004-11-09 14:59:59 +000016726#endif
16727
Daniel Veillardce682bc2004-11-05 17:22:25 +000016728
Daniel Veillardd93f6252004-11-02 15:53:51 +000016729static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000016730test_xmlRelaxNGDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016731 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016732
William M. Brack21e4ef22005-01-02 09:53:13 +000016733#if defined(LIBXML_SCHEMAS_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000016734 int mem_base;
16735 FILE * output; /* the file output */
16736 int n_output;
16737 xmlRelaxNGPtr schema; /* a schema structure */
16738 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016739
Daniel Veillardce682bc2004-11-05 17:22:25 +000016740 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
16741 for (n_schema = 0;n_schema < gen_nb_xmlRelaxNGPtr;n_schema++) {
16742 mem_base = xmlMemBlocks();
16743 output = gen_FILE_ptr(n_output, 0);
16744 schema = gen_xmlRelaxNGPtr(n_schema, 1);
16745
16746 xmlRelaxNGDump(output, schema);
16747 call_tests++;
16748 des_FILE_ptr(n_output, output, 0);
16749 des_xmlRelaxNGPtr(n_schema, schema, 1);
16750 xmlResetLastError();
16751 if (mem_base != xmlMemBlocks()) {
16752 printf("Leak of %d blocks found in xmlRelaxNGDump",
16753 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016754 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016755 printf(" %d", n_output);
16756 printf(" %d", n_schema);
16757 printf("\n");
16758 }
16759 }
16760 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016761 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016762#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000016763
Daniel Veillard42595322004-11-08 10:52:06 +000016764 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016765}
16766
16767
16768static int
16769test_xmlRelaxNGDumpTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016770 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016771
William M. Brack21e4ef22005-01-02 09:53:13 +000016772#if defined(LIBXML_SCHEMAS_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000016773 int mem_base;
16774 FILE * output; /* the file output */
16775 int n_output;
16776 xmlRelaxNGPtr schema; /* a schema structure */
16777 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016778
Daniel Veillardce682bc2004-11-05 17:22:25 +000016779 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
16780 for (n_schema = 0;n_schema < gen_nb_xmlRelaxNGPtr;n_schema++) {
16781 mem_base = xmlMemBlocks();
16782 output = gen_FILE_ptr(n_output, 0);
16783 schema = gen_xmlRelaxNGPtr(n_schema, 1);
16784
16785 xmlRelaxNGDumpTree(output, schema);
16786 call_tests++;
16787 des_FILE_ptr(n_output, output, 0);
16788 des_xmlRelaxNGPtr(n_schema, schema, 1);
16789 xmlResetLastError();
16790 if (mem_base != xmlMemBlocks()) {
16791 printf("Leak of %d blocks found in xmlRelaxNGDumpTree",
16792 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016793 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016794 printf(" %d", n_output);
16795 printf(" %d", n_schema);
16796 printf("\n");
16797 }
16798 }
16799 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016800 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000016801#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000016802
Daniel Veillard42595322004-11-08 10:52:06 +000016803 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016804}
16805
Daniel Veillarda521d282004-11-09 14:59:59 +000016806#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000016807
Daniel Veillardce682bc2004-11-05 17:22:25 +000016808#define gen_nb_xmlRelaxNGParserCtxtPtr 1
16809static xmlRelaxNGParserCtxtPtr gen_xmlRelaxNGParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16810 return(NULL);
16811}
16812static void des_xmlRelaxNGParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlRelaxNGParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16813}
Daniel Veillarda521d282004-11-09 14:59:59 +000016814#endif
16815
16816#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000016817
16818#define gen_nb_xmlRelaxNGValidityErrorFunc_ptr 1
16819static xmlRelaxNGValidityErrorFunc * gen_xmlRelaxNGValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16820 return(NULL);
16821}
16822static void des_xmlRelaxNGValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidityErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16823}
Daniel Veillarda521d282004-11-09 14:59:59 +000016824#endif
16825
16826#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000016827
16828#define gen_nb_xmlRelaxNGValidityWarningFunc_ptr 1
16829static xmlRelaxNGValidityWarningFunc * gen_xmlRelaxNGValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16830 return(NULL);
16831}
16832static void des_xmlRelaxNGValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidityWarningFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16833}
Daniel Veillarda521d282004-11-09 14:59:59 +000016834#endif
16835
16836#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000016837
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016838#define gen_nb_void_ptr_ptr 1
16839static void ** gen_void_ptr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16840 return(NULL);
16841}
16842static void des_void_ptr_ptr(int no ATTRIBUTE_UNUSED, void ** val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16843}
Daniel Veillarda521d282004-11-09 14:59:59 +000016844#endif
16845
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016846
Daniel Veillardd93f6252004-11-02 15:53:51 +000016847static int
16848test_xmlRelaxNGGetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016849 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016850
William M. Brack21e4ef22005-01-02 09:53:13 +000016851#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016852 int mem_base;
16853 int ret_val;
16854 xmlRelaxNGParserCtxtPtr ctxt; /* a Relax-NG validation context */
16855 int n_ctxt;
16856 xmlRelaxNGValidityErrorFunc * err; /* the error callback result */
16857 int n_err;
16858 xmlRelaxNGValidityWarningFunc * warn; /* the warning callback result */
16859 int n_warn;
16860 void ** ctx; /* contextual data for the callbacks result */
16861 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016862
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016863 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGParserCtxtPtr;n_ctxt++) {
16864 for (n_err = 0;n_err < gen_nb_xmlRelaxNGValidityErrorFunc_ptr;n_err++) {
16865 for (n_warn = 0;n_warn < gen_nb_xmlRelaxNGValidityWarningFunc_ptr;n_warn++) {
16866 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
16867 mem_base = xmlMemBlocks();
16868 ctxt = gen_xmlRelaxNGParserCtxtPtr(n_ctxt, 0);
16869 err = gen_xmlRelaxNGValidityErrorFunc_ptr(n_err, 1);
16870 warn = gen_xmlRelaxNGValidityWarningFunc_ptr(n_warn, 2);
16871 ctx = gen_void_ptr_ptr(n_ctx, 3);
16872
16873 ret_val = xmlRelaxNGGetParserErrors(ctxt, err, warn, ctx);
16874 desret_int(ret_val);
16875 call_tests++;
16876 des_xmlRelaxNGParserCtxtPtr(n_ctxt, ctxt, 0);
16877 des_xmlRelaxNGValidityErrorFunc_ptr(n_err, err, 1);
16878 des_xmlRelaxNGValidityWarningFunc_ptr(n_warn, warn, 2);
16879 des_void_ptr_ptr(n_ctx, ctx, 3);
16880 xmlResetLastError();
16881 if (mem_base != xmlMemBlocks()) {
16882 printf("Leak of %d blocks found in xmlRelaxNGGetParserErrors",
16883 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016884 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016885 printf(" %d", n_ctxt);
16886 printf(" %d", n_err);
16887 printf(" %d", n_warn);
16888 printf(" %d", n_ctx);
16889 printf("\n");
16890 }
16891 }
16892 }
16893 }
16894 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016895 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016896#endif
16897
Daniel Veillard42595322004-11-08 10:52:06 +000016898 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016899}
16900
Daniel Veillarda521d282004-11-09 14:59:59 +000016901#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000016902
Daniel Veillardce682bc2004-11-05 17:22:25 +000016903#define gen_nb_xmlRelaxNGValidCtxtPtr 1
16904static xmlRelaxNGValidCtxtPtr gen_xmlRelaxNGValidCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16905 return(NULL);
16906}
16907static void des_xmlRelaxNGValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlRelaxNGValidCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
16908}
Daniel Veillarda521d282004-11-09 14:59:59 +000016909#endif
16910
Daniel Veillardce682bc2004-11-05 17:22:25 +000016911
Daniel Veillardd93f6252004-11-02 15:53:51 +000016912static int
16913test_xmlRelaxNGGetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016914 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016915
William M. Brack21e4ef22005-01-02 09:53:13 +000016916#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016917 int mem_base;
16918 int ret_val;
16919 xmlRelaxNGValidCtxtPtr ctxt; /* a Relax-NG validation context */
16920 int n_ctxt;
16921 xmlRelaxNGValidityErrorFunc * err; /* the error function result */
16922 int n_err;
16923 xmlRelaxNGValidityWarningFunc * warn; /* the warning function result */
16924 int n_warn;
16925 void ** ctx; /* the functions context result */
16926 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016927
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016928 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
16929 for (n_err = 0;n_err < gen_nb_xmlRelaxNGValidityErrorFunc_ptr;n_err++) {
16930 for (n_warn = 0;n_warn < gen_nb_xmlRelaxNGValidityWarningFunc_ptr;n_warn++) {
16931 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
16932 mem_base = xmlMemBlocks();
16933 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
16934 err = gen_xmlRelaxNGValidityErrorFunc_ptr(n_err, 1);
16935 warn = gen_xmlRelaxNGValidityWarningFunc_ptr(n_warn, 2);
16936 ctx = gen_void_ptr_ptr(n_ctx, 3);
16937
16938 ret_val = xmlRelaxNGGetValidErrors(ctxt, err, warn, ctx);
16939 desret_int(ret_val);
16940 call_tests++;
16941 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
16942 des_xmlRelaxNGValidityErrorFunc_ptr(n_err, err, 1);
16943 des_xmlRelaxNGValidityWarningFunc_ptr(n_warn, warn, 2);
16944 des_void_ptr_ptr(n_ctx, ctx, 3);
16945 xmlResetLastError();
16946 if (mem_base != xmlMemBlocks()) {
16947 printf("Leak of %d blocks found in xmlRelaxNGGetValidErrors",
16948 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016949 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016950 printf(" %d", n_ctxt);
16951 printf(" %d", n_err);
16952 printf(" %d", n_warn);
16953 printf(" %d", n_ctx);
16954 printf("\n");
16955 }
16956 }
16957 }
16958 }
16959 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016960 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000016961#endif
16962
Daniel Veillard42595322004-11-08 10:52:06 +000016963 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000016964}
16965
16966
16967static int
Daniel Veillard34099b42004-11-04 17:34:35 +000016968test_xmlRelaxNGInitTypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016969 int test_ret = 0;
Daniel Veillard34099b42004-11-04 17:34:35 +000016970
William M. Brack21e4ef22005-01-02 09:53:13 +000016971#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard34099b42004-11-04 17:34:35 +000016972 int mem_base;
16973 int ret_val;
16974
16975 mem_base = xmlMemBlocks();
16976
16977 ret_val = xmlRelaxNGInitTypes();
16978 desret_int(ret_val);
16979 call_tests++;
16980 xmlResetLastError();
16981 if (mem_base != xmlMemBlocks()) {
16982 printf("Leak of %d blocks found in xmlRelaxNGInitTypes",
16983 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000016984 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000016985 printf("\n");
16986 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000016987 function_tests++;
Daniel Veillard34099b42004-11-04 17:34:35 +000016988#endif
16989
Daniel Veillard42595322004-11-08 10:52:06 +000016990 return(test_ret);
Daniel Veillard34099b42004-11-04 17:34:35 +000016991}
16992
16993
16994static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000016995test_xmlRelaxNGNewDocParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000016996 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000016997
William M. Brack21e4ef22005-01-02 09:53:13 +000016998#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000016999 int mem_base;
17000 xmlRelaxNGParserCtxtPtr ret_val;
17001 xmlDocPtr doc; /* a preparsed document tree */
17002 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017003
Daniel Veillard42595322004-11-08 10:52:06 +000017004 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17005 mem_base = xmlMemBlocks();
17006 doc = gen_xmlDocPtr(n_doc, 0);
17007
17008 ret_val = xmlRelaxNGNewDocParserCtxt(doc);
17009 desret_xmlRelaxNGParserCtxtPtr(ret_val);
17010 call_tests++;
17011 des_xmlDocPtr(n_doc, doc, 0);
17012 xmlResetLastError();
17013 if (mem_base != xmlMemBlocks()) {
17014 printf("Leak of %d blocks found in xmlRelaxNGNewDocParserCtxt",
17015 xmlMemBlocks() - mem_base);
17016 test_ret++;
17017 printf(" %d", n_doc);
17018 printf("\n");
17019 }
17020 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017021 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017022#endif
17023
Daniel Veillard42595322004-11-08 10:52:06 +000017024 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017025}
17026
17027
17028static int
17029test_xmlRelaxNGNewMemParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017030 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017031
William M. Brack21e4ef22005-01-02 09:53:13 +000017032#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000017033 int mem_base;
17034 xmlRelaxNGParserCtxtPtr ret_val;
17035 char * buffer; /* a pointer to a char array containing the schemas */
17036 int n_buffer;
17037 int size; /* the size of the array */
17038 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017039
Daniel Veillard42595322004-11-08 10:52:06 +000017040 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
17041 for (n_size = 0;n_size < gen_nb_int;n_size++) {
17042 mem_base = xmlMemBlocks();
17043 buffer = gen_const_char_ptr(n_buffer, 0);
17044 size = gen_int(n_size, 1);
17045
William M. Brackf13f77f2004-11-12 16:03:48 +000017046 ret_val = xmlRelaxNGNewMemParserCtxt((const char *)buffer, size);
Daniel Veillard42595322004-11-08 10:52:06 +000017047 desret_xmlRelaxNGParserCtxtPtr(ret_val);
17048 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000017049 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard42595322004-11-08 10:52:06 +000017050 des_int(n_size, size, 1);
17051 xmlResetLastError();
17052 if (mem_base != xmlMemBlocks()) {
17053 printf("Leak of %d blocks found in xmlRelaxNGNewMemParserCtxt",
17054 xmlMemBlocks() - mem_base);
17055 test_ret++;
17056 printf(" %d", n_buffer);
17057 printf(" %d", n_size);
17058 printf("\n");
17059 }
17060 }
17061 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017062 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017063#endif
17064
Daniel Veillard42595322004-11-08 10:52:06 +000017065 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017066}
17067
17068
17069static int
17070test_xmlRelaxNGNewParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017071 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017072
William M. Brack21e4ef22005-01-02 09:53:13 +000017073#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000017074 int mem_base;
17075 xmlRelaxNGParserCtxtPtr ret_val;
17076 char * URL; /* the location of the schema */
17077 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017078
Daniel Veillard42595322004-11-08 10:52:06 +000017079 for (n_URL = 0;n_URL < gen_nb_const_char_ptr;n_URL++) {
17080 mem_base = xmlMemBlocks();
17081 URL = gen_const_char_ptr(n_URL, 0);
17082
William M. Brackf13f77f2004-11-12 16:03:48 +000017083 ret_val = xmlRelaxNGNewParserCtxt((const char *)URL);
Daniel Veillard42595322004-11-08 10:52:06 +000017084 desret_xmlRelaxNGParserCtxtPtr(ret_val);
17085 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000017086 des_const_char_ptr(n_URL, (const char *)URL, 0);
Daniel Veillard42595322004-11-08 10:52:06 +000017087 xmlResetLastError();
17088 if (mem_base != xmlMemBlocks()) {
17089 printf("Leak of %d blocks found in xmlRelaxNGNewParserCtxt",
17090 xmlMemBlocks() - mem_base);
17091 test_ret++;
17092 printf(" %d", n_URL);
17093 printf("\n");
17094 }
17095 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017096 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000017097#endif
17098
Daniel Veillard42595322004-11-08 10:52:06 +000017099 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017100}
17101
17102
17103static int
17104test_xmlRelaxNGNewValidCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017105 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017106
17107
17108 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017109 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017110}
17111
17112
17113static int
17114test_xmlRelaxNGParse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017115 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017116
17117
17118 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017119 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017120}
17121
17122
17123static int
17124test_xmlRelaxNGSetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017125 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017126
17127
17128 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017129 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017130}
17131
17132
17133static int
17134test_xmlRelaxNGSetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017135 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017136
17137
17138 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017139 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017140}
17141
17142
17143static int
17144test_xmlRelaxNGValidateDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017145 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017146
William M. Brack21e4ef22005-01-02 09:53:13 +000017147#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000017148 int mem_base;
17149 int ret_val;
17150 xmlRelaxNGValidCtxtPtr ctxt; /* a Relax-NG validation context */
17151 int n_ctxt;
17152 xmlDocPtr doc; /* a parsed document tree */
17153 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017154
Daniel Veillardce682bc2004-11-05 17:22:25 +000017155 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17156 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17157 mem_base = xmlMemBlocks();
17158 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17159 doc = gen_xmlDocPtr(n_doc, 1);
17160
17161 ret_val = xmlRelaxNGValidateDoc(ctxt, doc);
17162 desret_int(ret_val);
17163 call_tests++;
17164 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17165 des_xmlDocPtr(n_doc, doc, 1);
17166 xmlResetLastError();
17167 if (mem_base != xmlMemBlocks()) {
17168 printf("Leak of %d blocks found in xmlRelaxNGValidateDoc",
17169 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017170 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017171 printf(" %d", n_ctxt);
17172 printf(" %d", n_doc);
17173 printf("\n");
17174 }
17175 }
17176 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017177 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017178#endif
17179
Daniel Veillard42595322004-11-08 10:52:06 +000017180 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017181}
17182
17183
17184static int
17185test_xmlRelaxNGValidateFullElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017186 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017187
William M. Brack21e4ef22005-01-02 09:53:13 +000017188#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000017189 int mem_base;
17190 int ret_val;
17191 xmlRelaxNGValidCtxtPtr ctxt; /* the validation context */
17192 int n_ctxt;
17193 xmlDocPtr doc; /* a document instance */
17194 int n_doc;
17195 xmlNodePtr elem; /* an element instance */
17196 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017197
Daniel Veillardce682bc2004-11-05 17:22:25 +000017198 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17199 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17200 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
17201 mem_base = xmlMemBlocks();
17202 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17203 doc = gen_xmlDocPtr(n_doc, 1);
17204 elem = gen_xmlNodePtr(n_elem, 2);
17205
17206 ret_val = xmlRelaxNGValidateFullElement(ctxt, doc, elem);
17207 desret_int(ret_val);
17208 call_tests++;
17209 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17210 des_xmlDocPtr(n_doc, doc, 1);
17211 des_xmlNodePtr(n_elem, elem, 2);
17212 xmlResetLastError();
17213 if (mem_base != xmlMemBlocks()) {
17214 printf("Leak of %d blocks found in xmlRelaxNGValidateFullElement",
17215 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017216 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017217 printf(" %d", n_ctxt);
17218 printf(" %d", n_doc);
17219 printf(" %d", n_elem);
17220 printf("\n");
17221 }
17222 }
17223 }
17224 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017225 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017226#endif
17227
Daniel Veillard42595322004-11-08 10:52:06 +000017228 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017229}
17230
17231
17232static int
17233test_xmlRelaxNGValidatePopElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017234 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017235
William M. Brack21e4ef22005-01-02 09:53:13 +000017236#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000017237 int mem_base;
17238 int ret_val;
17239 xmlRelaxNGValidCtxtPtr ctxt; /* the RelaxNG validation context */
17240 int n_ctxt;
17241 xmlDocPtr doc; /* a document instance */
17242 int n_doc;
17243 xmlNodePtr elem; /* an element instance */
17244 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017245
Daniel Veillardce682bc2004-11-05 17:22:25 +000017246 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17247 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17248 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
17249 mem_base = xmlMemBlocks();
17250 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17251 doc = gen_xmlDocPtr(n_doc, 1);
17252 elem = gen_xmlNodePtr(n_elem, 2);
17253
17254 ret_val = xmlRelaxNGValidatePopElement(ctxt, doc, elem);
17255 desret_int(ret_val);
17256 call_tests++;
17257 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17258 des_xmlDocPtr(n_doc, doc, 1);
17259 des_xmlNodePtr(n_elem, elem, 2);
17260 xmlResetLastError();
17261 if (mem_base != xmlMemBlocks()) {
17262 printf("Leak of %d blocks found in xmlRelaxNGValidatePopElement",
17263 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017264 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017265 printf(" %d", n_ctxt);
17266 printf(" %d", n_doc);
17267 printf(" %d", n_elem);
17268 printf("\n");
17269 }
17270 }
17271 }
17272 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017273 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017274#endif
17275
Daniel Veillard42595322004-11-08 10:52:06 +000017276 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017277}
17278
17279
17280static int
17281test_xmlRelaxNGValidatePushCData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017282 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017283
William M. Brack21e4ef22005-01-02 09:53:13 +000017284#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000017285 int mem_base;
17286 int ret_val;
17287 xmlRelaxNGValidCtxtPtr ctxt; /* the RelaxNG validation context */
17288 int n_ctxt;
17289 xmlChar * data; /* some character data read */
17290 int n_data;
17291 int len; /* the lenght of the data */
17292 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017293
Daniel Veillardce682bc2004-11-05 17:22:25 +000017294 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17295 for (n_data = 0;n_data < gen_nb_const_xmlChar_ptr;n_data++) {
17296 for (n_len = 0;n_len < gen_nb_int;n_len++) {
17297 mem_base = xmlMemBlocks();
17298 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17299 data = gen_const_xmlChar_ptr(n_data, 1);
17300 len = gen_int(n_len, 2);
17301
William M. Brackf13f77f2004-11-12 16:03:48 +000017302 ret_val = xmlRelaxNGValidatePushCData(ctxt, (const xmlChar *)data, len);
Daniel Veillardce682bc2004-11-05 17:22:25 +000017303 desret_int(ret_val);
17304 call_tests++;
17305 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000017306 des_const_xmlChar_ptr(n_data, (const xmlChar *)data, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000017307 des_int(n_len, len, 2);
17308 xmlResetLastError();
17309 if (mem_base != xmlMemBlocks()) {
17310 printf("Leak of %d blocks found in xmlRelaxNGValidatePushCData",
17311 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017312 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017313 printf(" %d", n_ctxt);
17314 printf(" %d", n_data);
17315 printf(" %d", n_len);
17316 printf("\n");
17317 }
17318 }
17319 }
17320 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017321 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017322#endif
17323
Daniel Veillard42595322004-11-08 10:52:06 +000017324 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017325}
17326
17327
17328static int
17329test_xmlRelaxNGValidatePushElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017330 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017331
William M. Brack21e4ef22005-01-02 09:53:13 +000017332#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000017333 int mem_base;
17334 int ret_val;
17335 xmlRelaxNGValidCtxtPtr ctxt; /* the validation context */
17336 int n_ctxt;
17337 xmlDocPtr doc; /* a document instance */
17338 int n_doc;
17339 xmlNodePtr elem; /* an element instance */
17340 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017341
Daniel Veillardce682bc2004-11-05 17:22:25 +000017342 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGValidCtxtPtr;n_ctxt++) {
17343 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17344 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
17345 mem_base = xmlMemBlocks();
17346 ctxt = gen_xmlRelaxNGValidCtxtPtr(n_ctxt, 0);
17347 doc = gen_xmlDocPtr(n_doc, 1);
17348 elem = gen_xmlNodePtr(n_elem, 2);
17349
17350 ret_val = xmlRelaxNGValidatePushElement(ctxt, doc, elem);
17351 desret_int(ret_val);
17352 call_tests++;
17353 des_xmlRelaxNGValidCtxtPtr(n_ctxt, ctxt, 0);
17354 des_xmlDocPtr(n_doc, doc, 1);
17355 des_xmlNodePtr(n_elem, elem, 2);
17356 xmlResetLastError();
17357 if (mem_base != xmlMemBlocks()) {
17358 printf("Leak of %d blocks found in xmlRelaxNGValidatePushElement",
17359 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017360 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017361 printf(" %d", n_ctxt);
17362 printf(" %d", n_doc);
17363 printf(" %d", n_elem);
17364 printf("\n");
17365 }
17366 }
17367 }
17368 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017369 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017370#endif
17371
Daniel Veillard42595322004-11-08 10:52:06 +000017372 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017373}
17374
17375
17376static int
17377test_xmlRelaxParserSetFlag(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017378 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017379
William M. Brack21e4ef22005-01-02 09:53:13 +000017380#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000017381 int mem_base;
17382 int ret_val;
17383 xmlRelaxNGParserCtxtPtr ctxt; /* a RelaxNG parser context */
17384 int n_ctxt;
17385 int flags; /* a set of flags values */
17386 int n_flags;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017387
Daniel Veillardce682bc2004-11-05 17:22:25 +000017388 for (n_ctxt = 0;n_ctxt < gen_nb_xmlRelaxNGParserCtxtPtr;n_ctxt++) {
17389 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
17390 mem_base = xmlMemBlocks();
17391 ctxt = gen_xmlRelaxNGParserCtxtPtr(n_ctxt, 0);
17392 flags = gen_int(n_flags, 1);
17393
17394 ret_val = xmlRelaxParserSetFlag(ctxt, flags);
17395 desret_int(ret_val);
17396 call_tests++;
17397 des_xmlRelaxNGParserCtxtPtr(n_ctxt, ctxt, 0);
17398 des_int(n_flags, flags, 1);
17399 xmlResetLastError();
17400 if (mem_base != xmlMemBlocks()) {
17401 printf("Leak of %d blocks found in xmlRelaxParserSetFlag",
17402 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017403 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017404 printf(" %d", n_ctxt);
17405 printf(" %d", n_flags);
17406 printf("\n");
17407 }
17408 }
17409 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017410 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017411#endif
17412
Daniel Veillard42595322004-11-08 10:52:06 +000017413 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017414}
17415
17416static int
17417test_relaxng(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017418 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017419
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017420 if (quiet == 0) printf("Testing relaxng : 14 of 22 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000017421 test_ret += test_xmlRelaxNGDump();
17422 test_ret += test_xmlRelaxNGDumpTree();
17423 test_ret += test_xmlRelaxNGGetParserErrors();
17424 test_ret += test_xmlRelaxNGGetValidErrors();
17425 test_ret += test_xmlRelaxNGInitTypes();
17426 test_ret += test_xmlRelaxNGNewDocParserCtxt();
17427 test_ret += test_xmlRelaxNGNewMemParserCtxt();
17428 test_ret += test_xmlRelaxNGNewParserCtxt();
17429 test_ret += test_xmlRelaxNGNewValidCtxt();
17430 test_ret += test_xmlRelaxNGParse();
17431 test_ret += test_xmlRelaxNGSetParserErrors();
17432 test_ret += test_xmlRelaxNGSetValidErrors();
17433 test_ret += test_xmlRelaxNGValidateDoc();
17434 test_ret += test_xmlRelaxNGValidateFullElement();
17435 test_ret += test_xmlRelaxNGValidatePopElement();
17436 test_ret += test_xmlRelaxNGValidatePushCData();
17437 test_ret += test_xmlRelaxNGValidatePushElement();
17438 test_ret += test_xmlRelaxParserSetFlag();
Daniel Veillardd93f6252004-11-02 15:53:51 +000017439
Daniel Veillard42595322004-11-08 10:52:06 +000017440 if (test_ret != 0)
17441 printf("Module relaxng: %d errors\n", test_ret);
17442 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017443}
17444static int
17445test_schemasInternals(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017446 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017447
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017448 if (quiet == 0) printf("Testing schemasInternals : 0 of 2 functions ...\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017449
Daniel Veillard42595322004-11-08 10:52:06 +000017450 if (test_ret != 0)
17451 printf("Module schemasInternals: %d errors\n", test_ret);
17452 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017453}
17454
17455static int
17456test_xmlAddChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017457 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017458
17459 int mem_base;
17460 xmlNodePtr ret_val;
17461 xmlNodePtr parent; /* the parent node */
17462 int n_parent;
17463 xmlNodePtr cur; /* the child node */
17464 int n_cur;
17465
Daniel Veillarda03e3652004-11-02 18:45:30 +000017466 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017467 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) {
17468 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017469 parent = gen_xmlNodePtr(n_parent, 0);
17470 cur = gen_xmlNodePtr_in(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017471
17472 ret_val = xmlAddChild(parent, cur);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017473 if (ret_val == NULL) { xmlFreeNode(cur) ; cur = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017474 desret_xmlNodePtr(ret_val);
17475 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017476 des_xmlNodePtr(n_parent, parent, 0);
17477 des_xmlNodePtr_in(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017478 xmlResetLastError();
17479 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017480 printf("Leak of %d blocks found in xmlAddChild",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017481 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017482 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017483 printf(" %d", n_parent);
17484 printf(" %d", n_cur);
17485 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017486 }
17487 }
17488 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017489 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017490
Daniel Veillard42595322004-11-08 10:52:06 +000017491 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017492}
17493
17494
17495static int
17496test_xmlAddChildList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017497 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017498
17499 int mem_base;
17500 xmlNodePtr ret_val;
17501 xmlNodePtr parent; /* the parent node */
17502 int n_parent;
17503 xmlNodePtr cur; /* the first node in the list */
17504 int n_cur;
17505
Daniel Veillarda03e3652004-11-02 18:45:30 +000017506 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017507 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) {
17508 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017509 parent = gen_xmlNodePtr(n_parent, 0);
17510 cur = gen_xmlNodePtr_in(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017511
17512 ret_val = xmlAddChildList(parent, cur);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017513 if (ret_val == NULL) { xmlFreeNodeList(cur) ; cur = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017514 desret_xmlNodePtr(ret_val);
17515 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017516 des_xmlNodePtr(n_parent, parent, 0);
17517 des_xmlNodePtr_in(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017518 xmlResetLastError();
17519 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017520 printf("Leak of %d blocks found in xmlAddChildList",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017521 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017522 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017523 printf(" %d", n_parent);
17524 printf(" %d", n_cur);
17525 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017526 }
17527 }
17528 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017529 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017530
Daniel Veillard42595322004-11-08 10:52:06 +000017531 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017532}
17533
17534
17535static int
17536test_xmlAddNextSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017537 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017538
17539 int mem_base;
17540 xmlNodePtr ret_val;
17541 xmlNodePtr cur; /* the child node */
17542 int n_cur;
17543 xmlNodePtr elem; /* the new node */
17544 int n_elem;
17545
17546 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017547 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr_in;n_elem++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017548 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017549 cur = gen_xmlNodePtr(n_cur, 0);
17550 elem = gen_xmlNodePtr_in(n_elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017551
17552 ret_val = xmlAddNextSibling(cur, elem);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017553 if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017554 desret_xmlNodePtr(ret_val);
17555 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017556 des_xmlNodePtr(n_cur, cur, 0);
17557 des_xmlNodePtr_in(n_elem, elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017558 xmlResetLastError();
17559 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017560 printf("Leak of %d blocks found in xmlAddNextSibling",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017561 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017562 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017563 printf(" %d", n_cur);
17564 printf(" %d", n_elem);
17565 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017566 }
17567 }
17568 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017569 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017570
Daniel Veillard42595322004-11-08 10:52:06 +000017571 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017572}
17573
17574
17575static int
17576test_xmlAddPrevSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017577 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017578
William M. Brack21e4ef22005-01-02 09:53:13 +000017579#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000017580 int mem_base;
17581 xmlNodePtr ret_val;
17582 xmlNodePtr cur; /* the child node */
17583 int n_cur;
17584 xmlNodePtr elem; /* the new node */
17585 int n_elem;
17586
17587 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017588 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr_in;n_elem++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017589 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017590 cur = gen_xmlNodePtr(n_cur, 0);
17591 elem = gen_xmlNodePtr_in(n_elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017592
17593 ret_val = xmlAddPrevSibling(cur, elem);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017594 if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017595 desret_xmlNodePtr(ret_val);
17596 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017597 des_xmlNodePtr(n_cur, cur, 0);
17598 des_xmlNodePtr_in(n_elem, elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017599 xmlResetLastError();
17600 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017601 printf("Leak of %d blocks found in xmlAddPrevSibling",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017602 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017603 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017604 printf(" %d", n_cur);
17605 printf(" %d", n_elem);
17606 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017607 }
17608 }
17609 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017610 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017611#endif
17612
Daniel Veillard42595322004-11-08 10:52:06 +000017613 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017614}
17615
17616
17617static int
17618test_xmlAddSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017619 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017620
17621 int mem_base;
17622 xmlNodePtr ret_val;
17623 xmlNodePtr cur; /* the child node */
17624 int n_cur;
17625 xmlNodePtr elem; /* the new node */
17626 int n_elem;
17627
17628 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017629 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr_in;n_elem++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000017630 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017631 cur = gen_xmlNodePtr(n_cur, 0);
17632 elem = gen_xmlNodePtr_in(n_elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017633
17634 ret_val = xmlAddSibling(cur, elem);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000017635 if (ret_val == NULL) { xmlFreeNode(elem) ; elem = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000017636 desret_xmlNodePtr(ret_val);
17637 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017638 des_xmlNodePtr(n_cur, cur, 0);
17639 des_xmlNodePtr_in(n_elem, elem, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017640 xmlResetLastError();
17641 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000017642 printf("Leak of %d blocks found in xmlAddSibling",
Daniel Veillardd93f6252004-11-02 15:53:51 +000017643 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017644 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000017645 printf(" %d", n_cur);
17646 printf(" %d", n_elem);
17647 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000017648 }
17649 }
17650 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017651 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017652
Daniel Veillard42595322004-11-08 10:52:06 +000017653 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017654}
17655
17656
17657static int
17658test_xmlAttrSerializeTxtContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017659 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017660
William M. Brack21e4ef22005-01-02 09:53:13 +000017661#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000017662#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillardce244ad2004-11-05 10:03:46 +000017663 int mem_base;
17664 xmlBufferPtr buf; /* the XML buffer output */
17665 int n_buf;
17666 xmlDocPtr doc; /* the document */
17667 int n_doc;
17668 xmlAttrPtr attr; /* the attribute node */
17669 int n_attr;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017670 xmlChar * string; /* the text content */
Daniel Veillardce244ad2004-11-05 10:03:46 +000017671 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017672
Daniel Veillardce244ad2004-11-05 10:03:46 +000017673 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17674 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
17675 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
17676 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
17677 mem_base = xmlMemBlocks();
17678 buf = gen_xmlBufferPtr(n_buf, 0);
17679 doc = gen_xmlDocPtr(n_doc, 1);
17680 attr = gen_xmlAttrPtr(n_attr, 2);
17681 string = gen_const_xmlChar_ptr(n_string, 3);
17682
William M. Brackf13f77f2004-11-12 16:03:48 +000017683 xmlAttrSerializeTxtContent(buf, doc, attr, (const xmlChar *)string);
Daniel Veillardce244ad2004-11-05 10:03:46 +000017684 call_tests++;
17685 des_xmlBufferPtr(n_buf, buf, 0);
17686 des_xmlDocPtr(n_doc, doc, 1);
17687 des_xmlAttrPtr(n_attr, attr, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000017688 des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 3);
Daniel Veillardce244ad2004-11-05 10:03:46 +000017689 xmlResetLastError();
17690 if (mem_base != xmlMemBlocks()) {
17691 printf("Leak of %d blocks found in xmlAttrSerializeTxtContent",
17692 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017693 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000017694 printf(" %d", n_buf);
17695 printf(" %d", n_doc);
17696 printf(" %d", n_attr);
17697 printf(" %d", n_string);
17698 printf("\n");
17699 }
17700 }
17701 }
17702 }
17703 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017704 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000017705#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000017706#endif
Daniel Veillardce244ad2004-11-05 10:03:46 +000017707
Daniel Veillard42595322004-11-08 10:52:06 +000017708 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017709}
17710
17711
17712static int
17713test_xmlBufferAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017714 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017715
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017716 int mem_base;
17717 int ret_val;
17718 xmlBufferPtr buf; /* the buffer to dump */
17719 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017720 xmlChar * str; /* the #xmlChar string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017721 int n_str;
17722 int len; /* the number of #xmlChar to add */
17723 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017724
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017725 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17726 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
17727 for (n_len = 0;n_len < gen_nb_int;n_len++) {
17728 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017729 buf = gen_xmlBufferPtr(n_buf, 0);
17730 str = gen_const_xmlChar_ptr(n_str, 1);
17731 len = gen_int(n_len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017732
William M. Brackf13f77f2004-11-12 16:03:48 +000017733 ret_val = xmlBufferAdd(buf, (const xmlChar *)str, len);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017734 desret_int(ret_val);
17735 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017736 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000017737 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000017738 des_int(n_len, len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017739 xmlResetLastError();
17740 if (mem_base != xmlMemBlocks()) {
17741 printf("Leak of %d blocks found in xmlBufferAdd",
17742 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017743 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017744 printf(" %d", n_buf);
17745 printf(" %d", n_str);
17746 printf(" %d", n_len);
17747 printf("\n");
17748 }
17749 }
17750 }
17751 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017752 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017753
Daniel Veillard42595322004-11-08 10:52:06 +000017754 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017755}
17756
17757
17758static int
17759test_xmlBufferAddHead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017760 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017761
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017762 int mem_base;
17763 int ret_val;
17764 xmlBufferPtr buf; /* the buffer */
17765 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017766 xmlChar * str; /* the #xmlChar string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017767 int n_str;
17768 int len; /* the number of #xmlChar to add */
17769 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017770
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017771 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17772 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
17773 for (n_len = 0;n_len < gen_nb_int;n_len++) {
17774 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017775 buf = gen_xmlBufferPtr(n_buf, 0);
17776 str = gen_const_xmlChar_ptr(n_str, 1);
17777 len = gen_int(n_len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017778
William M. Brackf13f77f2004-11-12 16:03:48 +000017779 ret_val = xmlBufferAddHead(buf, (const xmlChar *)str, len);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017780 desret_int(ret_val);
17781 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017782 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000017783 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000017784 des_int(n_len, len, 2);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017785 xmlResetLastError();
17786 if (mem_base != xmlMemBlocks()) {
17787 printf("Leak of %d blocks found in xmlBufferAddHead",
17788 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017789 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017790 printf(" %d", n_buf);
17791 printf(" %d", n_str);
17792 printf(" %d", n_len);
17793 printf("\n");
17794 }
17795 }
17796 }
17797 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017798 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017799
Daniel Veillard42595322004-11-08 10:52:06 +000017800 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017801}
17802
17803
17804static int
17805test_xmlBufferCCat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017806 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017807
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017808 int mem_base;
17809 int ret_val;
17810 xmlBufferPtr buf; /* the buffer to dump */
17811 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017812 char * str; /* the C char string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017813 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017814
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017815 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17816 for (n_str = 0;n_str < gen_nb_const_char_ptr;n_str++) {
17817 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017818 buf = gen_xmlBufferPtr(n_buf, 0);
17819 str = gen_const_char_ptr(n_str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017820
William M. Brackf13f77f2004-11-12 16:03:48 +000017821 ret_val = xmlBufferCCat(buf, (const char *)str);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017822 desret_int(ret_val);
17823 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017824 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000017825 des_const_char_ptr(n_str, (const char *)str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017826 xmlResetLastError();
17827 if (mem_base != xmlMemBlocks()) {
17828 printf("Leak of %d blocks found in xmlBufferCCat",
17829 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017830 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017831 printf(" %d", n_buf);
17832 printf(" %d", n_str);
17833 printf("\n");
17834 }
17835 }
17836 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017837 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017838
Daniel Veillard42595322004-11-08 10:52:06 +000017839 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017840}
17841
17842
17843static int
17844test_xmlBufferCat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017845 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017846
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017847 int mem_base;
17848 int ret_val;
17849 xmlBufferPtr buf; /* the buffer to add to */
17850 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017851 xmlChar * str; /* the #xmlChar string */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017852 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017853
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017854 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17855 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
17856 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017857 buf = gen_xmlBufferPtr(n_buf, 0);
17858 str = gen_const_xmlChar_ptr(n_str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017859
William M. Brackf13f77f2004-11-12 16:03:48 +000017860 ret_val = xmlBufferCat(buf, (const xmlChar *)str);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017861 desret_int(ret_val);
17862 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017863 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000017864 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017865 xmlResetLastError();
17866 if (mem_base != xmlMemBlocks()) {
17867 printf("Leak of %d blocks found in xmlBufferCat",
17868 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017869 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017870 printf(" %d", n_buf);
17871 printf(" %d", n_str);
17872 printf("\n");
17873 }
17874 }
17875 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017876 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017877
Daniel Veillard42595322004-11-08 10:52:06 +000017878 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017879}
17880
17881
Daniel Veillardce682bc2004-11-05 17:22:25 +000017882#define gen_nb_const_xmlBufferPtr 1
17883static xmlBufferPtr gen_const_xmlBufferPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17884 return(NULL);
17885}
17886static void des_const_xmlBufferPtr(int no ATTRIBUTE_UNUSED, const xmlBufferPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
17887}
17888
Daniel Veillardd93f6252004-11-02 15:53:51 +000017889static int
17890test_xmlBufferContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017891 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017892
Daniel Veillardce682bc2004-11-05 17:22:25 +000017893 int mem_base;
17894 const xmlChar * ret_val;
17895 xmlBufferPtr buf; /* the buffer */
17896 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017897
Daniel Veillardce682bc2004-11-05 17:22:25 +000017898 for (n_buf = 0;n_buf < gen_nb_const_xmlBufferPtr;n_buf++) {
17899 mem_base = xmlMemBlocks();
17900 buf = gen_const_xmlBufferPtr(n_buf, 0);
17901
William M. Brackf13f77f2004-11-12 16:03:48 +000017902 ret_val = xmlBufferContent((const xmlBufferPtr)buf);
Daniel Veillardce682bc2004-11-05 17:22:25 +000017903 desret_const_xmlChar_ptr(ret_val);
17904 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000017905 des_const_xmlBufferPtr(n_buf, (const xmlBufferPtr)buf, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000017906 xmlResetLastError();
17907 if (mem_base != xmlMemBlocks()) {
17908 printf("Leak of %d blocks found in xmlBufferContent",
17909 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017910 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000017911 printf(" %d", n_buf);
17912 printf("\n");
17913 }
17914 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000017915 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017916
Daniel Veillard42595322004-11-08 10:52:06 +000017917 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017918}
17919
17920
17921static int
17922test_xmlBufferCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017923 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017924
Daniel Veillard3d95c732004-11-06 22:25:14 +000017925 int mem_base;
17926 xmlBufferPtr ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017927
Daniel Veillard3d95c732004-11-06 22:25:14 +000017928 mem_base = xmlMemBlocks();
17929
17930 ret_val = xmlBufferCreate();
17931 desret_xmlBufferPtr(ret_val);
17932 call_tests++;
17933 xmlResetLastError();
17934 if (mem_base != xmlMemBlocks()) {
17935 printf("Leak of %d blocks found in xmlBufferCreate",
17936 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017937 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000017938 printf("\n");
17939 }
Daniel Veillard3d95c732004-11-06 22:25:14 +000017940 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017941
Daniel Veillard42595322004-11-08 10:52:06 +000017942 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017943}
17944
17945
17946static int
17947test_xmlBufferCreateSize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017948 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017949
17950
17951 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017952 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017953}
17954
17955
17956static int
17957test_xmlBufferCreateStatic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017958 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017959
17960
17961 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000017962 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017963}
17964
17965
17966static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000017967test_xmlBufferEmpty(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017968 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017969
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017970 int mem_base;
17971 xmlBufferPtr buf; /* the buffer */
17972 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017973
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017974 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
17975 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000017976 buf = gen_xmlBufferPtr(n_buf, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017977
17978 xmlBufferEmpty(buf);
17979 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000017980 des_xmlBufferPtr(n_buf, buf, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017981 xmlResetLastError();
17982 if (mem_base != xmlMemBlocks()) {
17983 printf("Leak of %d blocks found in xmlBufferEmpty",
17984 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000017985 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000017986 printf(" %d", n_buf);
17987 printf("\n");
17988 }
17989 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000017990 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000017991
Daniel Veillard42595322004-11-08 10:52:06 +000017992 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000017993}
17994
17995
17996static int
17997test_xmlBufferGrow(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000017998 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000017999
Daniel Veillard3d97e662004-11-04 10:49:00 +000018000 int mem_base;
18001 int ret_val;
18002 xmlBufferPtr buf; /* the buffer */
18003 int n_buf;
18004 unsigned int len; /* the minimum free size to allocate */
18005 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018006
Daniel Veillard3d97e662004-11-04 10:49:00 +000018007 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18008 for (n_len = 0;n_len < gen_nb_unsigned_int;n_len++) {
18009 mem_base = xmlMemBlocks();
18010 buf = gen_xmlBufferPtr(n_buf, 0);
18011 len = gen_unsigned_int(n_len, 1);
18012
18013 ret_val = xmlBufferGrow(buf, len);
18014 desret_int(ret_val);
18015 call_tests++;
18016 des_xmlBufferPtr(n_buf, buf, 0);
18017 des_unsigned_int(n_len, len, 1);
18018 xmlResetLastError();
18019 if (mem_base != xmlMemBlocks()) {
18020 printf("Leak of %d blocks found in xmlBufferGrow",
18021 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018022 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018023 printf(" %d", n_buf);
18024 printf(" %d", n_len);
18025 printf("\n");
18026 }
18027 }
18028 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018029 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018030
Daniel Veillard42595322004-11-08 10:52:06 +000018031 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018032}
18033
18034
18035static int
18036test_xmlBufferLength(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018037 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018038
Daniel Veillardce682bc2004-11-05 17:22:25 +000018039 int mem_base;
18040 int ret_val;
18041 xmlBufferPtr buf; /* the buffer */
18042 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018043
Daniel Veillardce682bc2004-11-05 17:22:25 +000018044 for (n_buf = 0;n_buf < gen_nb_const_xmlBufferPtr;n_buf++) {
18045 mem_base = xmlMemBlocks();
18046 buf = gen_const_xmlBufferPtr(n_buf, 0);
18047
William M. Brackf13f77f2004-11-12 16:03:48 +000018048 ret_val = xmlBufferLength((const xmlBufferPtr)buf);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018049 desret_int(ret_val);
18050 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018051 des_const_xmlBufferPtr(n_buf, (const xmlBufferPtr)buf, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018052 xmlResetLastError();
18053 if (mem_base != xmlMemBlocks()) {
18054 printf("Leak of %d blocks found in xmlBufferLength",
18055 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018056 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018057 printf(" %d", n_buf);
18058 printf("\n");
18059 }
18060 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018061 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018062
Daniel Veillard42595322004-11-08 10:52:06 +000018063 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018064}
18065
18066
18067static int
18068test_xmlBufferResize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018069 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018070
Daniel Veillard3d97e662004-11-04 10:49:00 +000018071 int mem_base;
18072 int ret_val;
18073 xmlBufferPtr buf; /* the buffer to resize */
18074 int n_buf;
18075 unsigned int size; /* the desired size */
18076 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018077
Daniel Veillard3d97e662004-11-04 10:49:00 +000018078 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18079 for (n_size = 0;n_size < gen_nb_unsigned_int;n_size++) {
18080 mem_base = xmlMemBlocks();
18081 buf = gen_xmlBufferPtr(n_buf, 0);
18082 size = gen_unsigned_int(n_size, 1);
18083
18084 ret_val = xmlBufferResize(buf, size);
18085 desret_int(ret_val);
18086 call_tests++;
18087 des_xmlBufferPtr(n_buf, buf, 0);
18088 des_unsigned_int(n_size, size, 1);
18089 xmlResetLastError();
18090 if (mem_base != xmlMemBlocks()) {
18091 printf("Leak of %d blocks found in xmlBufferResize",
18092 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018093 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018094 printf(" %d", n_buf);
18095 printf(" %d", n_size);
18096 printf("\n");
18097 }
18098 }
18099 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018100 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018101
Daniel Veillard42595322004-11-08 10:52:06 +000018102 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018103}
18104
18105
18106static int
18107test_xmlBufferSetAllocationScheme(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018108 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018109
Daniel Veillard57b25162004-11-06 14:50:18 +000018110 int mem_base;
18111 xmlBufferPtr buf; /* the buffer to tune */
18112 int n_buf;
18113 xmlBufferAllocationScheme scheme; /* allocation scheme to use */
18114 int n_scheme;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018115
Daniel Veillard57b25162004-11-06 14:50:18 +000018116 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18117 for (n_scheme = 0;n_scheme < gen_nb_xmlBufferAllocationScheme;n_scheme++) {
18118 mem_base = xmlMemBlocks();
18119 buf = gen_xmlBufferPtr(n_buf, 0);
18120 scheme = gen_xmlBufferAllocationScheme(n_scheme, 1);
18121
18122 xmlBufferSetAllocationScheme(buf, scheme);
18123 call_tests++;
18124 des_xmlBufferPtr(n_buf, buf, 0);
18125 des_xmlBufferAllocationScheme(n_scheme, scheme, 1);
18126 xmlResetLastError();
18127 if (mem_base != xmlMemBlocks()) {
18128 printf("Leak of %d blocks found in xmlBufferSetAllocationScheme",
18129 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018130 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000018131 printf(" %d", n_buf);
18132 printf(" %d", n_scheme);
18133 printf("\n");
18134 }
18135 }
18136 }
Daniel Veillard57b25162004-11-06 14:50:18 +000018137 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018138
Daniel Veillard42595322004-11-08 10:52:06 +000018139 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018140}
18141
18142
18143static int
18144test_xmlBufferShrink(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018145 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018146
Daniel Veillard3d97e662004-11-04 10:49:00 +000018147 int mem_base;
18148 int ret_val;
18149 xmlBufferPtr buf; /* the buffer to dump */
18150 int n_buf;
18151 unsigned int len; /* the number of xmlChar to remove */
18152 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018153
Daniel Veillard3d97e662004-11-04 10:49:00 +000018154 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18155 for (n_len = 0;n_len < gen_nb_unsigned_int;n_len++) {
18156 mem_base = xmlMemBlocks();
18157 buf = gen_xmlBufferPtr(n_buf, 0);
18158 len = gen_unsigned_int(n_len, 1);
18159
18160 ret_val = xmlBufferShrink(buf, len);
18161 desret_int(ret_val);
18162 call_tests++;
18163 des_xmlBufferPtr(n_buf, buf, 0);
18164 des_unsigned_int(n_len, len, 1);
18165 xmlResetLastError();
18166 if (mem_base != xmlMemBlocks()) {
18167 printf("Leak of %d blocks found in xmlBufferShrink",
18168 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018169 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018170 printf(" %d", n_buf);
18171 printf(" %d", n_len);
18172 printf("\n");
18173 }
18174 }
18175 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018176 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018177
Daniel Veillard42595322004-11-08 10:52:06 +000018178 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018179}
18180
18181
18182static int
18183test_xmlBufferWriteCHAR(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018184 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018185
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018186 int mem_base;
18187 xmlBufferPtr buf; /* the XML buffer */
18188 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018189 xmlChar * string; /* the string to add */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018190 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018191
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018192 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18193 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
18194 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018195 buf = gen_xmlBufferPtr(n_buf, 0);
18196 string = gen_const_xmlChar_ptr(n_string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018197
William M. Brackf13f77f2004-11-12 16:03:48 +000018198 xmlBufferWriteCHAR(buf, (const xmlChar *)string);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018199 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018200 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018201 des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018202 xmlResetLastError();
18203 if (mem_base != xmlMemBlocks()) {
18204 printf("Leak of %d blocks found in xmlBufferWriteCHAR",
18205 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018206 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018207 printf(" %d", n_buf);
18208 printf(" %d", n_string);
18209 printf("\n");
18210 }
18211 }
18212 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018213 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018214
Daniel Veillard42595322004-11-08 10:52:06 +000018215 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018216}
18217
18218
18219static int
18220test_xmlBufferWriteChar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018221 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018222
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018223 int mem_base;
18224 xmlBufferPtr buf; /* the XML buffer output */
18225 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018226 char * string; /* the string to add */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018227 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018228
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018229 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18230 for (n_string = 0;n_string < gen_nb_const_char_ptr;n_string++) {
18231 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018232 buf = gen_xmlBufferPtr(n_buf, 0);
18233 string = gen_const_char_ptr(n_string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018234
William M. Brackf13f77f2004-11-12 16:03:48 +000018235 xmlBufferWriteChar(buf, (const char *)string);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018236 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018237 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018238 des_const_char_ptr(n_string, (const char *)string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018239 xmlResetLastError();
18240 if (mem_base != xmlMemBlocks()) {
18241 printf("Leak of %d blocks found in xmlBufferWriteChar",
18242 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018243 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018244 printf(" %d", n_buf);
18245 printf(" %d", n_string);
18246 printf("\n");
18247 }
18248 }
18249 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018250 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018251
Daniel Veillard42595322004-11-08 10:52:06 +000018252 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018253}
18254
18255
18256static int
18257test_xmlBufferWriteQuotedString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018258 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018259
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018260 int mem_base;
18261 xmlBufferPtr buf; /* the XML buffer output */
18262 int n_buf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018263 xmlChar * string; /* the string to add */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018264 int n_string;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018265
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018266 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
18267 for (n_string = 0;n_string < gen_nb_const_xmlChar_ptr;n_string++) {
18268 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018269 buf = gen_xmlBufferPtr(n_buf, 0);
18270 string = gen_const_xmlChar_ptr(n_string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018271
William M. Brackf13f77f2004-11-12 16:03:48 +000018272 xmlBufferWriteQuotedString(buf, (const xmlChar *)string);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018273 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018274 des_xmlBufferPtr(n_buf, buf, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018275 des_const_xmlChar_ptr(n_string, (const xmlChar *)string, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018276 xmlResetLastError();
18277 if (mem_base != xmlMemBlocks()) {
18278 printf("Leak of %d blocks found in xmlBufferWriteQuotedString",
18279 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018280 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000018281 printf(" %d", n_buf);
18282 printf(" %d", n_string);
18283 printf("\n");
18284 }
18285 }
18286 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018287 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018288
Daniel Veillard42595322004-11-08 10:52:06 +000018289 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018290}
18291
18292
18293static int
18294test_xmlBuildQName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018295 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018296
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018297 int mem_base;
18298 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018299 xmlChar * ncname; /* the Name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018300 int n_ncname;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018301 xmlChar * prefix; /* the prefix */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018302 int n_prefix;
18303 xmlChar * memory; /* preallocated memory */
18304 int n_memory;
18305 int len; /* preallocated memory length */
18306 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018307
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018308 for (n_ncname = 0;n_ncname < gen_nb_const_xmlChar_ptr;n_ncname++) {
18309 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
18310 for (n_memory = 0;n_memory < gen_nb_xmlChar_ptr;n_memory++) {
18311 for (n_len = 0;n_len < gen_nb_int;n_len++) {
18312 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018313 ncname = gen_const_xmlChar_ptr(n_ncname, 0);
18314 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
18315 memory = gen_xmlChar_ptr(n_memory, 2);
18316 len = gen_int(n_len, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018317
William M. Brackf13f77f2004-11-12 16:03:48 +000018318 ret_val = xmlBuildQName((const xmlChar *)ncname, (const xmlChar *)prefix, memory, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018319 if ((ret_val != NULL) && (ret_val != ncname) &&
18320 (ret_val != prefix) && (ret_val != memory))
18321 xmlFree(ret_val);
18322 ret_val = NULL;
18323 desret_xmlChar_ptr(ret_val);
18324 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018325 des_const_xmlChar_ptr(n_ncname, (const xmlChar *)ncname, 0);
18326 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000018327 des_xmlChar_ptr(n_memory, memory, 2);
18328 des_int(n_len, len, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018329 xmlResetLastError();
18330 if (mem_base != xmlMemBlocks()) {
18331 printf("Leak of %d blocks found in xmlBuildQName",
18332 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018333 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000018334 printf(" %d", n_ncname);
18335 printf(" %d", n_prefix);
18336 printf(" %d", n_memory);
18337 printf(" %d", n_len);
18338 printf("\n");
18339 }
18340 }
18341 }
18342 }
18343 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000018344 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018345
Daniel Veillard42595322004-11-08 10:52:06 +000018346 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018347}
18348
18349
18350static int
18351test_xmlCopyDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018352 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018353
William M. Brack21e4ef22005-01-02 09:53:13 +000018354#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000018355 int mem_base;
18356 xmlDocPtr ret_val;
18357 xmlDocPtr doc; /* the document */
18358 int n_doc;
18359 int recursive; /* if not zero do a recursive copy. */
18360 int n_recursive;
18361
18362 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
18363 for (n_recursive = 0;n_recursive < gen_nb_int;n_recursive++) {
18364 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000018365 doc = gen_xmlDocPtr(n_doc, 0);
18366 recursive = gen_int(n_recursive, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018367
18368 ret_val = xmlCopyDoc(doc, recursive);
18369 desret_xmlDocPtr(ret_val);
18370 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000018371 des_xmlDocPtr(n_doc, doc, 0);
18372 des_int(n_recursive, recursive, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018373 xmlResetLastError();
18374 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000018375 printf("Leak of %d blocks found in xmlCopyDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000018376 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018377 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000018378 printf(" %d", n_doc);
18379 printf(" %d", n_recursive);
18380 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000018381 }
18382 }
18383 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018384 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018385#endif
18386
Daniel Veillard42595322004-11-08 10:52:06 +000018387 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018388}
18389
18390
18391static int
18392test_xmlCopyDtd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018393 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018394
William M. Brack21e4ef22005-01-02 09:53:13 +000018395#if defined(LIBXML_TREE_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000018396 int mem_base;
18397 xmlDtdPtr ret_val;
18398 xmlDtdPtr dtd; /* the dtd */
18399 int n_dtd;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018400
Daniel Veillard27f20102004-11-05 11:50:11 +000018401 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
18402 mem_base = xmlMemBlocks();
18403 dtd = gen_xmlDtdPtr(n_dtd, 0);
18404
18405 ret_val = xmlCopyDtd(dtd);
18406 desret_xmlDtdPtr(ret_val);
18407 call_tests++;
18408 des_xmlDtdPtr(n_dtd, dtd, 0);
18409 xmlResetLastError();
18410 if (mem_base != xmlMemBlocks()) {
18411 printf("Leak of %d blocks found in xmlCopyDtd",
18412 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018413 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000018414 printf(" %d", n_dtd);
18415 printf("\n");
18416 }
18417 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018418 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000018419#endif
18420
Daniel Veillard42595322004-11-08 10:52:06 +000018421 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018422}
18423
18424
18425static int
18426test_xmlCopyNamespace(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018427 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018428
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018429 int mem_base;
18430 xmlNsPtr ret_val;
18431 xmlNsPtr cur; /* the namespace */
18432 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018433
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018434 for (n_cur = 0;n_cur < gen_nb_xmlNsPtr;n_cur++) {
18435 mem_base = xmlMemBlocks();
18436 cur = gen_xmlNsPtr(n_cur, 0);
18437
18438 ret_val = xmlCopyNamespace(cur);
18439 if (ret_val != NULL) xmlFreeNs(ret_val);
18440 desret_xmlNsPtr(ret_val);
18441 call_tests++;
18442 des_xmlNsPtr(n_cur, cur, 0);
18443 xmlResetLastError();
18444 if (mem_base != xmlMemBlocks()) {
18445 printf("Leak of %d blocks found in xmlCopyNamespace",
18446 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018447 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018448 printf(" %d", n_cur);
18449 printf("\n");
18450 }
18451 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018452 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018453
Daniel Veillard42595322004-11-08 10:52:06 +000018454 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018455}
18456
18457
18458static int
18459test_xmlCopyNamespaceList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018460 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018461
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018462 int mem_base;
18463 xmlNsPtr ret_val;
18464 xmlNsPtr cur; /* the first namespace */
18465 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018466
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018467 for (n_cur = 0;n_cur < gen_nb_xmlNsPtr;n_cur++) {
18468 mem_base = xmlMemBlocks();
18469 cur = gen_xmlNsPtr(n_cur, 0);
18470
18471 ret_val = xmlCopyNamespaceList(cur);
18472 if (ret_val != NULL) xmlFreeNsList(ret_val);
18473 desret_xmlNsPtr(ret_val);
18474 call_tests++;
18475 des_xmlNsPtr(n_cur, cur, 0);
18476 xmlResetLastError();
18477 if (mem_base != xmlMemBlocks()) {
18478 printf("Leak of %d blocks found in xmlCopyNamespaceList",
18479 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018480 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018481 printf(" %d", n_cur);
18482 printf("\n");
18483 }
18484 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018485 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018486
Daniel Veillard42595322004-11-08 10:52:06 +000018487 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018488}
18489
18490
18491static int
18492test_xmlCopyNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018493 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018494
Daniel Veillardce682bc2004-11-05 17:22:25 +000018495 int mem_base;
18496 xmlNodePtr ret_val;
18497 xmlNodePtr node; /* the node */
18498 int n_node;
18499 int extended; /* if 1 do a recursive copy (properties, namespaces and children when applicable) if 2 copy properties and namespaces (when applicable) */
18500 int n_extended;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018501
Daniel Veillardce682bc2004-11-05 17:22:25 +000018502 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
18503 for (n_extended = 0;n_extended < gen_nb_int;n_extended++) {
18504 mem_base = xmlMemBlocks();
18505 node = gen_const_xmlNodePtr(n_node, 0);
18506 extended = gen_int(n_extended, 1);
18507
William M. Brackf13f77f2004-11-12 16:03:48 +000018508 ret_val = xmlCopyNode((const xmlNodePtr)node, extended);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018509 desret_xmlNodePtr(ret_val);
18510 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018511 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018512 des_int(n_extended, extended, 1);
18513 xmlResetLastError();
18514 if (mem_base != xmlMemBlocks()) {
18515 printf("Leak of %d blocks found in xmlCopyNode",
18516 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018517 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018518 printf(" %d", n_node);
18519 printf(" %d", n_extended);
18520 printf("\n");
18521 }
18522 }
18523 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018524 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018525
Daniel Veillard42595322004-11-08 10:52:06 +000018526 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018527}
18528
18529
18530static int
18531test_xmlCopyNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018532 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018533
Daniel Veillardce682bc2004-11-05 17:22:25 +000018534 int mem_base;
18535 xmlNodePtr ret_val;
18536 xmlNodePtr node; /* the first node in the list. */
18537 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018538
Daniel Veillardce682bc2004-11-05 17:22:25 +000018539 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
18540 mem_base = xmlMemBlocks();
18541 node = gen_const_xmlNodePtr(n_node, 0);
18542
William M. Brackf13f77f2004-11-12 16:03:48 +000018543 ret_val = xmlCopyNodeList((const xmlNodePtr)node);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018544 desret_xmlNodePtr(ret_val);
18545 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018546 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018547 xmlResetLastError();
18548 if (mem_base != xmlMemBlocks()) {
18549 printf("Leak of %d blocks found in xmlCopyNodeList",
18550 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018551 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018552 printf(" %d", n_node);
18553 printf("\n");
18554 }
18555 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018556 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018557
Daniel Veillard42595322004-11-08 10:52:06 +000018558 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018559}
18560
18561
18562static int
18563test_xmlCopyProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018564 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018565
Daniel Veillard57b25162004-11-06 14:50:18 +000018566 int mem_base;
18567 xmlAttrPtr ret_val;
18568 xmlNodePtr target; /* the element where the attribute will be grafted */
18569 int n_target;
18570 xmlAttrPtr cur; /* the attribute */
18571 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018572
Daniel Veillard57b25162004-11-06 14:50:18 +000018573 for (n_target = 0;n_target < gen_nb_xmlNodePtr;n_target++) {
18574 for (n_cur = 0;n_cur < gen_nb_xmlAttrPtr;n_cur++) {
18575 mem_base = xmlMemBlocks();
18576 target = gen_xmlNodePtr(n_target, 0);
18577 cur = gen_xmlAttrPtr(n_cur, 1);
18578
18579 ret_val = xmlCopyProp(target, cur);
18580 desret_xmlAttrPtr(ret_val);
18581 call_tests++;
18582 des_xmlNodePtr(n_target, target, 0);
18583 des_xmlAttrPtr(n_cur, cur, 1);
18584 xmlResetLastError();
18585 if (mem_base != xmlMemBlocks()) {
18586 printf("Leak of %d blocks found in xmlCopyProp",
18587 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018588 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000018589 printf(" %d", n_target);
18590 printf(" %d", n_cur);
18591 printf("\n");
18592 }
18593 }
18594 }
Daniel Veillard57b25162004-11-06 14:50:18 +000018595 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018596
Daniel Veillard42595322004-11-08 10:52:06 +000018597 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018598}
18599
18600
18601static int
18602test_xmlCopyPropList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018603 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018604
Daniel Veillard57b25162004-11-06 14:50:18 +000018605 int mem_base;
18606 xmlAttrPtr ret_val;
18607 xmlNodePtr target; /* the element where the attributes will be grafted */
18608 int n_target;
18609 xmlAttrPtr cur; /* the first attribute */
18610 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018611
Daniel Veillard57b25162004-11-06 14:50:18 +000018612 for (n_target = 0;n_target < gen_nb_xmlNodePtr;n_target++) {
18613 for (n_cur = 0;n_cur < gen_nb_xmlAttrPtr;n_cur++) {
18614 mem_base = xmlMemBlocks();
18615 target = gen_xmlNodePtr(n_target, 0);
18616 cur = gen_xmlAttrPtr(n_cur, 1);
18617
18618 ret_val = xmlCopyPropList(target, cur);
18619 desret_xmlAttrPtr(ret_val);
18620 call_tests++;
18621 des_xmlNodePtr(n_target, target, 0);
18622 des_xmlAttrPtr(n_cur, cur, 1);
18623 xmlResetLastError();
18624 if (mem_base != xmlMemBlocks()) {
18625 printf("Leak of %d blocks found in xmlCopyPropList",
18626 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018627 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000018628 printf(" %d", n_target);
18629 printf(" %d", n_cur);
18630 printf("\n");
18631 }
18632 }
18633 }
Daniel Veillard57b25162004-11-06 14:50:18 +000018634 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018635
Daniel Veillard42595322004-11-08 10:52:06 +000018636 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018637}
18638
18639
18640static int
18641test_xmlCreateIntSubset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018642 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018643
Daniel Veillard34099b42004-11-04 17:34:35 +000018644 int mem_base;
18645 xmlDtdPtr ret_val;
18646 xmlDocPtr doc; /* the document pointer */
18647 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018648 xmlChar * name; /* the DTD name */
Daniel Veillard34099b42004-11-04 17:34:35 +000018649 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018650 xmlChar * ExternalID; /* the external (PUBLIC) ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000018651 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018652 xmlChar * SystemID; /* the system ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000018653 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018654
Daniel Veillard34099b42004-11-04 17:34:35 +000018655 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
18656 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
18657 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
18658 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
18659 mem_base = xmlMemBlocks();
18660 doc = gen_xmlDocPtr(n_doc, 0);
18661 name = gen_const_xmlChar_ptr(n_name, 1);
18662 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
18663 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
18664
William M. Brackf13f77f2004-11-12 16:03:48 +000018665 ret_val = xmlCreateIntSubset(doc, (const xmlChar *)name, (const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard34099b42004-11-04 17:34:35 +000018666 desret_xmlDtdPtr(ret_val);
18667 call_tests++;
18668 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018669 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
18670 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 2);
18671 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 3);
Daniel Veillard34099b42004-11-04 17:34:35 +000018672 xmlResetLastError();
18673 if (mem_base != xmlMemBlocks()) {
18674 printf("Leak of %d blocks found in xmlCreateIntSubset",
18675 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018676 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000018677 printf(" %d", n_doc);
18678 printf(" %d", n_name);
18679 printf(" %d", n_ExternalID);
18680 printf(" %d", n_SystemID);
18681 printf("\n");
18682 }
18683 }
18684 }
18685 }
18686 }
Daniel Veillard34099b42004-11-04 17:34:35 +000018687 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018688
Daniel Veillard42595322004-11-08 10:52:06 +000018689 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018690}
18691
18692
18693static int
18694test_xmlDocCopyNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018695 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018696
Daniel Veillardce682bc2004-11-05 17:22:25 +000018697 int mem_base;
18698 xmlNodePtr ret_val;
18699 xmlNodePtr node; /* the node */
18700 int n_node;
18701 xmlDocPtr doc; /* the document */
18702 int n_doc;
18703 int extended; /* if 1 do a recursive copy (properties, namespaces and children when applicable) if 2 copy properties and namespaces (when applicable) */
18704 int n_extended;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018705
Daniel Veillardce682bc2004-11-05 17:22:25 +000018706 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
18707 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
18708 for (n_extended = 0;n_extended < gen_nb_int;n_extended++) {
18709 mem_base = xmlMemBlocks();
18710 node = gen_const_xmlNodePtr(n_node, 0);
18711 doc = gen_xmlDocPtr(n_doc, 1);
18712 extended = gen_int(n_extended, 2);
18713
William M. Brackf13f77f2004-11-12 16:03:48 +000018714 ret_val = xmlDocCopyNode((const xmlNodePtr)node, doc, extended);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018715 desret_xmlNodePtr(ret_val);
18716 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000018717 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018718 des_xmlDocPtr(n_doc, doc, 1);
18719 des_int(n_extended, extended, 2);
18720 xmlResetLastError();
18721 if (mem_base != xmlMemBlocks()) {
18722 printf("Leak of %d blocks found in xmlDocCopyNode",
18723 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018724 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018725 printf(" %d", n_node);
18726 printf(" %d", n_doc);
18727 printf(" %d", n_extended);
18728 printf("\n");
18729 }
18730 }
18731 }
18732 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018733 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018734
Daniel Veillard42595322004-11-08 10:52:06 +000018735 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018736}
18737
18738
18739static int
18740test_xmlDocCopyNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018741 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018742
Daniel Veillardce682bc2004-11-05 17:22:25 +000018743 int mem_base;
18744 xmlNodePtr ret_val;
18745 xmlDocPtr doc; /* the target document */
18746 int n_doc;
18747 xmlNodePtr node; /* the first node in the list. */
18748 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018749
Daniel Veillardce682bc2004-11-05 17:22:25 +000018750 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
18751 for (n_node = 0;n_node < gen_nb_const_xmlNodePtr;n_node++) {
18752 mem_base = xmlMemBlocks();
18753 doc = gen_xmlDocPtr(n_doc, 0);
18754 node = gen_const_xmlNodePtr(n_node, 1);
18755
William M. Brackf13f77f2004-11-12 16:03:48 +000018756 ret_val = xmlDocCopyNodeList(doc, (const xmlNodePtr)node);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018757 desret_xmlNodePtr(ret_val);
18758 call_tests++;
18759 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000018760 des_const_xmlNodePtr(n_node, (const xmlNodePtr)node, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000018761 xmlResetLastError();
18762 if (mem_base != xmlMemBlocks()) {
18763 printf("Leak of %d blocks found in xmlDocCopyNodeList",
18764 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018765 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000018766 printf(" %d", n_doc);
18767 printf(" %d", n_node);
18768 printf("\n");
18769 }
18770 }
18771 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000018772 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018773
Daniel Veillard42595322004-11-08 10:52:06 +000018774 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018775}
18776
18777
18778static int
18779test_xmlDocDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018780 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018781
William M. Brack21e4ef22005-01-02 09:53:13 +000018782#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000018783 int mem_base;
18784 int ret_val;
18785 FILE * f; /* the FILE* */
18786 int n_f;
18787 xmlDocPtr cur; /* the document */
18788 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018789
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000018790 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
18791 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
18792 mem_base = xmlMemBlocks();
18793 f = gen_FILE_ptr(n_f, 0);
18794 cur = gen_xmlDocPtr(n_cur, 1);
18795
18796 ret_val = xmlDocDump(f, cur);
18797 desret_int(ret_val);
18798 call_tests++;
18799 des_FILE_ptr(n_f, f, 0);
18800 des_xmlDocPtr(n_cur, cur, 1);
18801 xmlResetLastError();
18802 if (mem_base != xmlMemBlocks()) {
18803 printf("Leak of %d blocks found in xmlDocDump",
18804 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018805 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000018806 printf(" %d", n_f);
18807 printf(" %d", n_cur);
18808 printf("\n");
18809 }
18810 }
18811 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018812 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000018813#endif
18814
Daniel Veillard42595322004-11-08 10:52:06 +000018815 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018816}
18817
18818
18819static int
18820test_xmlDocDumpFormatMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018821 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018822
William M. Brack21e4ef22005-01-02 09:53:13 +000018823#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018824 int mem_base;
18825 xmlDocPtr cur; /* the document */
18826 int n_cur;
18827 xmlChar ** mem; /* OUT: the memory pointer */
18828 int n_mem;
18829 int * size; /* OUT: the memory length */
18830 int n_size;
18831 int format; /* should formatting spaces been added */
18832 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018833
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018834 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
18835 for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) {
18836 for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) {
18837 for (n_format = 0;n_format < gen_nb_int;n_format++) {
18838 mem_base = xmlMemBlocks();
18839 cur = gen_xmlDocPtr(n_cur, 0);
18840 mem = gen_xmlChar_ptr_ptr(n_mem, 1);
18841 size = gen_int_ptr(n_size, 2);
18842 format = gen_int(n_format, 3);
18843
18844 xmlDocDumpFormatMemory(cur, mem, size, format);
18845 call_tests++;
18846 des_xmlDocPtr(n_cur, cur, 0);
18847 des_xmlChar_ptr_ptr(n_mem, mem, 1);
18848 des_int_ptr(n_size, size, 2);
18849 des_int(n_format, format, 3);
18850 xmlResetLastError();
18851 if (mem_base != xmlMemBlocks()) {
18852 printf("Leak of %d blocks found in xmlDocDumpFormatMemory",
18853 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018854 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018855 printf(" %d", n_cur);
18856 printf(" %d", n_mem);
18857 printf(" %d", n_size);
18858 printf(" %d", n_format);
18859 printf("\n");
18860 }
18861 }
18862 }
18863 }
18864 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018865 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018866#endif
18867
Daniel Veillard42595322004-11-08 10:52:06 +000018868 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018869}
18870
18871
18872static int
18873test_xmlDocDumpFormatMemoryEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018874 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018875
William M. Brack21e4ef22005-01-02 09:53:13 +000018876#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018877 int mem_base;
18878 xmlDocPtr out_doc; /* Document to generate XML text from */
18879 int n_out_doc;
18880 xmlChar ** doc_txt_ptr; /* Memory pointer for allocated XML text */
18881 int n_doc_txt_ptr;
18882 int * doc_txt_len; /* Length of the generated XML text */
18883 int n_doc_txt_len;
18884 char * txt_encoding; /* Character encoding to use when generating XML text */
18885 int n_txt_encoding;
18886 int format; /* should formatting spaces been added */
18887 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018888
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018889 for (n_out_doc = 0;n_out_doc < gen_nb_xmlDocPtr;n_out_doc++) {
18890 for (n_doc_txt_ptr = 0;n_doc_txt_ptr < gen_nb_xmlChar_ptr_ptr;n_doc_txt_ptr++) {
18891 for (n_doc_txt_len = 0;n_doc_txt_len < gen_nb_int_ptr;n_doc_txt_len++) {
18892 for (n_txt_encoding = 0;n_txt_encoding < gen_nb_const_char_ptr;n_txt_encoding++) {
18893 for (n_format = 0;n_format < gen_nb_int;n_format++) {
18894 mem_base = xmlMemBlocks();
18895 out_doc = gen_xmlDocPtr(n_out_doc, 0);
18896 doc_txt_ptr = gen_xmlChar_ptr_ptr(n_doc_txt_ptr, 1);
18897 doc_txt_len = gen_int_ptr(n_doc_txt_len, 2);
18898 txt_encoding = gen_const_char_ptr(n_txt_encoding, 3);
18899 format = gen_int(n_format, 4);
18900
William M. Brackf13f77f2004-11-12 16:03:48 +000018901 xmlDocDumpFormatMemoryEnc(out_doc, doc_txt_ptr, doc_txt_len, (const char *)txt_encoding, format);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018902 call_tests++;
18903 des_xmlDocPtr(n_out_doc, out_doc, 0);
18904 des_xmlChar_ptr_ptr(n_doc_txt_ptr, doc_txt_ptr, 1);
18905 des_int_ptr(n_doc_txt_len, doc_txt_len, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000018906 des_const_char_ptr(n_txt_encoding, (const char *)txt_encoding, 3);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018907 des_int(n_format, format, 4);
18908 xmlResetLastError();
18909 if (mem_base != xmlMemBlocks()) {
18910 printf("Leak of %d blocks found in xmlDocDumpFormatMemoryEnc",
18911 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018912 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018913 printf(" %d", n_out_doc);
18914 printf(" %d", n_doc_txt_ptr);
18915 printf(" %d", n_doc_txt_len);
18916 printf(" %d", n_txt_encoding);
18917 printf(" %d", n_format);
18918 printf("\n");
18919 }
18920 }
18921 }
18922 }
18923 }
18924 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018925 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018926#endif
18927
Daniel Veillard42595322004-11-08 10:52:06 +000018928 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018929}
18930
18931
18932static int
18933test_xmlDocDumpMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018934 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018935
William M. Brack21e4ef22005-01-02 09:53:13 +000018936#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018937 int mem_base;
18938 xmlDocPtr cur; /* the document */
18939 int n_cur;
18940 xmlChar ** mem; /* OUT: the memory pointer */
18941 int n_mem;
18942 int * size; /* OUT: the memory length */
18943 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018944
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018945 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
18946 for (n_mem = 0;n_mem < gen_nb_xmlChar_ptr_ptr;n_mem++) {
18947 for (n_size = 0;n_size < gen_nb_int_ptr;n_size++) {
18948 mem_base = xmlMemBlocks();
18949 cur = gen_xmlDocPtr(n_cur, 0);
18950 mem = gen_xmlChar_ptr_ptr(n_mem, 1);
18951 size = gen_int_ptr(n_size, 2);
18952
18953 xmlDocDumpMemory(cur, mem, size);
18954 call_tests++;
18955 des_xmlDocPtr(n_cur, cur, 0);
18956 des_xmlChar_ptr_ptr(n_mem, mem, 1);
18957 des_int_ptr(n_size, size, 2);
18958 xmlResetLastError();
18959 if (mem_base != xmlMemBlocks()) {
18960 printf("Leak of %d blocks found in xmlDocDumpMemory",
18961 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000018962 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018963 printf(" %d", n_cur);
18964 printf(" %d", n_mem);
18965 printf(" %d", n_size);
18966 printf("\n");
18967 }
18968 }
18969 }
18970 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000018971 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018972#endif
18973
Daniel Veillard42595322004-11-08 10:52:06 +000018974 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000018975}
18976
18977
18978static int
18979test_xmlDocDumpMemoryEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000018980 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018981
William M. Brack21e4ef22005-01-02 09:53:13 +000018982#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018983 int mem_base;
18984 xmlDocPtr out_doc; /* Document to generate XML text from */
18985 int n_out_doc;
18986 xmlChar ** doc_txt_ptr; /* Memory pointer for allocated XML text */
18987 int n_doc_txt_ptr;
18988 int * doc_txt_len; /* Length of the generated XML text */
18989 int n_doc_txt_len;
18990 char * txt_encoding; /* Character encoding to use when generating XML text */
18991 int n_txt_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +000018992
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000018993 for (n_out_doc = 0;n_out_doc < gen_nb_xmlDocPtr;n_out_doc++) {
18994 for (n_doc_txt_ptr = 0;n_doc_txt_ptr < gen_nb_xmlChar_ptr_ptr;n_doc_txt_ptr++) {
18995 for (n_doc_txt_len = 0;n_doc_txt_len < gen_nb_int_ptr;n_doc_txt_len++) {
18996 for (n_txt_encoding = 0;n_txt_encoding < gen_nb_const_char_ptr;n_txt_encoding++) {
18997 mem_base = xmlMemBlocks();
18998 out_doc = gen_xmlDocPtr(n_out_doc, 0);
18999 doc_txt_ptr = gen_xmlChar_ptr_ptr(n_doc_txt_ptr, 1);
19000 doc_txt_len = gen_int_ptr(n_doc_txt_len, 2);
19001 txt_encoding = gen_const_char_ptr(n_txt_encoding, 3);
19002
William M. Brackf13f77f2004-11-12 16:03:48 +000019003 xmlDocDumpMemoryEnc(out_doc, doc_txt_ptr, doc_txt_len, (const char *)txt_encoding);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019004 call_tests++;
19005 des_xmlDocPtr(n_out_doc, out_doc, 0);
19006 des_xmlChar_ptr_ptr(n_doc_txt_ptr, doc_txt_ptr, 1);
19007 des_int_ptr(n_doc_txt_len, doc_txt_len, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000019008 des_const_char_ptr(n_txt_encoding, (const char *)txt_encoding, 3);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019009 xmlResetLastError();
19010 if (mem_base != xmlMemBlocks()) {
19011 printf("Leak of %d blocks found in xmlDocDumpMemoryEnc",
19012 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019013 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019014 printf(" %d", n_out_doc);
19015 printf(" %d", n_doc_txt_ptr);
19016 printf(" %d", n_doc_txt_len);
19017 printf(" %d", n_txt_encoding);
19018 printf("\n");
19019 }
19020 }
19021 }
19022 }
19023 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019024 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000019025#endif
19026
Daniel Veillard42595322004-11-08 10:52:06 +000019027 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019028}
19029
19030
19031static int
19032test_xmlDocFormatDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019033 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019034
William M. Brack21e4ef22005-01-02 09:53:13 +000019035#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019036 int mem_base;
19037 int ret_val;
19038 FILE * f; /* the FILE* */
19039 int n_f;
19040 xmlDocPtr cur; /* the document */
19041 int n_cur;
19042 int format; /* should formatting spaces been added */
19043 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019044
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019045 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
19046 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
19047 for (n_format = 0;n_format < gen_nb_int;n_format++) {
19048 mem_base = xmlMemBlocks();
19049 f = gen_FILE_ptr(n_f, 0);
19050 cur = gen_xmlDocPtr(n_cur, 1);
19051 format = gen_int(n_format, 2);
19052
19053 ret_val = xmlDocFormatDump(f, cur, format);
19054 desret_int(ret_val);
19055 call_tests++;
19056 des_FILE_ptr(n_f, f, 0);
19057 des_xmlDocPtr(n_cur, cur, 1);
19058 des_int(n_format, format, 2);
19059 xmlResetLastError();
19060 if (mem_base != xmlMemBlocks()) {
19061 printf("Leak of %d blocks found in xmlDocFormatDump",
19062 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019063 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019064 printf(" %d", n_f);
19065 printf(" %d", n_cur);
19066 printf(" %d", n_format);
19067 printf("\n");
19068 }
19069 }
19070 }
19071 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019072 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019073#endif
19074
Daniel Veillard42595322004-11-08 10:52:06 +000019075 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019076}
19077
19078
19079static int
19080test_xmlDocGetRootElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019081 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019082
19083 int mem_base;
19084 xmlNodePtr ret_val;
19085 xmlDocPtr doc; /* the document */
19086 int n_doc;
19087
19088 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19089 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019090 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019091
19092 ret_val = xmlDocGetRootElement(doc);
19093 desret_xmlNodePtr(ret_val);
19094 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019095 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019096 xmlResetLastError();
19097 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019098 printf("Leak of %d blocks found in xmlDocGetRootElement",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019099 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019100 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019101 printf(" %d", n_doc);
19102 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019103 }
19104 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019105 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019106
Daniel Veillard42595322004-11-08 10:52:06 +000019107 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019108}
19109
19110
19111static int
19112test_xmlDocSetRootElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019113 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019114
William M. Brack21e4ef22005-01-02 09:53:13 +000019115#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000019116 int mem_base;
19117 xmlNodePtr ret_val;
19118 xmlDocPtr doc; /* the document */
19119 int n_doc;
19120 xmlNodePtr root; /* the new document root element */
19121 int n_root;
19122
19123 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019124 for (n_root = 0;n_root < gen_nb_xmlNodePtr_in;n_root++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000019125 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019126 doc = gen_xmlDocPtr(n_doc, 0);
19127 root = gen_xmlNodePtr_in(n_root, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019128
19129 ret_val = xmlDocSetRootElement(doc, root);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019130 if (doc == NULL) { xmlFreeNode(root) ; root = NULL ; }
Daniel Veillardd93f6252004-11-02 15:53:51 +000019131 desret_xmlNodePtr(ret_val);
19132 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019133 des_xmlDocPtr(n_doc, doc, 0);
19134 des_xmlNodePtr_in(n_root, root, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019135 xmlResetLastError();
19136 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019137 printf("Leak of %d blocks found in xmlDocSetRootElement",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019138 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019139 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019140 printf(" %d", n_doc);
19141 printf(" %d", n_root);
19142 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019143 }
19144 }
19145 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019146 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019147#endif
19148
Daniel Veillard42595322004-11-08 10:52:06 +000019149 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019150}
19151
19152
19153static int
19154test_xmlElemDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019155 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019156
William M. Brack21e4ef22005-01-02 09:53:13 +000019157#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019158 int mem_base;
19159 FILE * f; /* the FILE * for the output */
19160 int n_f;
19161 xmlDocPtr doc; /* the document */
19162 int n_doc;
19163 xmlNodePtr cur; /* the current node */
19164 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019165
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019166 for (n_f = 0;n_f < gen_nb_FILE_ptr;n_f++) {
19167 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19168 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
19169 mem_base = xmlMemBlocks();
19170 f = gen_FILE_ptr(n_f, 0);
19171 doc = gen_xmlDocPtr(n_doc, 1);
19172 cur = gen_xmlNodePtr(n_cur, 2);
19173
19174 xmlElemDump(f, doc, cur);
19175 call_tests++;
19176 des_FILE_ptr(n_f, f, 0);
19177 des_xmlDocPtr(n_doc, doc, 1);
19178 des_xmlNodePtr(n_cur, cur, 2);
19179 xmlResetLastError();
19180 if (mem_base != xmlMemBlocks()) {
19181 printf("Leak of %d blocks found in xmlElemDump",
19182 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019183 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019184 printf(" %d", n_f);
19185 printf(" %d", n_doc);
19186 printf(" %d", n_cur);
19187 printf("\n");
19188 }
19189 }
19190 }
19191 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019192 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019193#endif
19194
Daniel Veillard42595322004-11-08 10:52:06 +000019195 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019196}
19197
19198
19199static int
19200test_xmlGetBufferAllocationScheme(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019201 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019202
Daniel Veillard57b25162004-11-06 14:50:18 +000019203 int mem_base;
19204 xmlBufferAllocationScheme ret_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019205
Daniel Veillard57b25162004-11-06 14:50:18 +000019206 mem_base = xmlMemBlocks();
19207
19208 ret_val = xmlGetBufferAllocationScheme();
19209 desret_xmlBufferAllocationScheme(ret_val);
19210 call_tests++;
19211 xmlResetLastError();
19212 if (mem_base != xmlMemBlocks()) {
19213 printf("Leak of %d blocks found in xmlGetBufferAllocationScheme",
19214 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019215 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000019216 printf("\n");
19217 }
Daniel Veillard57b25162004-11-06 14:50:18 +000019218 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019219
Daniel Veillard42595322004-11-08 10:52:06 +000019220 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019221}
19222
19223
19224static int
19225test_xmlGetCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019226 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019227
19228 int mem_base;
19229 int ret_val;
19230
19231 mem_base = xmlMemBlocks();
19232
19233 ret_val = xmlGetCompressMode();
19234 desret_int(ret_val);
19235 call_tests++;
19236 xmlResetLastError();
19237 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019238 printf("Leak of %d blocks found in xmlGetCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019239 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019240 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019241 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019242 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019243 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019244
Daniel Veillard42595322004-11-08 10:52:06 +000019245 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019246}
19247
19248
19249static int
19250test_xmlGetDocCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019251 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019252
19253 int mem_base;
19254 int ret_val;
19255 xmlDocPtr doc; /* the document */
19256 int n_doc;
19257
19258 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19259 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019260 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019261
19262 ret_val = xmlGetDocCompressMode(doc);
19263 desret_int(ret_val);
19264 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019265 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019266 xmlResetLastError();
19267 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019268 printf("Leak of %d blocks found in xmlGetDocCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019269 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019270 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019271 printf(" %d", n_doc);
19272 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019273 }
19274 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019275 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019276
Daniel Veillard42595322004-11-08 10:52:06 +000019277 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019278}
19279
19280
19281static int
19282test_xmlGetIntSubset(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019283 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019284
Daniel Veillard34099b42004-11-04 17:34:35 +000019285 int mem_base;
19286 xmlDtdPtr ret_val;
19287 xmlDocPtr doc; /* the document pointer */
19288 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019289
Daniel Veillard34099b42004-11-04 17:34:35 +000019290 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19291 mem_base = xmlMemBlocks();
19292 doc = gen_xmlDocPtr(n_doc, 0);
19293
19294 ret_val = xmlGetIntSubset(doc);
19295 desret_xmlDtdPtr(ret_val);
19296 call_tests++;
19297 des_xmlDocPtr(n_doc, doc, 0);
19298 xmlResetLastError();
19299 if (mem_base != xmlMemBlocks()) {
19300 printf("Leak of %d blocks found in xmlGetIntSubset",
19301 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019302 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000019303 printf(" %d", n_doc);
19304 printf("\n");
19305 }
19306 }
Daniel Veillard34099b42004-11-04 17:34:35 +000019307 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019308
Daniel Veillard42595322004-11-08 10:52:06 +000019309 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019310}
19311
19312
19313static int
19314test_xmlGetLastChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019315 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019316
19317 int mem_base;
19318 xmlNodePtr ret_val;
19319 xmlNodePtr parent; /* the parent node */
19320 int n_parent;
19321
19322 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
19323 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019324 parent = gen_xmlNodePtr(n_parent, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019325
19326 ret_val = xmlGetLastChild(parent);
19327 desret_xmlNodePtr(ret_val);
19328 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019329 des_xmlNodePtr(n_parent, parent, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019330 xmlResetLastError();
19331 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019332 printf("Leak of %d blocks found in xmlGetLastChild",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019333 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019334 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019335 printf(" %d", n_parent);
19336 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019337 }
19338 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019339 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019340
Daniel Veillard42595322004-11-08 10:52:06 +000019341 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019342}
19343
19344
19345static int
19346test_xmlGetLineNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019347 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019348
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019349 int mem_base;
19350 long ret_val;
19351 xmlNodePtr node; /* valid node */
19352 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019353
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019354 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19355 mem_base = xmlMemBlocks();
19356 node = gen_xmlNodePtr(n_node, 0);
19357
19358 ret_val = xmlGetLineNo(node);
19359 desret_long(ret_val);
19360 call_tests++;
19361 des_xmlNodePtr(n_node, node, 0);
19362 xmlResetLastError();
19363 if (mem_base != xmlMemBlocks()) {
19364 printf("Leak of %d blocks found in xmlGetLineNo",
19365 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019366 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019367 printf(" %d", n_node);
19368 printf("\n");
19369 }
19370 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000019371 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019372
Daniel Veillard42595322004-11-08 10:52:06 +000019373 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019374}
19375
19376
19377static int
19378test_xmlGetNoNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019379 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019380
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019381 int mem_base;
19382 xmlChar * ret_val;
19383 xmlNodePtr node; /* the node */
19384 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019385 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019386 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019387
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019388 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19389 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19390 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019391 node = gen_xmlNodePtr(n_node, 0);
19392 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019393
William M. Brackf13f77f2004-11-12 16:03:48 +000019394 ret_val = xmlGetNoNsProp(node, (const xmlChar *)name);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019395 desret_xmlChar_ptr(ret_val);
19396 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019397 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019398 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019399 xmlResetLastError();
19400 if (mem_base != xmlMemBlocks()) {
19401 printf("Leak of %d blocks found in xmlGetNoNsProp",
19402 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019403 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019404 printf(" %d", n_node);
19405 printf(" %d", n_name);
19406 printf("\n");
19407 }
19408 }
19409 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019410 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019411
Daniel Veillard42595322004-11-08 10:52:06 +000019412 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019413}
19414
19415
19416static int
19417test_xmlGetNodePath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019418 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019419
William M. Brack21e4ef22005-01-02 09:53:13 +000019420#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_DEBUG_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019421 int mem_base;
19422 xmlChar * ret_val;
19423 xmlNodePtr node; /* a node */
19424 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019425
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019426 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19427 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019428 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019429
19430 ret_val = xmlGetNodePath(node);
19431 desret_xmlChar_ptr(ret_val);
19432 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019433 des_xmlNodePtr(n_node, node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019434 xmlResetLastError();
19435 if (mem_base != xmlMemBlocks()) {
19436 printf("Leak of %d blocks found in xmlGetNodePath",
19437 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019438 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019439 printf(" %d", n_node);
19440 printf("\n");
19441 }
19442 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019443 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019444#endif
19445
Daniel Veillard42595322004-11-08 10:52:06 +000019446 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019447}
19448
19449
19450static int
19451test_xmlGetNsList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019452 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019453
19454
19455 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000019456 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019457}
19458
19459
19460static int
19461test_xmlGetNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019462 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019463
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019464 int mem_base;
19465 xmlChar * ret_val;
19466 xmlNodePtr node; /* the node */
19467 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019468 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019469 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019470 xmlChar * nameSpace; /* the URI of the namespace */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019471 int n_nameSpace;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019472
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019473 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19474 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19475 for (n_nameSpace = 0;n_nameSpace < gen_nb_const_xmlChar_ptr;n_nameSpace++) {
19476 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019477 node = gen_xmlNodePtr(n_node, 0);
19478 name = gen_const_xmlChar_ptr(n_name, 1);
19479 nameSpace = gen_const_xmlChar_ptr(n_nameSpace, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019480
William M. Brackf13f77f2004-11-12 16:03:48 +000019481 ret_val = xmlGetNsProp(node, (const xmlChar *)name, (const xmlChar *)nameSpace);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019482 desret_xmlChar_ptr(ret_val);
19483 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019484 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019485 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
19486 des_const_xmlChar_ptr(n_nameSpace, (const xmlChar *)nameSpace, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019487 xmlResetLastError();
19488 if (mem_base != xmlMemBlocks()) {
19489 printf("Leak of %d blocks found in xmlGetNsProp",
19490 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019491 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019492 printf(" %d", n_node);
19493 printf(" %d", n_name);
19494 printf(" %d", n_nameSpace);
19495 printf("\n");
19496 }
19497 }
19498 }
19499 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019500 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019501
Daniel Veillard42595322004-11-08 10:52:06 +000019502 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019503}
19504
19505
19506static int
19507test_xmlGetProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019508 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019509
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019510 int mem_base;
19511 xmlChar * ret_val;
19512 xmlNodePtr node; /* the node */
19513 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019514 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019515 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019516
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019517 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19518 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19519 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019520 node = gen_xmlNodePtr(n_node, 0);
19521 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019522
William M. Brackf13f77f2004-11-12 16:03:48 +000019523 ret_val = xmlGetProp(node, (const xmlChar *)name);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019524 desret_xmlChar_ptr(ret_val);
19525 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019526 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019527 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019528 xmlResetLastError();
19529 if (mem_base != xmlMemBlocks()) {
19530 printf("Leak of %d blocks found in xmlGetProp",
19531 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019532 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000019533 printf(" %d", n_node);
19534 printf(" %d", n_name);
19535 printf("\n");
19536 }
19537 }
19538 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019539 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019540
Daniel Veillard42595322004-11-08 10:52:06 +000019541 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019542}
19543
19544
19545static int
19546test_xmlHasNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019547 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019548
Daniel Veillard57b25162004-11-06 14:50:18 +000019549 int mem_base;
19550 xmlAttrPtr ret_val;
19551 xmlNodePtr node; /* the node */
19552 int n_node;
19553 xmlChar * name; /* the attribute name */
19554 int n_name;
19555 xmlChar * nameSpace; /* the URI of the namespace */
19556 int n_nameSpace;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019557
Daniel Veillard57b25162004-11-06 14:50:18 +000019558 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19559 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19560 for (n_nameSpace = 0;n_nameSpace < gen_nb_const_xmlChar_ptr;n_nameSpace++) {
19561 mem_base = xmlMemBlocks();
19562 node = gen_xmlNodePtr(n_node, 0);
19563 name = gen_const_xmlChar_ptr(n_name, 1);
19564 nameSpace = gen_const_xmlChar_ptr(n_nameSpace, 2);
19565
William M. Brackf13f77f2004-11-12 16:03:48 +000019566 ret_val = xmlHasNsProp(node, (const xmlChar *)name, (const xmlChar *)nameSpace);
Daniel Veillard57b25162004-11-06 14:50:18 +000019567 desret_xmlAttrPtr(ret_val);
19568 call_tests++;
19569 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019570 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
19571 des_const_xmlChar_ptr(n_nameSpace, (const xmlChar *)nameSpace, 2);
Daniel Veillard57b25162004-11-06 14:50:18 +000019572 xmlResetLastError();
19573 if (mem_base != xmlMemBlocks()) {
19574 printf("Leak of %d blocks found in xmlHasNsProp",
19575 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019576 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000019577 printf(" %d", n_node);
19578 printf(" %d", n_name);
19579 printf(" %d", n_nameSpace);
19580 printf("\n");
19581 }
19582 }
19583 }
19584 }
Daniel Veillard57b25162004-11-06 14:50:18 +000019585 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019586
Daniel Veillard42595322004-11-08 10:52:06 +000019587 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019588}
19589
19590
19591static int
19592test_xmlHasProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019593 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019594
Daniel Veillard57b25162004-11-06 14:50:18 +000019595 int mem_base;
19596 xmlAttrPtr ret_val;
19597 xmlNodePtr node; /* the node */
19598 int n_node;
19599 xmlChar * name; /* the attribute name */
19600 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019601
Daniel Veillard57b25162004-11-06 14:50:18 +000019602 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19603 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19604 mem_base = xmlMemBlocks();
19605 node = gen_xmlNodePtr(n_node, 0);
19606 name = gen_const_xmlChar_ptr(n_name, 1);
19607
William M. Brackf13f77f2004-11-12 16:03:48 +000019608 ret_val = xmlHasProp(node, (const xmlChar *)name);
Daniel Veillard57b25162004-11-06 14:50:18 +000019609 desret_xmlAttrPtr(ret_val);
19610 call_tests++;
19611 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019612 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +000019613 xmlResetLastError();
19614 if (mem_base != xmlMemBlocks()) {
19615 printf("Leak of %d blocks found in xmlHasProp",
19616 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019617 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000019618 printf(" %d", n_node);
19619 printf(" %d", n_name);
19620 printf("\n");
19621 }
19622 }
19623 }
Daniel Veillard57b25162004-11-06 14:50:18 +000019624 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019625
Daniel Veillard42595322004-11-08 10:52:06 +000019626 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019627}
19628
19629
19630static int
19631test_xmlIsBlankNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019632 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019633
19634 int mem_base;
19635 int ret_val;
19636 xmlNodePtr node; /* the node */
19637 int n_node;
19638
19639 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
19640 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019641 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019642
19643 ret_val = xmlIsBlankNode(node);
19644 desret_int(ret_val);
19645 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019646 des_xmlNodePtr(n_node, node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019647 xmlResetLastError();
19648 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019649 printf("Leak of %d blocks found in xmlIsBlankNode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019650 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019651 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019652 printf(" %d", n_node);
19653 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019654 }
19655 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019656 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019657
Daniel Veillard42595322004-11-08 10:52:06 +000019658 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019659}
19660
19661
19662static int
19663test_xmlIsXHTML(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019664 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019665
19666 int mem_base;
19667 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019668 xmlChar * systemID; /* the system identifier */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019669 int n_systemID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019670 xmlChar * publicID; /* the public identifier */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019671 int n_publicID;
19672
19673 for (n_systemID = 0;n_systemID < gen_nb_const_xmlChar_ptr;n_systemID++) {
19674 for (n_publicID = 0;n_publicID < gen_nb_const_xmlChar_ptr;n_publicID++) {
19675 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019676 systemID = gen_const_xmlChar_ptr(n_systemID, 0);
19677 publicID = gen_const_xmlChar_ptr(n_publicID, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019678
William M. Brackf13f77f2004-11-12 16:03:48 +000019679 ret_val = xmlIsXHTML((const xmlChar *)systemID, (const xmlChar *)publicID);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019680 desret_int(ret_val);
19681 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000019682 des_const_xmlChar_ptr(n_systemID, (const xmlChar *)systemID, 0);
19683 des_const_xmlChar_ptr(n_publicID, (const xmlChar *)publicID, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019684 xmlResetLastError();
19685 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019686 printf("Leak of %d blocks found in xmlIsXHTML",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019687 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019688 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019689 printf(" %d", n_systemID);
19690 printf(" %d", n_publicID);
19691 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019692 }
19693 }
19694 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019695 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019696
Daniel Veillard42595322004-11-08 10:52:06 +000019697 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019698}
19699
19700
19701static int
19702test_xmlNewCDataBlock(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019703 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019704
19705 int mem_base;
19706 xmlNodePtr ret_val;
19707 xmlDocPtr doc; /* the document */
19708 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019709 xmlChar * content; /* the CDATA block content content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019710 int n_content;
19711 int len; /* the length of the block */
19712 int n_len;
19713
19714 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19715 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
19716 for (n_len = 0;n_len < gen_nb_int;n_len++) {
19717 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019718 doc = gen_xmlDocPtr(n_doc, 0);
19719 content = gen_const_xmlChar_ptr(n_content, 1);
19720 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019721
William M. Brackf13f77f2004-11-12 16:03:48 +000019722 ret_val = xmlNewCDataBlock(doc, (const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019723 desret_xmlNodePtr(ret_val);
19724 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019725 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019726 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000019727 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019728 xmlResetLastError();
19729 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019730 printf("Leak of %d blocks found in xmlNewCDataBlock",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019731 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019732 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019733 printf(" %d", n_doc);
19734 printf(" %d", n_content);
19735 printf(" %d", n_len);
19736 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019737 }
19738 }
19739 }
19740 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019741 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019742
Daniel Veillard42595322004-11-08 10:52:06 +000019743 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019744}
19745
19746
19747static int
19748test_xmlNewCharRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019749 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019750
19751 int mem_base;
19752 xmlNodePtr ret_val;
19753 xmlDocPtr doc; /* the document */
19754 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019755 xmlChar * name; /* the char ref string, starting with # or "&# ... ;" */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019756 int n_name;
19757
19758 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19759 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19760 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019761 doc = gen_xmlDocPtr(n_doc, 0);
19762 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019763
William M. Brackf13f77f2004-11-12 16:03:48 +000019764 ret_val = xmlNewCharRef(doc, (const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019765 desret_xmlNodePtr(ret_val);
19766 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019767 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019768 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019769 xmlResetLastError();
19770 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019771 printf("Leak of %d blocks found in xmlNewCharRef",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019772 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019773 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019774 printf(" %d", n_doc);
19775 printf(" %d", n_name);
19776 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019777 }
19778 }
19779 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019780 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019781
Daniel Veillard42595322004-11-08 10:52:06 +000019782 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019783}
19784
19785
19786static int
19787test_xmlNewChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019788 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019789
William M. Brack21e4ef22005-01-02 09:53:13 +000019790#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000019791#ifdef LIBXML_TREE_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +000019792 int mem_base;
19793 xmlNodePtr ret_val;
19794 xmlNodePtr parent; /* the parent node */
19795 int n_parent;
19796 xmlNsPtr ns; /* a namespace if any */
19797 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019798 xmlChar * name; /* the name of the child */
Daniel Veillard27f20102004-11-05 11:50:11 +000019799 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019800 xmlChar * content; /* the XML content of the child if any. */
Daniel Veillard27f20102004-11-05 11:50:11 +000019801 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019802
Daniel Veillard27f20102004-11-05 11:50:11 +000019803 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
19804 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
19805 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19806 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
19807 mem_base = xmlMemBlocks();
19808 parent = gen_xmlNodePtr(n_parent, 0);
19809 ns = gen_xmlNsPtr(n_ns, 1);
19810 name = gen_const_xmlChar_ptr(n_name, 2);
19811 content = gen_const_xmlChar_ptr(n_content, 3);
19812
William M. Brackf13f77f2004-11-12 16:03:48 +000019813 ret_val = xmlNewChild(parent, ns, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillard27f20102004-11-05 11:50:11 +000019814 desret_xmlNodePtr(ret_val);
19815 call_tests++;
19816 des_xmlNodePtr(n_parent, parent, 0);
19817 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000019818 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
19819 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000019820 xmlResetLastError();
19821 if (mem_base != xmlMemBlocks()) {
19822 printf("Leak of %d blocks found in xmlNewChild",
19823 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019824 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000019825 printf(" %d", n_parent);
19826 printf(" %d", n_ns);
19827 printf(" %d", n_name);
19828 printf(" %d", n_content);
19829 printf("\n");
19830 }
19831 }
19832 }
19833 }
19834 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019835 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000019836#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000019837#endif
Daniel Veillard27f20102004-11-05 11:50:11 +000019838
Daniel Veillard42595322004-11-08 10:52:06 +000019839 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019840}
19841
19842
19843static int
19844test_xmlNewComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019845 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019846
19847 int mem_base;
19848 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019849 xmlChar * content; /* the comment content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019850 int n_content;
19851
19852 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
19853 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019854 content = gen_const_xmlChar_ptr(n_content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019855
William M. Brackf13f77f2004-11-12 16:03:48 +000019856 ret_val = xmlNewComment((const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019857 desret_xmlNodePtr(ret_val);
19858 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000019859 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019860 xmlResetLastError();
19861 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019862 printf("Leak of %d blocks found in xmlNewComment",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019863 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019864 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019865 printf(" %d", n_content);
19866 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019867 }
19868 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019869 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019870
Daniel Veillard42595322004-11-08 10:52:06 +000019871 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019872}
19873
19874
19875static int
19876test_xmlNewDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019877 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019878
19879 int mem_base;
19880 xmlDocPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019881 xmlChar * version; /* xmlChar string giving the version of XML "1.0" */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019882 int n_version;
19883
19884 for (n_version = 0;n_version < gen_nb_const_xmlChar_ptr;n_version++) {
19885 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019886 version = gen_const_xmlChar_ptr(n_version, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019887
William M. Brackf13f77f2004-11-12 16:03:48 +000019888 ret_val = xmlNewDoc((const xmlChar *)version);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019889 desret_xmlDocPtr(ret_val);
19890 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000019891 des_const_xmlChar_ptr(n_version, (const xmlChar *)version, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019892 xmlResetLastError();
19893 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019894 printf("Leak of %d blocks found in xmlNewDoc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019895 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019896 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019897 printf(" %d", n_version);
19898 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019899 }
19900 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019901 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019902
Daniel Veillard42595322004-11-08 10:52:06 +000019903 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019904}
19905
19906
19907static int
19908test_xmlNewDocComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019909 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019910
19911 int mem_base;
19912 xmlNodePtr ret_val;
19913 xmlDocPtr doc; /* the document */
19914 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019915 xmlChar * content; /* the comment content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000019916 int n_content;
19917
19918 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19919 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
19920 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019921 doc = gen_xmlDocPtr(n_doc, 0);
19922 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019923
William M. Brackf13f77f2004-11-12 16:03:48 +000019924 ret_val = xmlNewDocComment(doc, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019925 desret_xmlNodePtr(ret_val);
19926 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019927 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000019928 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019929 xmlResetLastError();
19930 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019931 printf("Leak of %d blocks found in xmlNewDocComment",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019932 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019933 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019934 printf(" %d", n_doc);
19935 printf(" %d", n_content);
19936 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019937 }
19938 }
19939 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000019940 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019941
Daniel Veillard42595322004-11-08 10:52:06 +000019942 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019943}
19944
19945
19946static int
19947test_xmlNewDocFragment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019948 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019949
William M. Brack21e4ef22005-01-02 09:53:13 +000019950#if defined(LIBXML_TREE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000019951 int mem_base;
19952 xmlNodePtr ret_val;
19953 xmlDocPtr doc; /* the document owning the fragment */
19954 int n_doc;
19955
19956 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19957 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000019958 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019959
19960 ret_val = xmlNewDocFragment(doc);
19961 desret_xmlNodePtr(ret_val);
19962 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000019963 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019964 xmlResetLastError();
19965 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000019966 printf("Leak of %d blocks found in xmlNewDocFragment",
Daniel Veillardd93f6252004-11-02 15:53:51 +000019967 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000019968 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000019969 printf(" %d", n_doc);
19970 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000019971 }
19972 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000019973 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019974#endif
19975
Daniel Veillard42595322004-11-08 10:52:06 +000019976 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000019977}
19978
19979
19980static int
19981test_xmlNewDocNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000019982 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019983
Daniel Veillard27f20102004-11-05 11:50:11 +000019984 int mem_base;
19985 xmlNodePtr ret_val;
19986 xmlDocPtr doc; /* the document */
19987 int n_doc;
19988 xmlNsPtr ns; /* namespace if any */
19989 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019990 xmlChar * name; /* the node name */
Daniel Veillard27f20102004-11-05 11:50:11 +000019991 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000019992 xmlChar * content; /* the XML text content if any */
Daniel Veillard27f20102004-11-05 11:50:11 +000019993 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000019994
Daniel Veillard27f20102004-11-05 11:50:11 +000019995 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
19996 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
19997 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
19998 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
19999 mem_base = xmlMemBlocks();
20000 doc = gen_xmlDocPtr(n_doc, 0);
20001 ns = gen_xmlNsPtr(n_ns, 1);
20002 name = gen_const_xmlChar_ptr(n_name, 2);
20003 content = gen_const_xmlChar_ptr(n_content, 3);
20004
William M. Brackf13f77f2004-11-12 16:03:48 +000020005 ret_val = xmlNewDocNode(doc, ns, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillard27f20102004-11-05 11:50:11 +000020006 desret_xmlNodePtr(ret_val);
20007 call_tests++;
20008 des_xmlDocPtr(n_doc, doc, 0);
20009 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000020010 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
20011 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000020012 xmlResetLastError();
20013 if (mem_base != xmlMemBlocks()) {
20014 printf("Leak of %d blocks found in xmlNewDocNode",
20015 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020016 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020017 printf(" %d", n_doc);
20018 printf(" %d", n_ns);
20019 printf(" %d", n_name);
20020 printf(" %d", n_content);
20021 printf("\n");
20022 }
20023 }
20024 }
20025 }
20026 }
Daniel Veillard27f20102004-11-05 11:50:11 +000020027 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020028
Daniel Veillard42595322004-11-08 10:52:06 +000020029 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020030}
20031
20032
20033static int
20034test_xmlNewDocNodeEatName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020035 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020036
Daniel Veillard27f20102004-11-05 11:50:11 +000020037 int mem_base;
20038 xmlNodePtr ret_val;
20039 xmlDocPtr doc; /* the document */
20040 int n_doc;
20041 xmlNsPtr ns; /* namespace if any */
20042 int n_ns;
20043 xmlChar * name; /* the node name */
20044 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020045 xmlChar * content; /* the XML text content if any */
Daniel Veillard27f20102004-11-05 11:50:11 +000020046 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020047
Daniel Veillard27f20102004-11-05 11:50:11 +000020048 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20049 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20050 for (n_name = 0;n_name < gen_nb_eaten_name;n_name++) {
20051 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20052 mem_base = xmlMemBlocks();
20053 doc = gen_xmlDocPtr(n_doc, 0);
20054 ns = gen_xmlNsPtr(n_ns, 1);
20055 name = gen_eaten_name(n_name, 2);
20056 content = gen_const_xmlChar_ptr(n_content, 3);
20057
William M. Brackf13f77f2004-11-12 16:03:48 +000020058 ret_val = xmlNewDocNodeEatName(doc, ns, name, (const xmlChar *)content);
Daniel Veillard27f20102004-11-05 11:50:11 +000020059 desret_xmlNodePtr(ret_val);
20060 call_tests++;
20061 des_xmlDocPtr(n_doc, doc, 0);
20062 des_xmlNsPtr(n_ns, ns, 1);
20063 des_eaten_name(n_name, name, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000020064 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000020065 xmlResetLastError();
20066 if (mem_base != xmlMemBlocks()) {
20067 printf("Leak of %d blocks found in xmlNewDocNodeEatName",
20068 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020069 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020070 printf(" %d", n_doc);
20071 printf(" %d", n_ns);
20072 printf(" %d", n_name);
20073 printf(" %d", n_content);
20074 printf("\n");
20075 }
20076 }
20077 }
20078 }
20079 }
Daniel Veillard27f20102004-11-05 11:50:11 +000020080 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020081
Daniel Veillard42595322004-11-08 10:52:06 +000020082 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020083}
20084
20085
20086static int
20087test_xmlNewDocPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020088 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020089
20090 int mem_base;
20091 xmlNodePtr ret_val;
20092 xmlDocPtr doc; /* the target document */
20093 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020094 xmlChar * name; /* the processing instruction name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020095 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020096 xmlChar * content; /* the PI content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020097 int n_content;
20098
20099 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20100 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20101 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20102 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020103 doc = gen_xmlDocPtr(n_doc, 0);
20104 name = gen_const_xmlChar_ptr(n_name, 1);
20105 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020106
William M. Brackf13f77f2004-11-12 16:03:48 +000020107 ret_val = xmlNewDocPI(doc, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020108 desret_xmlNodePtr(ret_val);
20109 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020110 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020111 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
20112 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020113 xmlResetLastError();
20114 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020115 printf("Leak of %d blocks found in xmlNewDocPI",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020116 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020117 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020118 printf(" %d", n_doc);
20119 printf(" %d", n_name);
20120 printf(" %d", n_content);
20121 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020122 }
20123 }
20124 }
20125 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020126 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020127
Daniel Veillard42595322004-11-08 10:52:06 +000020128 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020129}
20130
20131
20132static int
20133test_xmlNewDocProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020134 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020135
Daniel Veillard57b25162004-11-06 14:50:18 +000020136 int mem_base;
20137 xmlAttrPtr ret_val;
20138 xmlDocPtr doc; /* the document */
20139 int n_doc;
20140 xmlChar * name; /* the name of the attribute */
20141 int n_name;
20142 xmlChar * value; /* the value of the attribute */
20143 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020144
Daniel Veillard57b25162004-11-06 14:50:18 +000020145 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20146 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20147 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20148 mem_base = xmlMemBlocks();
20149 doc = gen_xmlDocPtr(n_doc, 0);
20150 name = gen_const_xmlChar_ptr(n_name, 1);
20151 value = gen_const_xmlChar_ptr(n_value, 2);
20152
William M. Brackf13f77f2004-11-12 16:03:48 +000020153 ret_val = xmlNewDocProp(doc, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000020154 desret_xmlAttrPtr(ret_val);
20155 call_tests++;
20156 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020157 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
20158 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
Daniel Veillard57b25162004-11-06 14:50:18 +000020159 xmlResetLastError();
20160 if (mem_base != xmlMemBlocks()) {
20161 printf("Leak of %d blocks found in xmlNewDocProp",
20162 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020163 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000020164 printf(" %d", n_doc);
20165 printf(" %d", n_name);
20166 printf(" %d", n_value);
20167 printf("\n");
20168 }
20169 }
20170 }
20171 }
Daniel Veillard57b25162004-11-06 14:50:18 +000020172 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020173
Daniel Veillard42595322004-11-08 10:52:06 +000020174 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020175}
20176
20177
20178static int
20179test_xmlNewDocRawNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020180 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020181
William M. Brack21e4ef22005-01-02 09:53:13 +000020182#if defined(LIBXML_TREE_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000020183#ifdef LIBXML_TREE_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +000020184 int mem_base;
20185 xmlNodePtr ret_val;
20186 xmlDocPtr doc; /* the document */
20187 int n_doc;
20188 xmlNsPtr ns; /* namespace if any */
20189 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020190 xmlChar * name; /* the node name */
Daniel Veillard27f20102004-11-05 11:50:11 +000020191 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020192 xmlChar * content; /* the text content if any */
Daniel Veillard27f20102004-11-05 11:50:11 +000020193 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020194
Daniel Veillard27f20102004-11-05 11:50:11 +000020195 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20196 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20197 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20198 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20199 mem_base = xmlMemBlocks();
20200 doc = gen_xmlDocPtr(n_doc, 0);
20201 ns = gen_xmlNsPtr(n_ns, 1);
20202 name = gen_const_xmlChar_ptr(n_name, 2);
20203 content = gen_const_xmlChar_ptr(n_content, 3);
20204
William M. Brackf13f77f2004-11-12 16:03:48 +000020205 ret_val = xmlNewDocRawNode(doc, ns, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillard27f20102004-11-05 11:50:11 +000020206 desret_xmlNodePtr(ret_val);
20207 call_tests++;
20208 des_xmlDocPtr(n_doc, doc, 0);
20209 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000020210 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
20211 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000020212 xmlResetLastError();
20213 if (mem_base != xmlMemBlocks()) {
20214 printf("Leak of %d blocks found in xmlNewDocRawNode",
20215 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020216 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020217 printf(" %d", n_doc);
20218 printf(" %d", n_ns);
20219 printf(" %d", n_name);
20220 printf(" %d", n_content);
20221 printf("\n");
20222 }
20223 }
20224 }
20225 }
20226 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020227 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000020228#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000020229#endif
Daniel Veillard27f20102004-11-05 11:50:11 +000020230
Daniel Veillard42595322004-11-08 10:52:06 +000020231 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020232}
20233
20234
20235static int
20236test_xmlNewDocText(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020237 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020238
20239 int mem_base;
20240 xmlNodePtr ret_val;
20241 xmlDocPtr doc; /* the document */
20242 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020243 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020244 int n_content;
20245
20246 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20247 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20248 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020249 doc = gen_xmlDocPtr(n_doc, 0);
20250 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020251
William M. Brackf13f77f2004-11-12 16:03:48 +000020252 ret_val = xmlNewDocText(doc, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020253 desret_xmlNodePtr(ret_val);
20254 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020255 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020256 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020257 xmlResetLastError();
20258 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020259 printf("Leak of %d blocks found in xmlNewDocText",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020260 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020261 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020262 printf(" %d", n_doc);
20263 printf(" %d", n_content);
20264 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020265 }
20266 }
20267 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020268 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020269
Daniel Veillard42595322004-11-08 10:52:06 +000020270 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020271}
20272
20273
20274static int
20275test_xmlNewDocTextLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020276 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020277
20278 int mem_base;
20279 xmlNodePtr ret_val;
20280 xmlDocPtr doc; /* the document */
20281 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020282 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020283 int n_content;
20284 int len; /* the text len. */
20285 int n_len;
20286
20287 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20288 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20289 for (n_len = 0;n_len < gen_nb_int;n_len++) {
20290 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020291 doc = gen_xmlDocPtr(n_doc, 0);
20292 content = gen_const_xmlChar_ptr(n_content, 1);
20293 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020294
William M. Brackf13f77f2004-11-12 16:03:48 +000020295 ret_val = xmlNewDocTextLen(doc, (const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020296 desret_xmlNodePtr(ret_val);
20297 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020298 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020299 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000020300 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020301 xmlResetLastError();
20302 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020303 printf("Leak of %d blocks found in xmlNewDocTextLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020304 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020305 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020306 printf(" %d", n_doc);
20307 printf(" %d", n_content);
20308 printf(" %d", n_len);
20309 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020310 }
20311 }
20312 }
20313 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020314 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020315
Daniel Veillard42595322004-11-08 10:52:06 +000020316 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020317}
20318
20319
20320static int
20321test_xmlNewDtd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020322 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020323
Daniel Veillard34099b42004-11-04 17:34:35 +000020324 int mem_base;
20325 xmlDtdPtr ret_val;
20326 xmlDocPtr doc; /* the document pointer */
20327 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020328 xmlChar * name; /* the DTD name */
Daniel Veillard34099b42004-11-04 17:34:35 +000020329 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020330 xmlChar * ExternalID; /* the external ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000020331 int n_ExternalID;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020332 xmlChar * SystemID; /* the system ID */
Daniel Veillard34099b42004-11-04 17:34:35 +000020333 int n_SystemID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020334
Daniel Veillard34099b42004-11-04 17:34:35 +000020335 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20336 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20337 for (n_ExternalID = 0;n_ExternalID < gen_nb_const_xmlChar_ptr;n_ExternalID++) {
20338 for (n_SystemID = 0;n_SystemID < gen_nb_const_xmlChar_ptr;n_SystemID++) {
20339 mem_base = xmlMemBlocks();
20340 doc = gen_xmlDocPtr(n_doc, 0);
20341 name = gen_const_xmlChar_ptr(n_name, 1);
20342 ExternalID = gen_const_xmlChar_ptr(n_ExternalID, 2);
20343 SystemID = gen_const_xmlChar_ptr(n_SystemID, 3);
20344
William M. Brackf13f77f2004-11-12 16:03:48 +000020345 ret_val = xmlNewDtd(doc, (const xmlChar *)name, (const xmlChar *)ExternalID, (const xmlChar *)SystemID);
Daniel Veillard34099b42004-11-04 17:34:35 +000020346 desret_xmlDtdPtr(ret_val);
20347 call_tests++;
20348 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020349 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
20350 des_const_xmlChar_ptr(n_ExternalID, (const xmlChar *)ExternalID, 2);
20351 des_const_xmlChar_ptr(n_SystemID, (const xmlChar *)SystemID, 3);
Daniel Veillard34099b42004-11-04 17:34:35 +000020352 xmlResetLastError();
20353 if (mem_base != xmlMemBlocks()) {
20354 printf("Leak of %d blocks found in xmlNewDtd",
20355 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020356 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000020357 printf(" %d", n_doc);
20358 printf(" %d", n_name);
20359 printf(" %d", n_ExternalID);
20360 printf(" %d", n_SystemID);
20361 printf("\n");
20362 }
20363 }
20364 }
20365 }
20366 }
Daniel Veillard34099b42004-11-04 17:34:35 +000020367 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020368
Daniel Veillard42595322004-11-08 10:52:06 +000020369 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020370}
20371
20372
20373static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000020374test_xmlNewNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020375 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020376
Daniel Veillard27f20102004-11-05 11:50:11 +000020377 int mem_base;
20378 xmlNodePtr ret_val;
20379 xmlNsPtr ns; /* namespace if any */
20380 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020381 xmlChar * name; /* the node name */
Daniel Veillard27f20102004-11-05 11:50:11 +000020382 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020383
Daniel Veillard27f20102004-11-05 11:50:11 +000020384 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20385 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20386 mem_base = xmlMemBlocks();
20387 ns = gen_xmlNsPtr(n_ns, 0);
20388 name = gen_const_xmlChar_ptr(n_name, 1);
20389
William M. Brackf13f77f2004-11-12 16:03:48 +000020390 ret_val = xmlNewNode(ns, (const xmlChar *)name);
Daniel Veillard27f20102004-11-05 11:50:11 +000020391 desret_xmlNodePtr(ret_val);
20392 call_tests++;
20393 des_xmlNsPtr(n_ns, ns, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020394 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard27f20102004-11-05 11:50:11 +000020395 xmlResetLastError();
20396 if (mem_base != xmlMemBlocks()) {
20397 printf("Leak of %d blocks found in xmlNewNode",
20398 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020399 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020400 printf(" %d", n_ns);
20401 printf(" %d", n_name);
20402 printf("\n");
20403 }
20404 }
20405 }
Daniel Veillard27f20102004-11-05 11:50:11 +000020406 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020407
Daniel Veillard42595322004-11-08 10:52:06 +000020408 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020409}
20410
20411
20412static int
20413test_xmlNewNodeEatName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020414 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020415
Daniel Veillard27f20102004-11-05 11:50:11 +000020416 int mem_base;
20417 xmlNodePtr ret_val;
20418 xmlNsPtr ns; /* namespace if any */
20419 int n_ns;
20420 xmlChar * name; /* the node name */
20421 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020422
Daniel Veillard27f20102004-11-05 11:50:11 +000020423 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20424 for (n_name = 0;n_name < gen_nb_eaten_name;n_name++) {
20425 mem_base = xmlMemBlocks();
20426 ns = gen_xmlNsPtr(n_ns, 0);
20427 name = gen_eaten_name(n_name, 1);
20428
20429 ret_val = xmlNewNodeEatName(ns, name);
20430 desret_xmlNodePtr(ret_val);
20431 call_tests++;
20432 des_xmlNsPtr(n_ns, ns, 0);
20433 des_eaten_name(n_name, name, 1);
20434 xmlResetLastError();
20435 if (mem_base != xmlMemBlocks()) {
20436 printf("Leak of %d blocks found in xmlNewNodeEatName",
20437 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020438 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020439 printf(" %d", n_ns);
20440 printf(" %d", n_name);
20441 printf("\n");
20442 }
20443 }
20444 }
Daniel Veillard27f20102004-11-05 11:50:11 +000020445 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020446
Daniel Veillard42595322004-11-08 10:52:06 +000020447 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020448}
20449
20450
20451static int
20452test_xmlNewNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020453 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020454
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020455 int mem_base;
20456 xmlNsPtr ret_val;
20457 xmlNodePtr node; /* the element carrying the namespace */
20458 int n_node;
20459 xmlChar * href; /* the URI associated */
20460 int n_href;
20461 xmlChar * prefix; /* the prefix for the namespace */
20462 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020463
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020464 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
20465 for (n_href = 0;n_href < gen_nb_const_xmlChar_ptr;n_href++) {
20466 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
20467 mem_base = xmlMemBlocks();
20468 node = gen_xmlNodePtr(n_node, 0);
20469 href = gen_const_xmlChar_ptr(n_href, 1);
20470 prefix = gen_const_xmlChar_ptr(n_prefix, 2);
20471
William M. Brackf13f77f2004-11-12 16:03:48 +000020472 ret_val = xmlNewNs(node, (const xmlChar *)href, (const xmlChar *)prefix);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020473 if ((node == NULL) && (ret_val != NULL)) xmlFreeNs(ret_val);
20474 desret_xmlNsPtr(ret_val);
20475 call_tests++;
20476 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020477 des_const_xmlChar_ptr(n_href, (const xmlChar *)href, 1);
20478 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020479 xmlResetLastError();
20480 if (mem_base != xmlMemBlocks()) {
20481 printf("Leak of %d blocks found in xmlNewNs",
20482 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020483 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020484 printf(" %d", n_node);
20485 printf(" %d", n_href);
20486 printf(" %d", n_prefix);
20487 printf("\n");
20488 }
20489 }
20490 }
20491 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000020492 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020493
Daniel Veillard42595322004-11-08 10:52:06 +000020494 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020495}
20496
20497
20498static int
20499test_xmlNewNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020500 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020501
Daniel Veillard57b25162004-11-06 14:50:18 +000020502 int mem_base;
20503 xmlAttrPtr ret_val;
20504 xmlNodePtr node; /* the holding node */
20505 int n_node;
20506 xmlNsPtr ns; /* the namespace */
20507 int n_ns;
20508 xmlChar * name; /* the name of the attribute */
20509 int n_name;
20510 xmlChar * value; /* the value of the attribute */
20511 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020512
Daniel Veillard57b25162004-11-06 14:50:18 +000020513 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
20514 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20515 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20516 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20517 mem_base = xmlMemBlocks();
20518 node = gen_xmlNodePtr(n_node, 0);
20519 ns = gen_xmlNsPtr(n_ns, 1);
20520 name = gen_const_xmlChar_ptr(n_name, 2);
20521 value = gen_const_xmlChar_ptr(n_value, 3);
20522
William M. Brackf13f77f2004-11-12 16:03:48 +000020523 ret_val = xmlNewNsProp(node, ns, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000020524 desret_xmlAttrPtr(ret_val);
20525 call_tests++;
20526 des_xmlNodePtr(n_node, node, 0);
20527 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000020528 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
20529 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000020530 xmlResetLastError();
20531 if (mem_base != xmlMemBlocks()) {
20532 printf("Leak of %d blocks found in xmlNewNsProp",
20533 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020534 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000020535 printf(" %d", n_node);
20536 printf(" %d", n_ns);
20537 printf(" %d", n_name);
20538 printf(" %d", n_value);
20539 printf("\n");
20540 }
20541 }
20542 }
20543 }
20544 }
Daniel Veillard57b25162004-11-06 14:50:18 +000020545 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020546
Daniel Veillard42595322004-11-08 10:52:06 +000020547 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020548}
20549
20550
20551static int
20552test_xmlNewNsPropEatName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020553 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020554
Daniel Veillard57b25162004-11-06 14:50:18 +000020555 int mem_base;
20556 xmlAttrPtr ret_val;
20557 xmlNodePtr node; /* the holding node */
20558 int n_node;
20559 xmlNsPtr ns; /* the namespace */
20560 int n_ns;
20561 xmlChar * name; /* the name of the attribute */
20562 int n_name;
20563 xmlChar * value; /* the value of the attribute */
20564 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020565
Daniel Veillard57b25162004-11-06 14:50:18 +000020566 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
20567 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20568 for (n_name = 0;n_name < gen_nb_eaten_name;n_name++) {
20569 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20570 mem_base = xmlMemBlocks();
20571 node = gen_xmlNodePtr(n_node, 0);
20572 ns = gen_xmlNsPtr(n_ns, 1);
20573 name = gen_eaten_name(n_name, 2);
20574 value = gen_const_xmlChar_ptr(n_value, 3);
20575
William M. Brackf13f77f2004-11-12 16:03:48 +000020576 ret_val = xmlNewNsPropEatName(node, ns, name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000020577 desret_xmlAttrPtr(ret_val);
20578 call_tests++;
20579 des_xmlNodePtr(n_node, node, 0);
20580 des_xmlNsPtr(n_ns, ns, 1);
20581 des_eaten_name(n_name, name, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000020582 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000020583 xmlResetLastError();
20584 if (mem_base != xmlMemBlocks()) {
20585 printf("Leak of %d blocks found in xmlNewNsPropEatName",
20586 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020587 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000020588 printf(" %d", n_node);
20589 printf(" %d", n_ns);
20590 printf(" %d", n_name);
20591 printf(" %d", n_value);
20592 printf("\n");
20593 }
20594 }
20595 }
20596 }
20597 }
Daniel Veillard57b25162004-11-06 14:50:18 +000020598 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020599
Daniel Veillard42595322004-11-08 10:52:06 +000020600 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020601}
20602
20603
20604static int
20605test_xmlNewPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020606 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020607
20608 int mem_base;
20609 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020610 xmlChar * name; /* the processing instruction name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020611 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020612 xmlChar * content; /* the PI content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020613 int n_content;
20614
20615 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20616 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20617 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020618 name = gen_const_xmlChar_ptr(n_name, 0);
20619 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020620
William M. Brackf13f77f2004-11-12 16:03:48 +000020621 ret_val = xmlNewPI((const xmlChar *)name, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020622 desret_xmlNodePtr(ret_val);
20623 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000020624 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
20625 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020626 xmlResetLastError();
20627 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020628 printf("Leak of %d blocks found in xmlNewPI",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020629 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020630 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020631 printf(" %d", n_name);
20632 printf(" %d", n_content);
20633 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020634 }
20635 }
20636 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020637 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020638
Daniel Veillard42595322004-11-08 10:52:06 +000020639 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020640}
20641
20642
20643static int
20644test_xmlNewProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020645 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020646
William M. Brack21e4ef22005-01-02 09:53:13 +000020647#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000020648#ifdef LIBXML_TREE_ENABLED
Daniel Veillard57b25162004-11-06 14:50:18 +000020649 int mem_base;
20650 xmlAttrPtr ret_val;
20651 xmlNodePtr node; /* the holding node */
20652 int n_node;
20653 xmlChar * name; /* the name of the attribute */
20654 int n_name;
20655 xmlChar * value; /* the value of the attribute */
20656 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020657
Daniel Veillard57b25162004-11-06 14:50:18 +000020658 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
20659 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20660 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
20661 mem_base = xmlMemBlocks();
20662 node = gen_xmlNodePtr(n_node, 0);
20663 name = gen_const_xmlChar_ptr(n_name, 1);
20664 value = gen_const_xmlChar_ptr(n_value, 2);
20665
William M. Brackf13f77f2004-11-12 16:03:48 +000020666 ret_val = xmlNewProp(node, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000020667 desret_xmlAttrPtr(ret_val);
20668 call_tests++;
20669 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020670 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
20671 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
Daniel Veillard57b25162004-11-06 14:50:18 +000020672 xmlResetLastError();
20673 if (mem_base != xmlMemBlocks()) {
20674 printf("Leak of %d blocks found in xmlNewProp",
20675 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020676 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000020677 printf(" %d", n_node);
20678 printf(" %d", n_name);
20679 printf(" %d", n_value);
20680 printf("\n");
20681 }
20682 }
20683 }
20684 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020685 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000020686#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000020687#endif
Daniel Veillard57b25162004-11-06 14:50:18 +000020688
Daniel Veillard42595322004-11-08 10:52:06 +000020689 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020690}
20691
20692
20693static int
20694test_xmlNewReference(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020695 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020696
20697 int mem_base;
20698 xmlNodePtr ret_val;
20699 xmlDocPtr doc; /* the document */
20700 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020701 xmlChar * name; /* the reference name, or the reference string with & and ; */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020702 int n_name;
20703
20704 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
20705 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20706 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020707 doc = gen_xmlDocPtr(n_doc, 0);
20708 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020709
William M. Brackf13f77f2004-11-12 16:03:48 +000020710 ret_val = xmlNewReference(doc, (const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020711 desret_xmlNodePtr(ret_val);
20712 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020713 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020714 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020715 xmlResetLastError();
20716 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020717 printf("Leak of %d blocks found in xmlNewReference",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020718 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020719 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020720 printf(" %d", n_doc);
20721 printf(" %d", n_name);
20722 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020723 }
20724 }
20725 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020726 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020727
Daniel Veillard42595322004-11-08 10:52:06 +000020728 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020729}
20730
20731
20732static int
20733test_xmlNewText(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020734 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020735
20736 int mem_base;
20737 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020738 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020739 int n_content;
20740
20741 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20742 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020743 content = gen_const_xmlChar_ptr(n_content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020744
William M. Brackf13f77f2004-11-12 16:03:48 +000020745 ret_val = xmlNewText((const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020746 desret_xmlNodePtr(ret_val);
20747 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000020748 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020749 xmlResetLastError();
20750 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020751 printf("Leak of %d blocks found in xmlNewText",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020752 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020753 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020754 printf(" %d", n_content);
20755 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020756 }
20757 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020758 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020759
Daniel Veillard42595322004-11-08 10:52:06 +000020760 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020761}
20762
20763
20764static int
20765test_xmlNewTextChild(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020766 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020767
William M. Brack21e4ef22005-01-02 09:53:13 +000020768#if defined(LIBXML_TREE_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000020769#ifdef LIBXML_TREE_ENABLED
Daniel Veillard27f20102004-11-05 11:50:11 +000020770 int mem_base;
20771 xmlNodePtr ret_val;
20772 xmlNodePtr parent; /* the parent node */
20773 int n_parent;
20774 xmlNsPtr ns; /* a namespace if any */
20775 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020776 xmlChar * name; /* the name of the child */
Daniel Veillard27f20102004-11-05 11:50:11 +000020777 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020778 xmlChar * content; /* the text content of the child if any. */
Daniel Veillard27f20102004-11-05 11:50:11 +000020779 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020780
Daniel Veillard27f20102004-11-05 11:50:11 +000020781 for (n_parent = 0;n_parent < gen_nb_xmlNodePtr;n_parent++) {
20782 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
20783 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
20784 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20785 mem_base = xmlMemBlocks();
20786 parent = gen_xmlNodePtr(n_parent, 0);
20787 ns = gen_xmlNsPtr(n_ns, 1);
20788 name = gen_const_xmlChar_ptr(n_name, 2);
20789 content = gen_const_xmlChar_ptr(n_content, 3);
20790
William M. Brackf13f77f2004-11-12 16:03:48 +000020791 ret_val = xmlNewTextChild(parent, ns, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillard27f20102004-11-05 11:50:11 +000020792 desret_xmlNodePtr(ret_val);
20793 call_tests++;
20794 des_xmlNodePtr(n_parent, parent, 0);
20795 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000020796 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
20797 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000020798 xmlResetLastError();
20799 if (mem_base != xmlMemBlocks()) {
20800 printf("Leak of %d blocks found in xmlNewTextChild",
20801 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020802 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000020803 printf(" %d", n_parent);
20804 printf(" %d", n_ns);
20805 printf(" %d", n_name);
20806 printf(" %d", n_content);
20807 printf("\n");
20808 }
20809 }
20810 }
20811 }
20812 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020813 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000020814#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000020815#endif
Daniel Veillard27f20102004-11-05 11:50:11 +000020816
Daniel Veillard42595322004-11-08 10:52:06 +000020817 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020818}
20819
20820
20821static int
20822test_xmlNewTextLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020823 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020824
20825 int mem_base;
20826 xmlNodePtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020827 xmlChar * content; /* the text content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020828 int n_content;
20829 int len; /* the text len. */
20830 int n_len;
20831
20832 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20833 for (n_len = 0;n_len < gen_nb_int;n_len++) {
20834 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020835 content = gen_const_xmlChar_ptr(n_content, 0);
20836 len = gen_int(n_len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020837
William M. Brackf13f77f2004-11-12 16:03:48 +000020838 ret_val = xmlNewTextLen((const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020839 desret_xmlNodePtr(ret_val);
20840 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000020841 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000020842 des_int(n_len, len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020843 xmlResetLastError();
20844 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020845 printf("Leak of %d blocks found in xmlNewTextLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020846 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020847 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020848 printf(" %d", n_content);
20849 printf(" %d", n_len);
20850 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020851 }
20852 }
20853 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020854 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020855
Daniel Veillard42595322004-11-08 10:52:06 +000020856 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020857}
20858
20859
20860static int
20861test_xmlNodeAddContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020862 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020863
20864 int mem_base;
20865 xmlNodePtr cur; /* the node being modified */
20866 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020867 xmlChar * content; /* extra content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020868 int n_content;
20869
20870 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
20871 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20872 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020873 cur = gen_xmlNodePtr(n_cur, 0);
20874 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020875
William M. Brackf13f77f2004-11-12 16:03:48 +000020876 xmlNodeAddContent(cur, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020877 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020878 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020879 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020880 xmlResetLastError();
20881 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020882 printf("Leak of %d blocks found in xmlNodeAddContent",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020883 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020884 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020885 printf(" %d", n_cur);
20886 printf(" %d", n_content);
20887 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020888 }
20889 }
20890 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020891 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020892
Daniel Veillard42595322004-11-08 10:52:06 +000020893 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020894}
20895
20896
20897static int
20898test_xmlNodeAddContentLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020899 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020900
20901 int mem_base;
20902 xmlNodePtr cur; /* the node being modified */
20903 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000020904 xmlChar * content; /* extra content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000020905 int n_content;
20906 int len; /* the size of @content */
20907 int n_len;
20908
20909 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
20910 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
20911 for (n_len = 0;n_len < gen_nb_int;n_len++) {
20912 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020913 cur = gen_xmlNodePtr(n_cur, 0);
20914 content = gen_const_xmlChar_ptr(n_content, 1);
20915 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020916
William M. Brackf13f77f2004-11-12 16:03:48 +000020917 xmlNodeAddContentLen(cur, (const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020918 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020919 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000020920 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000020921 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020922 xmlResetLastError();
20923 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000020924 printf("Leak of %d blocks found in xmlNodeAddContentLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000020925 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020926 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000020927 printf(" %d", n_cur);
20928 printf(" %d", n_content);
20929 printf(" %d", n_len);
20930 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000020931 }
20932 }
20933 }
20934 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020935 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020936
Daniel Veillard42595322004-11-08 10:52:06 +000020937 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020938}
20939
20940
20941static int
20942test_xmlNodeBufGetContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020943 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020944
Daniel Veillardd005b9e2004-11-03 17:07:05 +000020945 int mem_base;
20946 int ret_val;
20947 xmlBufferPtr buffer; /* a buffer */
20948 int n_buffer;
20949 xmlNodePtr cur; /* the node being read */
20950 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020951
Daniel Veillardd005b9e2004-11-03 17:07:05 +000020952 for (n_buffer = 0;n_buffer < gen_nb_xmlBufferPtr;n_buffer++) {
20953 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
20954 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000020955 buffer = gen_xmlBufferPtr(n_buffer, 0);
20956 cur = gen_xmlNodePtr(n_cur, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000020957
20958 ret_val = xmlNodeBufGetContent(buffer, cur);
20959 desret_int(ret_val);
20960 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000020961 des_xmlBufferPtr(n_buffer, buffer, 0);
20962 des_xmlNodePtr(n_cur, cur, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000020963 xmlResetLastError();
20964 if (mem_base != xmlMemBlocks()) {
20965 printf("Leak of %d blocks found in xmlNodeBufGetContent",
20966 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000020967 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000020968 printf(" %d", n_buffer);
20969 printf(" %d", n_cur);
20970 printf("\n");
20971 }
20972 }
20973 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000020974 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000020975
Daniel Veillard42595322004-11-08 10:52:06 +000020976 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000020977}
20978
20979
20980static int
20981test_xmlNodeDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000020982 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020983
William M. Brack21e4ef22005-01-02 09:53:13 +000020984#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000020985 int mem_base;
20986 int ret_val;
20987 xmlBufferPtr buf; /* the XML buffer output */
20988 int n_buf;
20989 xmlDocPtr doc; /* the document */
20990 int n_doc;
20991 xmlNodePtr cur; /* the current node */
20992 int n_cur;
20993 int level; /* the imbrication level for indenting */
20994 int n_level;
20995 int format; /* is formatting allowed */
20996 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000020997
Daniel Veillardd005b9e2004-11-03 17:07:05 +000020998 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
20999 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21000 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21001 for (n_level = 0;n_level < gen_nb_int;n_level++) {
21002 for (n_format = 0;n_format < gen_nb_int;n_format++) {
21003 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021004 buf = gen_xmlBufferPtr(n_buf, 0);
21005 doc = gen_xmlDocPtr(n_doc, 1);
21006 cur = gen_xmlNodePtr(n_cur, 2);
21007 level = gen_int(n_level, 3);
21008 format = gen_int(n_format, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021009
21010 ret_val = xmlNodeDump(buf, doc, cur, level, format);
21011 desret_int(ret_val);
21012 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021013 des_xmlBufferPtr(n_buf, buf, 0);
21014 des_xmlDocPtr(n_doc, doc, 1);
21015 des_xmlNodePtr(n_cur, cur, 2);
21016 des_int(n_level, level, 3);
21017 des_int(n_format, format, 4);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021018 xmlResetLastError();
21019 if (mem_base != xmlMemBlocks()) {
21020 printf("Leak of %d blocks found in xmlNodeDump",
21021 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021022 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021023 printf(" %d", n_buf);
21024 printf(" %d", n_doc);
21025 printf(" %d", n_cur);
21026 printf(" %d", n_level);
21027 printf(" %d", n_format);
21028 printf("\n");
21029 }
21030 }
21031 }
21032 }
21033 }
21034 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021035 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000021036#endif
21037
Daniel Veillard42595322004-11-08 10:52:06 +000021038 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021039}
21040
21041
21042static int
21043test_xmlNodeDumpOutput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021044 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021045
William M. Brack21e4ef22005-01-02 09:53:13 +000021046#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000021047 int mem_base;
21048 xmlOutputBufferPtr buf; /* the XML buffer output */
21049 int n_buf;
21050 xmlDocPtr doc; /* the document */
21051 int n_doc;
21052 xmlNodePtr cur; /* the current node */
21053 int n_cur;
21054 int level; /* the imbrication level for indenting */
21055 int n_level;
21056 int format; /* is formatting allowed */
21057 int n_format;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021058 char * encoding; /* an optional encoding string */
Daniel Veillard3d97e662004-11-04 10:49:00 +000021059 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021060
Daniel Veillard3d97e662004-11-04 10:49:00 +000021061 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
21062 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21063 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21064 for (n_level = 0;n_level < gen_nb_int;n_level++) {
21065 for (n_format = 0;n_format < gen_nb_int;n_format++) {
21066 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
21067 mem_base = xmlMemBlocks();
21068 buf = gen_xmlOutputBufferPtr(n_buf, 0);
21069 doc = gen_xmlDocPtr(n_doc, 1);
21070 cur = gen_xmlNodePtr(n_cur, 2);
21071 level = gen_int(n_level, 3);
21072 format = gen_int(n_format, 4);
21073 encoding = gen_const_char_ptr(n_encoding, 5);
21074
William M. Brackf13f77f2004-11-12 16:03:48 +000021075 xmlNodeDumpOutput(buf, doc, cur, level, format, (const char *)encoding);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021076 call_tests++;
21077 des_xmlOutputBufferPtr(n_buf, buf, 0);
21078 des_xmlDocPtr(n_doc, doc, 1);
21079 des_xmlNodePtr(n_cur, cur, 2);
21080 des_int(n_level, level, 3);
21081 des_int(n_format, format, 4);
William M. Brackf13f77f2004-11-12 16:03:48 +000021082 des_const_char_ptr(n_encoding, (const char *)encoding, 5);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021083 xmlResetLastError();
21084 if (mem_base != xmlMemBlocks()) {
21085 printf("Leak of %d blocks found in xmlNodeDumpOutput",
21086 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021087 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021088 printf(" %d", n_buf);
21089 printf(" %d", n_doc);
21090 printf(" %d", n_cur);
21091 printf(" %d", n_level);
21092 printf(" %d", n_format);
21093 printf(" %d", n_encoding);
21094 printf("\n");
21095 }
21096 }
21097 }
21098 }
21099 }
21100 }
21101 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021102 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021103#endif
21104
Daniel Veillard42595322004-11-08 10:52:06 +000021105 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021106}
21107
21108
21109static int
21110test_xmlNodeGetBase(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021111 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021112
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021113 int mem_base;
21114 xmlChar * ret_val;
21115 xmlDocPtr doc; /* the document the node pertains to */
21116 int n_doc;
21117 xmlNodePtr cur; /* the node being checked */
21118 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021119
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021120 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21121 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21122 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021123 doc = gen_xmlDocPtr(n_doc, 0);
21124 cur = gen_xmlNodePtr(n_cur, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021125
21126 ret_val = xmlNodeGetBase(doc, cur);
21127 desret_xmlChar_ptr(ret_val);
21128 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021129 des_xmlDocPtr(n_doc, doc, 0);
21130 des_xmlNodePtr(n_cur, cur, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021131 xmlResetLastError();
21132 if (mem_base != xmlMemBlocks()) {
21133 printf("Leak of %d blocks found in xmlNodeGetBase",
21134 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021135 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021136 printf(" %d", n_doc);
21137 printf(" %d", n_cur);
21138 printf("\n");
21139 }
21140 }
21141 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021142 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021143
Daniel Veillard42595322004-11-08 10:52:06 +000021144 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021145}
21146
21147
21148static int
21149test_xmlNodeGetContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021150 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021151
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021152 int mem_base;
21153 xmlChar * ret_val;
21154 xmlNodePtr cur; /* the node being read */
21155 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021156
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021157 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21158 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021159 cur = gen_xmlNodePtr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021160
21161 ret_val = xmlNodeGetContent(cur);
21162 desret_xmlChar_ptr(ret_val);
21163 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021164 des_xmlNodePtr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021165 xmlResetLastError();
21166 if (mem_base != xmlMemBlocks()) {
21167 printf("Leak of %d blocks found in xmlNodeGetContent",
21168 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021169 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021170 printf(" %d", n_cur);
21171 printf("\n");
21172 }
21173 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021174 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021175
Daniel Veillard42595322004-11-08 10:52:06 +000021176 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021177}
21178
21179
21180static int
21181test_xmlNodeGetLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021182 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021183
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021184 int mem_base;
21185 xmlChar * ret_val;
21186 xmlNodePtr cur; /* the node being checked */
21187 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021188
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021189 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21190 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021191 cur = gen_xmlNodePtr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021192
21193 ret_val = xmlNodeGetLang(cur);
21194 desret_xmlChar_ptr(ret_val);
21195 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021196 des_xmlNodePtr(n_cur, cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021197 xmlResetLastError();
21198 if (mem_base != xmlMemBlocks()) {
21199 printf("Leak of %d blocks found in xmlNodeGetLang",
21200 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021201 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021202 printf(" %d", n_cur);
21203 printf("\n");
21204 }
21205 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021206 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021207
Daniel Veillard42595322004-11-08 10:52:06 +000021208 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021209}
21210
21211
21212static int
21213test_xmlNodeGetSpacePreserve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021214 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021215
21216 int mem_base;
21217 int ret_val;
21218 xmlNodePtr cur; /* the node being checked */
21219 int n_cur;
21220
21221 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21222 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021223 cur = gen_xmlNodePtr(n_cur, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021224
21225 ret_val = xmlNodeGetSpacePreserve(cur);
21226 desret_int(ret_val);
21227 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021228 des_xmlNodePtr(n_cur, cur, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021229 xmlResetLastError();
21230 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021231 printf("Leak of %d blocks found in xmlNodeGetSpacePreserve",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021232 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021233 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021234 printf(" %d", n_cur);
21235 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021236 }
21237 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021238 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021239
Daniel Veillard42595322004-11-08 10:52:06 +000021240 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021241}
21242
21243
21244static int
21245test_xmlNodeIsText(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021246 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021247
21248 int mem_base;
21249 int ret_val;
21250 xmlNodePtr node; /* the node */
21251 int n_node;
21252
21253 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
21254 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021255 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021256
21257 ret_val = xmlNodeIsText(node);
21258 desret_int(ret_val);
21259 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021260 des_xmlNodePtr(n_node, node, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021261 xmlResetLastError();
21262 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021263 printf("Leak of %d blocks found in xmlNodeIsText",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021264 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021265 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021266 printf(" %d", n_node);
21267 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021268 }
21269 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021270 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021271
Daniel Veillard42595322004-11-08 10:52:06 +000021272 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021273}
21274
21275
21276static int
21277test_xmlNodeListGetRawString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021278 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021279
William M. Brack21e4ef22005-01-02 09:53:13 +000021280#if defined(LIBXML_TREE_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021281 int mem_base;
21282 xmlChar * ret_val;
21283 xmlDocPtr doc; /* the document */
21284 int n_doc;
21285 xmlNodePtr list; /* a Node list */
21286 int n_list;
21287 int inLine; /* should we replace entity contents or show their external form */
21288 int n_inLine;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021289
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021290 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21291 for (n_list = 0;n_list < gen_nb_xmlNodePtr;n_list++) {
21292 for (n_inLine = 0;n_inLine < gen_nb_int;n_inLine++) {
21293 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021294 doc = gen_xmlDocPtr(n_doc, 0);
21295 list = gen_xmlNodePtr(n_list, 1);
21296 inLine = gen_int(n_inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021297
21298 ret_val = xmlNodeListGetRawString(doc, list, inLine);
21299 desret_xmlChar_ptr(ret_val);
21300 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021301 des_xmlDocPtr(n_doc, doc, 0);
21302 des_xmlNodePtr(n_list, list, 1);
21303 des_int(n_inLine, inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021304 xmlResetLastError();
21305 if (mem_base != xmlMemBlocks()) {
21306 printf("Leak of %d blocks found in xmlNodeListGetRawString",
21307 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021308 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021309 printf(" %d", n_doc);
21310 printf(" %d", n_list);
21311 printf(" %d", n_inLine);
21312 printf("\n");
21313 }
21314 }
21315 }
21316 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021317 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021318#endif
21319
Daniel Veillard42595322004-11-08 10:52:06 +000021320 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021321}
21322
21323
21324static int
21325test_xmlNodeListGetString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021326 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021327
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021328 int mem_base;
21329 xmlChar * ret_val;
21330 xmlDocPtr doc; /* the document */
21331 int n_doc;
21332 xmlNodePtr list; /* a Node list */
21333 int n_list;
21334 int inLine; /* should we replace entity contents or show their external form */
21335 int n_inLine;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021336
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021337 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21338 for (n_list = 0;n_list < gen_nb_xmlNodePtr;n_list++) {
21339 for (n_inLine = 0;n_inLine < gen_nb_int;n_inLine++) {
21340 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021341 doc = gen_xmlDocPtr(n_doc, 0);
21342 list = gen_xmlNodePtr(n_list, 1);
21343 inLine = gen_int(n_inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021344
21345 ret_val = xmlNodeListGetString(doc, list, inLine);
21346 desret_xmlChar_ptr(ret_val);
21347 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021348 des_xmlDocPtr(n_doc, doc, 0);
21349 des_xmlNodePtr(n_list, list, 1);
21350 des_int(n_inLine, inLine, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021351 xmlResetLastError();
21352 if (mem_base != xmlMemBlocks()) {
21353 printf("Leak of %d blocks found in xmlNodeListGetString",
21354 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021355 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021356 printf(" %d", n_doc);
21357 printf(" %d", n_list);
21358 printf(" %d", n_inLine);
21359 printf("\n");
21360 }
21361 }
21362 }
21363 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021364 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021365
Daniel Veillard42595322004-11-08 10:52:06 +000021366 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021367}
21368
21369
21370static int
21371test_xmlNodeSetBase(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021372 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021373
William M. Brack21e4ef22005-01-02 09:53:13 +000021374#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021375 int mem_base;
21376 xmlNodePtr cur; /* the node being changed */
21377 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021378 xmlChar * uri; /* the new base URI */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021379 int n_uri;
21380
21381 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21382 for (n_uri = 0;n_uri < gen_nb_const_xmlChar_ptr;n_uri++) {
21383 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021384 cur = gen_xmlNodePtr(n_cur, 0);
21385 uri = gen_const_xmlChar_ptr(n_uri, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021386
William M. Brackf13f77f2004-11-12 16:03:48 +000021387 xmlNodeSetBase(cur, (const xmlChar *)uri);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021388 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021389 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021390 des_const_xmlChar_ptr(n_uri, (const xmlChar *)uri, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021391 xmlResetLastError();
21392 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021393 printf("Leak of %d blocks found in xmlNodeSetBase",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021394 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021395 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021396 printf(" %d", n_cur);
21397 printf(" %d", n_uri);
21398 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021399 }
21400 }
21401 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021402 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021403#endif
21404
Daniel Veillard42595322004-11-08 10:52:06 +000021405 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021406}
21407
21408
21409static int
21410test_xmlNodeSetContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021411 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021412
21413 int mem_base;
21414 xmlNodePtr cur; /* the node being modified */
21415 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021416 xmlChar * content; /* the new value of the content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021417 int n_content;
21418
21419 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21420 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21421 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021422 cur = gen_xmlNodePtr(n_cur, 0);
21423 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021424
William M. Brackf13f77f2004-11-12 16:03:48 +000021425 xmlNodeSetContent(cur, (const xmlChar *)content);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021426 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021427 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021428 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021429 xmlResetLastError();
21430 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021431 printf("Leak of %d blocks found in xmlNodeSetContent",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021432 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021433 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021434 printf(" %d", n_cur);
21435 printf(" %d", n_content);
21436 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021437 }
21438 }
21439 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000021440 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021441
Daniel Veillard42595322004-11-08 10:52:06 +000021442 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021443}
21444
21445
21446static int
21447test_xmlNodeSetContentLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021448 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021449
William M. Brack21e4ef22005-01-02 09:53:13 +000021450#if defined(LIBXML_TREE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021451 int mem_base;
21452 xmlNodePtr cur; /* the node being modified */
21453 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021454 xmlChar * content; /* the new value of the content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021455 int n_content;
21456 int len; /* the size of @content */
21457 int n_len;
21458
21459 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21460 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
21461 for (n_len = 0;n_len < gen_nb_int;n_len++) {
21462 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021463 cur = gen_xmlNodePtr(n_cur, 0);
21464 content = gen_const_xmlChar_ptr(n_content, 1);
21465 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021466
William M. Brackf13f77f2004-11-12 16:03:48 +000021467 xmlNodeSetContentLen(cur, (const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021468 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021469 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021470 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021471 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021472 xmlResetLastError();
21473 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021474 printf("Leak of %d blocks found in xmlNodeSetContentLen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021475 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021476 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021477 printf(" %d", n_cur);
21478 printf(" %d", n_content);
21479 printf(" %d", n_len);
21480 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021481 }
21482 }
21483 }
21484 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021485 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021486#endif
21487
Daniel Veillard42595322004-11-08 10:52:06 +000021488 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021489}
21490
21491
21492static int
21493test_xmlNodeSetLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021494 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021495
William M. Brack21e4ef22005-01-02 09:53:13 +000021496#if defined(LIBXML_TREE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021497 int mem_base;
21498 xmlNodePtr cur; /* the node being changed */
21499 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021500 xmlChar * lang; /* the language description */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021501 int n_lang;
21502
21503 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21504 for (n_lang = 0;n_lang < gen_nb_const_xmlChar_ptr;n_lang++) {
21505 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021506 cur = gen_xmlNodePtr(n_cur, 0);
21507 lang = gen_const_xmlChar_ptr(n_lang, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021508
William M. Brackf13f77f2004-11-12 16:03:48 +000021509 xmlNodeSetLang(cur, (const xmlChar *)lang);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021510 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021511 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021512 des_const_xmlChar_ptr(n_lang, (const xmlChar *)lang, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021513 xmlResetLastError();
21514 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021515 printf("Leak of %d blocks found in xmlNodeSetLang",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021516 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021517 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021518 printf(" %d", n_cur);
21519 printf(" %d", n_lang);
21520 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021521 }
21522 }
21523 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021524 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021525#endif
21526
Daniel Veillard42595322004-11-08 10:52:06 +000021527 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021528}
21529
21530
21531static int
21532test_xmlNodeSetName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021533 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021534
William M. Brack21e4ef22005-01-02 09:53:13 +000021535#if defined(LIBXML_TREE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021536 int mem_base;
21537 xmlNodePtr cur; /* the node being changed */
21538 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021539 xmlChar * name; /* the new tag name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021540 int n_name;
21541
21542 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21543 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
21544 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021545 cur = gen_xmlNodePtr(n_cur, 0);
21546 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021547
William M. Brackf13f77f2004-11-12 16:03:48 +000021548 xmlNodeSetName(cur, (const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021549 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021550 des_xmlNodePtr(n_cur, cur, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000021551 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021552 xmlResetLastError();
21553 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021554 printf("Leak of %d blocks found in xmlNodeSetName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021555 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021556 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021557 printf(" %d", n_cur);
21558 printf(" %d", n_name);
21559 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021560 }
21561 }
21562 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021563 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021564#endif
21565
Daniel Veillard42595322004-11-08 10:52:06 +000021566 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021567}
21568
21569
21570static int
21571test_xmlNodeSetSpacePreserve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021572 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021573
William M. Brack21e4ef22005-01-02 09:53:13 +000021574#if defined(LIBXML_TREE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021575 int mem_base;
21576 xmlNodePtr cur; /* the node being changed */
21577 int n_cur;
21578 int val; /* the xml:space value ("0": default, 1: "preserve") */
21579 int n_val;
21580
21581 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
21582 for (n_val = 0;n_val < gen_nb_int;n_val++) {
21583 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021584 cur = gen_xmlNodePtr(n_cur, 0);
21585 val = gen_int(n_val, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021586
21587 xmlNodeSetSpacePreserve(cur, val);
21588 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021589 des_xmlNodePtr(n_cur, cur, 0);
21590 des_int(n_val, val, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021591 xmlResetLastError();
21592 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021593 printf("Leak of %d blocks found in xmlNodeSetSpacePreserve",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021594 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021595 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021596 printf(" %d", n_cur);
21597 printf(" %d", n_val);
21598 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021599 }
21600 }
21601 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021602 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021603#endif
21604
Daniel Veillard42595322004-11-08 10:52:06 +000021605 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021606}
21607
21608
21609static int
21610test_xmlReconciliateNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021611 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021612
William M. Brack21e4ef22005-01-02 09:53:13 +000021613#if defined(LIBXML_TREE_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000021614#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000021615 int mem_base;
21616 int ret_val;
21617 xmlDocPtr doc; /* the document */
21618 int n_doc;
21619 xmlNodePtr tree; /* a node defining the subtree to reconciliate */
21620 int n_tree;
21621
21622 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
21623 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
21624 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021625 doc = gen_xmlDocPtr(n_doc, 0);
21626 tree = gen_xmlNodePtr(n_tree, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021627
21628 ret_val = xmlReconciliateNs(doc, tree);
21629 desret_int(ret_val);
21630 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021631 des_xmlDocPtr(n_doc, doc, 0);
21632 des_xmlNodePtr(n_tree, tree, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021633 xmlResetLastError();
21634 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021635 printf("Leak of %d blocks found in xmlReconciliateNs",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021636 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021637 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021638 printf(" %d", n_doc);
21639 printf(" %d", n_tree);
21640 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021641 }
21642 }
21643 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021644 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000021645#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000021646#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000021647
Daniel Veillard42595322004-11-08 10:52:06 +000021648 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021649}
21650
21651
21652static int
21653test_xmlRemoveProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021654 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021655
William M. Brack21e4ef22005-01-02 09:53:13 +000021656#if defined(LIBXML_TREE_ENABLED)
Daniel Veillardce244ad2004-11-05 10:03:46 +000021657 int mem_base;
21658 int ret_val;
21659 xmlAttrPtr cur; /* an attribute */
21660 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021661
Daniel Veillardce244ad2004-11-05 10:03:46 +000021662 for (n_cur = 0;n_cur < gen_nb_xmlAttrPtr;n_cur++) {
21663 mem_base = xmlMemBlocks();
21664 cur = gen_xmlAttrPtr(n_cur, 0);
21665
21666 ret_val = xmlRemoveProp(cur);
21667 cur = NULL;
21668 desret_int(ret_val);
21669 call_tests++;
21670 des_xmlAttrPtr(n_cur, cur, 0);
21671 xmlResetLastError();
21672 if (mem_base != xmlMemBlocks()) {
21673 printf("Leak of %d blocks found in xmlRemoveProp",
21674 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021675 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000021676 printf(" %d", n_cur);
21677 printf("\n");
21678 }
21679 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021680 function_tests++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000021681#endif
21682
Daniel Veillard42595322004-11-08 10:52:06 +000021683 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021684}
21685
21686
21687static int
21688test_xmlReplaceNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021689 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021690
William M. Brack21e4ef22005-01-02 09:53:13 +000021691#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021692 int mem_base;
21693 xmlNodePtr ret_val;
21694 xmlNodePtr old; /* the old node */
21695 int n_old;
21696 xmlNodePtr cur; /* the node */
21697 int n_cur;
21698
21699 for (n_old = 0;n_old < gen_nb_xmlNodePtr;n_old++) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021700 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr_in;n_cur++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000021701 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021702 old = gen_xmlNodePtr(n_old, 0);
21703 cur = gen_xmlNodePtr_in(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021704
21705 ret_val = xmlReplaceNode(old, cur);
Daniel Veillardce244ad2004-11-05 10:03:46 +000021706 if (cur != NULL) {
21707 xmlUnlinkNode(cur);
Daniel Veillarda03e3652004-11-02 18:45:30 +000021708 xmlFreeNode(cur) ; cur = NULL ; }
Daniel Veillardce244ad2004-11-05 10:03:46 +000021709 if (old != NULL) {
21710 xmlUnlinkNode(old);
21711 xmlFreeNode(old) ; old = NULL ; }
21712 ret_val = NULL;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000021713 desret_xmlNodePtr(ret_val);
21714 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021715 des_xmlNodePtr(n_old, old, 0);
21716 des_xmlNodePtr_in(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021717 xmlResetLastError();
21718 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021719 printf("Leak of %d blocks found in xmlReplaceNode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021720 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021721 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021722 printf(" %d", n_old);
21723 printf(" %d", n_cur);
21724 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021725 }
21726 }
21727 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021728 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021729#endif
21730
Daniel Veillard42595322004-11-08 10:52:06 +000021731 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021732}
21733
21734
21735static int
21736test_xmlSaveFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021737 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021738
William M. Brack21e4ef22005-01-02 09:53:13 +000021739#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021740 int mem_base;
21741 int ret_val;
21742 const char * filename; /* the filename (or URL) */
21743 int n_filename;
21744 xmlDocPtr cur; /* the document */
21745 int n_cur;
21746
21747 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
21748 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
21749 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021750 filename = gen_fileoutput(n_filename, 0);
21751 cur = gen_xmlDocPtr(n_cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021752
21753 ret_val = xmlSaveFile(filename, cur);
21754 desret_int(ret_val);
21755 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021756 des_fileoutput(n_filename, filename, 0);
21757 des_xmlDocPtr(n_cur, cur, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021758 xmlResetLastError();
21759 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021760 printf("Leak of %d blocks found in xmlSaveFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021761 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021762 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021763 printf(" %d", n_filename);
21764 printf(" %d", n_cur);
21765 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021766 }
21767 }
21768 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021769 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021770#endif
21771
Daniel Veillard42595322004-11-08 10:52:06 +000021772 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021773}
21774
21775
21776static int
21777test_xmlSaveFileEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021778 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021779
William M. Brack21e4ef22005-01-02 09:53:13 +000021780#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021781 int mem_base;
21782 int ret_val;
21783 const char * filename; /* the filename (or URL) */
21784 int n_filename;
21785 xmlDocPtr cur; /* the document */
21786 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021787 char * encoding; /* the name of an encoding (or NULL) */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021788 int n_encoding;
21789
21790 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
21791 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
21792 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
21793 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021794 filename = gen_fileoutput(n_filename, 0);
21795 cur = gen_xmlDocPtr(n_cur, 1);
21796 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021797
William M. Brackf13f77f2004-11-12 16:03:48 +000021798 ret_val = xmlSaveFileEnc(filename, cur, (const char *)encoding);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021799 desret_int(ret_val);
21800 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021801 des_fileoutput(n_filename, filename, 0);
21802 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000021803 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021804 xmlResetLastError();
21805 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021806 printf("Leak of %d blocks found in xmlSaveFileEnc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021807 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021808 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021809 printf(" %d", n_filename);
21810 printf(" %d", n_cur);
21811 printf(" %d", n_encoding);
21812 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021813 }
21814 }
21815 }
21816 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021817 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021818#endif
21819
Daniel Veillard42595322004-11-08 10:52:06 +000021820 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021821}
21822
21823
21824static int
21825test_xmlSaveFileTo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021826 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021827
William M. Brack21e4ef22005-01-02 09:53:13 +000021828#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000021829 int mem_base;
21830 int ret_val;
21831 xmlOutputBufferPtr buf; /* an output I/O buffer */
21832 int n_buf;
21833 xmlDocPtr cur; /* the document */
21834 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021835 char * encoding; /* the encoding if any assuming the I/O layer handles the trancoding */
Daniel Veillard3d97e662004-11-04 10:49:00 +000021836 int n_encoding;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021837
Daniel Veillard3d97e662004-11-04 10:49:00 +000021838 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
21839 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
21840 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
21841 mem_base = xmlMemBlocks();
21842 buf = gen_xmlOutputBufferPtr(n_buf, 0);
21843 cur = gen_xmlDocPtr(n_cur, 1);
21844 encoding = gen_const_char_ptr(n_encoding, 2);
21845
William M. Brackf13f77f2004-11-12 16:03:48 +000021846 ret_val = xmlSaveFileTo(buf, cur, (const char *)encoding);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021847 buf = NULL;
21848 desret_int(ret_val);
21849 call_tests++;
21850 des_xmlOutputBufferPtr(n_buf, buf, 0);
21851 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000021852 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021853 xmlResetLastError();
21854 if (mem_base != xmlMemBlocks()) {
21855 printf("Leak of %d blocks found in xmlSaveFileTo",
21856 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021857 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021858 printf(" %d", n_buf);
21859 printf(" %d", n_cur);
21860 printf(" %d", n_encoding);
21861 printf("\n");
21862 }
21863 }
21864 }
21865 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021866 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021867#endif
21868
Daniel Veillard42595322004-11-08 10:52:06 +000021869 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021870}
21871
21872
21873static int
21874test_xmlSaveFormatFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021875 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021876
William M. Brack21e4ef22005-01-02 09:53:13 +000021877#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021878 int mem_base;
21879 int ret_val;
21880 const char * filename; /* the filename (or URL) */
21881 int n_filename;
21882 xmlDocPtr cur; /* the document */
21883 int n_cur;
21884 int format; /* should formatting spaces been added */
21885 int n_format;
21886
21887 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
21888 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
21889 for (n_format = 0;n_format < gen_nb_int;n_format++) {
21890 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021891 filename = gen_fileoutput(n_filename, 0);
21892 cur = gen_xmlDocPtr(n_cur, 1);
21893 format = gen_int(n_format, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021894
21895 ret_val = xmlSaveFormatFile(filename, cur, format);
21896 desret_int(ret_val);
21897 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021898 des_fileoutput(n_filename, filename, 0);
21899 des_xmlDocPtr(n_cur, cur, 1);
21900 des_int(n_format, format, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021901 xmlResetLastError();
21902 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021903 printf("Leak of %d blocks found in xmlSaveFormatFile",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021904 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021905 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021906 printf(" %d", n_filename);
21907 printf(" %d", n_cur);
21908 printf(" %d", n_format);
21909 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021910 }
21911 }
21912 }
21913 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021914 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021915#endif
21916
Daniel Veillard42595322004-11-08 10:52:06 +000021917 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021918}
21919
21920
21921static int
21922test_xmlSaveFormatFileEnc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021923 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021924
William M. Brack21e4ef22005-01-02 09:53:13 +000021925#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000021926 int mem_base;
21927 int ret_val;
21928 const char * filename; /* the filename or URL to output */
21929 int n_filename;
21930 xmlDocPtr cur; /* the document being saved */
21931 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021932 char * encoding; /* the name of the encoding to use or NULL. */
Daniel Veillardd93f6252004-11-02 15:53:51 +000021933 int n_encoding;
21934 int format; /* should formatting spaces be added. */
21935 int n_format;
21936
21937 for (n_filename = 0;n_filename < gen_nb_fileoutput;n_filename++) {
21938 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
21939 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
21940 for (n_format = 0;n_format < gen_nb_int;n_format++) {
21941 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000021942 filename = gen_fileoutput(n_filename, 0);
21943 cur = gen_xmlDocPtr(n_cur, 1);
21944 encoding = gen_const_char_ptr(n_encoding, 2);
21945 format = gen_int(n_format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021946
William M. Brackf13f77f2004-11-12 16:03:48 +000021947 ret_val = xmlSaveFormatFileEnc(filename, cur, (const char *)encoding, format);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021948 desret_int(ret_val);
21949 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000021950 des_fileoutput(n_filename, filename, 0);
21951 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000021952 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +000021953 des_int(n_format, format, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021954 xmlResetLastError();
21955 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000021956 printf("Leak of %d blocks found in xmlSaveFormatFileEnc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000021957 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000021958 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000021959 printf(" %d", n_filename);
21960 printf(" %d", n_cur);
21961 printf(" %d", n_encoding);
21962 printf(" %d", n_format);
21963 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000021964 }
21965 }
21966 }
21967 }
21968 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000021969 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021970#endif
21971
Daniel Veillard42595322004-11-08 10:52:06 +000021972 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000021973}
21974
21975
21976static int
21977test_xmlSaveFormatFileTo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000021978 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021979
William M. Brack21e4ef22005-01-02 09:53:13 +000021980#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000021981 int mem_base;
21982 int ret_val;
21983 xmlOutputBufferPtr buf; /* an output I/O buffer */
21984 int n_buf;
21985 xmlDocPtr cur; /* the document */
21986 int n_cur;
Daniel Veillardce682bc2004-11-05 17:22:25 +000021987 char * encoding; /* the encoding if any assuming the I/O layer handles the trancoding */
Daniel Veillard3d97e662004-11-04 10:49:00 +000021988 int n_encoding;
21989 int format; /* should formatting spaces been added */
21990 int n_format;
Daniel Veillardd93f6252004-11-02 15:53:51 +000021991
Daniel Veillard3d97e662004-11-04 10:49:00 +000021992 for (n_buf = 0;n_buf < gen_nb_xmlOutputBufferPtr;n_buf++) {
21993 for (n_cur = 0;n_cur < gen_nb_xmlDocPtr;n_cur++) {
21994 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
21995 for (n_format = 0;n_format < gen_nb_int;n_format++) {
21996 mem_base = xmlMemBlocks();
21997 buf = gen_xmlOutputBufferPtr(n_buf, 0);
21998 cur = gen_xmlDocPtr(n_cur, 1);
21999 encoding = gen_const_char_ptr(n_encoding, 2);
22000 format = gen_int(n_format, 3);
22001
William M. Brackf13f77f2004-11-12 16:03:48 +000022002 ret_val = xmlSaveFormatFileTo(buf, cur, (const char *)encoding, format);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022003 buf = NULL;
22004 desret_int(ret_val);
22005 call_tests++;
22006 des_xmlOutputBufferPtr(n_buf, buf, 0);
22007 des_xmlDocPtr(n_cur, cur, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022008 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022009 des_int(n_format, format, 3);
22010 xmlResetLastError();
22011 if (mem_base != xmlMemBlocks()) {
22012 printf("Leak of %d blocks found in xmlSaveFormatFileTo",
22013 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022014 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022015 printf(" %d", n_buf);
22016 printf(" %d", n_cur);
22017 printf(" %d", n_encoding);
22018 printf(" %d", n_format);
22019 printf("\n");
22020 }
22021 }
22022 }
22023 }
22024 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022025 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022026#endif
22027
Daniel Veillard42595322004-11-08 10:52:06 +000022028 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022029}
22030
22031
22032static int
22033test_xmlSearchNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022034 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022035
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022036 int mem_base;
22037 xmlNsPtr ret_val;
22038 xmlDocPtr doc; /* the document */
22039 int n_doc;
22040 xmlNodePtr node; /* the current node */
22041 int n_node;
22042 xmlChar * nameSpace; /* the namespace prefix */
22043 int n_nameSpace;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022044
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022045 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22046 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22047 for (n_nameSpace = 0;n_nameSpace < gen_nb_const_xmlChar_ptr;n_nameSpace++) {
22048 mem_base = xmlMemBlocks();
22049 doc = gen_xmlDocPtr(n_doc, 0);
22050 node = gen_xmlNodePtr(n_node, 1);
22051 nameSpace = gen_const_xmlChar_ptr(n_nameSpace, 2);
22052
William M. Brackf13f77f2004-11-12 16:03:48 +000022053 ret_val = xmlSearchNs(doc, node, (const xmlChar *)nameSpace);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022054 desret_xmlNsPtr(ret_val);
22055 call_tests++;
22056 des_xmlDocPtr(n_doc, doc, 0);
22057 des_xmlNodePtr(n_node, node, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022058 des_const_xmlChar_ptr(n_nameSpace, (const xmlChar *)nameSpace, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022059 xmlResetLastError();
22060 if (mem_base != xmlMemBlocks()) {
22061 printf("Leak of %d blocks found in xmlSearchNs",
22062 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022063 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022064 printf(" %d", n_doc);
22065 printf(" %d", n_node);
22066 printf(" %d", n_nameSpace);
22067 printf("\n");
22068 }
22069 }
22070 }
22071 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022072 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022073
Daniel Veillard42595322004-11-08 10:52:06 +000022074 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022075}
22076
22077
22078static int
22079test_xmlSearchNsByHref(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022080 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022081
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022082 int mem_base;
22083 xmlNsPtr ret_val;
22084 xmlDocPtr doc; /* the document */
22085 int n_doc;
22086 xmlNodePtr node; /* the current node */
22087 int n_node;
22088 xmlChar * href; /* the namespace value */
22089 int n_href;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022090
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022091 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22092 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22093 for (n_href = 0;n_href < gen_nb_const_xmlChar_ptr;n_href++) {
22094 mem_base = xmlMemBlocks();
22095 doc = gen_xmlDocPtr(n_doc, 0);
22096 node = gen_xmlNodePtr(n_node, 1);
22097 href = gen_const_xmlChar_ptr(n_href, 2);
22098
William M. Brackf13f77f2004-11-12 16:03:48 +000022099 ret_val = xmlSearchNsByHref(doc, node, (const xmlChar *)href);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022100 desret_xmlNsPtr(ret_val);
22101 call_tests++;
22102 des_xmlDocPtr(n_doc, doc, 0);
22103 des_xmlNodePtr(n_node, node, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022104 des_const_xmlChar_ptr(n_href, (const xmlChar *)href, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022105 xmlResetLastError();
22106 if (mem_base != xmlMemBlocks()) {
22107 printf("Leak of %d blocks found in xmlSearchNsByHref",
22108 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022109 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022110 printf(" %d", n_doc);
22111 printf(" %d", n_node);
22112 printf(" %d", n_href);
22113 printf("\n");
22114 }
22115 }
22116 }
22117 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022118 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022119
Daniel Veillard42595322004-11-08 10:52:06 +000022120 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022121}
22122
22123
22124static int
22125test_xmlSetBufferAllocationScheme(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022126 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022127
Daniel Veillard57b25162004-11-06 14:50:18 +000022128 int mem_base;
22129 xmlBufferAllocationScheme scheme; /* allocation method to use */
22130 int n_scheme;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022131
Daniel Veillard57b25162004-11-06 14:50:18 +000022132 for (n_scheme = 0;n_scheme < gen_nb_xmlBufferAllocationScheme;n_scheme++) {
22133 mem_base = xmlMemBlocks();
22134 scheme = gen_xmlBufferAllocationScheme(n_scheme, 0);
22135
22136 xmlSetBufferAllocationScheme(scheme);
22137 call_tests++;
22138 des_xmlBufferAllocationScheme(n_scheme, scheme, 0);
22139 xmlResetLastError();
22140 if (mem_base != xmlMemBlocks()) {
22141 printf("Leak of %d blocks found in xmlSetBufferAllocationScheme",
22142 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022143 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022144 printf(" %d", n_scheme);
22145 printf("\n");
22146 }
22147 }
Daniel Veillard57b25162004-11-06 14:50:18 +000022148 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022149
Daniel Veillard42595322004-11-08 10:52:06 +000022150 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022151}
22152
22153
22154static int
22155test_xmlSetCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022156 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022157
22158 int mem_base;
22159 int mode; /* the compression ratio */
22160 int n_mode;
22161
22162 for (n_mode = 0;n_mode < gen_nb_int;n_mode++) {
22163 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022164 mode = gen_int(n_mode, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022165
22166 xmlSetCompressMode(mode);
22167 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022168 des_int(n_mode, mode, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022169 xmlResetLastError();
22170 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022171 printf("Leak of %d blocks found in xmlSetCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022172 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022173 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022174 printf(" %d", n_mode);
22175 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022176 }
22177 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022178 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022179
Daniel Veillard42595322004-11-08 10:52:06 +000022180 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022181}
22182
22183
22184static int
22185test_xmlSetDocCompressMode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022186 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022187
22188 int mem_base;
22189 xmlDocPtr doc; /* the document */
22190 int n_doc;
22191 int mode; /* the compression ratio */
22192 int n_mode;
22193
22194 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22195 for (n_mode = 0;n_mode < gen_nb_int;n_mode++) {
22196 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022197 doc = gen_xmlDocPtr(n_doc, 0);
22198 mode = gen_int(n_mode, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022199
22200 xmlSetDocCompressMode(doc, mode);
22201 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022202 des_xmlDocPtr(n_doc, doc, 0);
22203 des_int(n_mode, mode, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022204 xmlResetLastError();
22205 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022206 printf("Leak of %d blocks found in xmlSetDocCompressMode",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022207 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022208 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022209 printf(" %d", n_doc);
22210 printf(" %d", n_mode);
22211 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022212 }
22213 }
22214 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022215 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022216
Daniel Veillard42595322004-11-08 10:52:06 +000022217 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022218}
22219
22220
22221static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000022222test_xmlSetNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022223 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022224
Daniel Veillard27f20102004-11-05 11:50:11 +000022225 int mem_base;
22226 xmlNodePtr node; /* a node in the document */
22227 int n_node;
22228 xmlNsPtr ns; /* a namespace pointer */
22229 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022230
Daniel Veillard27f20102004-11-05 11:50:11 +000022231 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22232 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
22233 mem_base = xmlMemBlocks();
22234 node = gen_xmlNodePtr(n_node, 0);
22235 ns = gen_xmlNsPtr(n_ns, 1);
22236
22237 xmlSetNs(node, ns);
22238 call_tests++;
22239 des_xmlNodePtr(n_node, node, 0);
22240 des_xmlNsPtr(n_ns, ns, 1);
22241 xmlResetLastError();
22242 if (mem_base != xmlMemBlocks()) {
22243 printf("Leak of %d blocks found in xmlSetNs",
22244 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022245 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000022246 printf(" %d", n_node);
22247 printf(" %d", n_ns);
22248 printf("\n");
22249 }
22250 }
22251 }
Daniel Veillard27f20102004-11-05 11:50:11 +000022252 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022253
Daniel Veillard42595322004-11-08 10:52:06 +000022254 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022255}
22256
22257
22258static int
22259test_xmlSetNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022260 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022261
William M. Brack21e4ef22005-01-02 09:53:13 +000022262#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +000022263 int mem_base;
22264 xmlAttrPtr ret_val;
22265 xmlNodePtr node; /* the node */
22266 int n_node;
22267 xmlNsPtr ns; /* the namespace definition */
22268 int n_ns;
22269 xmlChar * name; /* the attribute name */
22270 int n_name;
22271 xmlChar * value; /* the attribute value */
22272 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022273
Daniel Veillard57b25162004-11-06 14:50:18 +000022274 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22275 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
22276 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22277 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22278 mem_base = xmlMemBlocks();
22279 node = gen_xmlNodePtr(n_node, 0);
22280 ns = gen_xmlNsPtr(n_ns, 1);
22281 name = gen_const_xmlChar_ptr(n_name, 2);
22282 value = gen_const_xmlChar_ptr(n_value, 3);
22283
William M. Brackf13f77f2004-11-12 16:03:48 +000022284 ret_val = xmlSetNsProp(node, ns, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000022285 desret_xmlAttrPtr(ret_val);
22286 call_tests++;
22287 des_xmlNodePtr(n_node, node, 0);
22288 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022289 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
22290 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 3);
Daniel Veillard57b25162004-11-06 14:50:18 +000022291 xmlResetLastError();
22292 if (mem_base != xmlMemBlocks()) {
22293 printf("Leak of %d blocks found in xmlSetNsProp",
22294 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022295 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022296 printf(" %d", n_node);
22297 printf(" %d", n_ns);
22298 printf(" %d", n_name);
22299 printf(" %d", n_value);
22300 printf("\n");
22301 }
22302 }
22303 }
22304 }
22305 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022306 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022307#endif
22308
Daniel Veillard42595322004-11-08 10:52:06 +000022309 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022310}
22311
22312
22313static int
22314test_xmlSetProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022315 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022316
William M. Brack21e4ef22005-01-02 09:53:13 +000022317#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +000022318 int mem_base;
22319 xmlAttrPtr ret_val;
22320 xmlNodePtr node; /* the node */
22321 int n_node;
22322 xmlChar * name; /* the attribute name */
22323 int n_name;
22324 xmlChar * value; /* the attribute value */
22325 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022326
Daniel Veillard57b25162004-11-06 14:50:18 +000022327 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22328 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22329 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22330 mem_base = xmlMemBlocks();
22331 node = gen_xmlNodePtr(n_node, 0);
22332 name = gen_const_xmlChar_ptr(n_name, 1);
22333 value = gen_const_xmlChar_ptr(n_value, 2);
22334
William M. Brackf13f77f2004-11-12 16:03:48 +000022335 ret_val = xmlSetProp(node, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000022336 desret_xmlAttrPtr(ret_val);
22337 call_tests++;
22338 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000022339 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
22340 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
Daniel Veillard57b25162004-11-06 14:50:18 +000022341 xmlResetLastError();
22342 if (mem_base != xmlMemBlocks()) {
22343 printf("Leak of %d blocks found in xmlSetProp",
22344 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022345 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022346 printf(" %d", n_node);
22347 printf(" %d", n_name);
22348 printf(" %d", n_value);
22349 printf("\n");
22350 }
22351 }
22352 }
22353 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022354 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +000022355#endif
22356
Daniel Veillard42595322004-11-08 10:52:06 +000022357 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022358}
22359
22360
22361static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000022362test_xmlSplitQName2(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022363 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022364
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022365 int mem_base;
22366 xmlChar * ret_val;
22367 xmlChar * name; /* the full QName */
22368 int n_name;
22369 xmlChar ** prefix; /* a xmlChar ** */
22370 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022371
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022372 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22373 for (n_prefix = 0;n_prefix < gen_nb_xmlChar_ptr_ptr;n_prefix++) {
22374 mem_base = xmlMemBlocks();
22375 name = gen_const_xmlChar_ptr(n_name, 0);
22376 prefix = gen_xmlChar_ptr_ptr(n_prefix, 1);
22377
William M. Brackf13f77f2004-11-12 16:03:48 +000022378 ret_val = xmlSplitQName2((const xmlChar *)name, prefix);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022379 desret_xmlChar_ptr(ret_val);
22380 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000022381 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022382 des_xmlChar_ptr_ptr(n_prefix, prefix, 1);
22383 xmlResetLastError();
22384 if (mem_base != xmlMemBlocks()) {
22385 printf("Leak of %d blocks found in xmlSplitQName2",
22386 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022387 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022388 printf(" %d", n_name);
22389 printf(" %d", n_prefix);
22390 printf("\n");
22391 }
22392 }
22393 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000022394 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022395
Daniel Veillard42595322004-11-08 10:52:06 +000022396 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022397}
22398
22399
22400static int
22401test_xmlSplitQName3(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022402 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022403
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022404 int mem_base;
22405 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022406 xmlChar * name; /* the full QName */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022407 int n_name;
22408 int * len; /* an int * */
22409 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022410
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022411 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22412 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
22413 mem_base = xmlMemBlocks();
22414 name = gen_const_xmlChar_ptr(n_name, 0);
22415 len = gen_int_ptr(n_len, 1);
22416
William M. Brackf13f77f2004-11-12 16:03:48 +000022417 ret_val = xmlSplitQName3((const xmlChar *)name, len);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022418 desret_const_xmlChar_ptr(ret_val);
22419 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000022420 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022421 des_int_ptr(n_len, len, 1);
22422 xmlResetLastError();
22423 if (mem_base != xmlMemBlocks()) {
22424 printf("Leak of %d blocks found in xmlSplitQName3",
22425 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022426 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022427 printf(" %d", n_name);
22428 printf(" %d", n_len);
22429 printf("\n");
22430 }
22431 }
22432 }
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000022433 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022434
Daniel Veillard42595322004-11-08 10:52:06 +000022435 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022436}
22437
22438
22439static int
22440test_xmlStringGetNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022441 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022442
22443 int mem_base;
22444 xmlNodePtr ret_val;
22445 xmlDocPtr doc; /* the document */
22446 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022447 xmlChar * value; /* the value of the attribute */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022448 int n_value;
22449
22450 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22451 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22452 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022453 doc = gen_xmlDocPtr(n_doc, 0);
22454 value = gen_const_xmlChar_ptr(n_value, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022455
William M. Brackf13f77f2004-11-12 16:03:48 +000022456 ret_val = xmlStringGetNodeList(doc, (const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022457 desret_xmlNodePtr(ret_val);
22458 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022459 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000022460 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022461 xmlResetLastError();
22462 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022463 printf("Leak of %d blocks found in xmlStringGetNodeList",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022464 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022465 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022466 printf(" %d", n_doc);
22467 printf(" %d", n_value);
22468 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022469 }
22470 }
22471 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022472 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022473
Daniel Veillard42595322004-11-08 10:52:06 +000022474 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022475}
22476
22477
22478static int
22479test_xmlStringLenGetNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022480 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022481
22482 int mem_base;
22483 xmlNodePtr ret_val;
22484 xmlDocPtr doc; /* the document */
22485 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022486 xmlChar * value; /* the value of the text */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022487 int n_value;
22488 int len; /* the length of the string value */
22489 int n_len;
22490
22491 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
22492 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22493 for (n_len = 0;n_len < gen_nb_int;n_len++) {
22494 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022495 doc = gen_xmlDocPtr(n_doc, 0);
22496 value = gen_const_xmlChar_ptr(n_value, 1);
22497 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022498
William M. Brackf13f77f2004-11-12 16:03:48 +000022499 ret_val = xmlStringLenGetNodeList(doc, (const xmlChar *)value, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022500 desret_xmlNodePtr(ret_val);
22501 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022502 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000022503 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022504 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022505 xmlResetLastError();
22506 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022507 printf("Leak of %d blocks found in xmlStringLenGetNodeList",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022508 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022509 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022510 printf(" %d", n_doc);
22511 printf(" %d", n_value);
22512 printf(" %d", n_len);
22513 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022514 }
22515 }
22516 }
22517 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022518 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022519
Daniel Veillard42595322004-11-08 10:52:06 +000022520 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022521}
22522
22523
22524static int
22525test_xmlTextConcat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022526 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022527
22528 int mem_base;
22529 int ret_val;
22530 xmlNodePtr node; /* the node */
22531 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022532 xmlChar * content; /* the content */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022533 int n_content;
22534 int len; /* @content length */
22535 int n_len;
22536
22537 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22538 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
22539 for (n_len = 0;n_len < gen_nb_int;n_len++) {
22540 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022541 node = gen_xmlNodePtr(n_node, 0);
22542 content = gen_const_xmlChar_ptr(n_content, 1);
22543 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022544
William M. Brackf13f77f2004-11-12 16:03:48 +000022545 ret_val = xmlTextConcat(node, (const xmlChar *)content, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022546 desret_int(ret_val);
22547 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022548 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000022549 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022550 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022551 xmlResetLastError();
22552 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022553 printf("Leak of %d blocks found in xmlTextConcat",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022554 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022555 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022556 printf(" %d", n_node);
22557 printf(" %d", n_content);
22558 printf(" %d", n_len);
22559 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022560 }
22561 }
22562 }
22563 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022564 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022565
Daniel Veillard42595322004-11-08 10:52:06 +000022566 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022567}
22568
22569
22570static int
22571test_xmlTextMerge(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022572 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022573
22574 int mem_base;
22575 xmlNodePtr ret_val;
22576 xmlNodePtr first; /* the first text node */
22577 int n_first;
22578 xmlNodePtr second; /* the second text node being merged */
22579 int n_second;
22580
Daniel Veillarda03e3652004-11-02 18:45:30 +000022581 for (n_first = 0;n_first < gen_nb_xmlNodePtr_in;n_first++) {
22582 for (n_second = 0;n_second < gen_nb_xmlNodePtr_in;n_second++) {
Daniel Veillardd93f6252004-11-02 15:53:51 +000022583 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022584 first = gen_xmlNodePtr_in(n_first, 0);
22585 second = gen_xmlNodePtr_in(n_second, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022586
22587 ret_val = xmlTextMerge(first, second);
Daniel Veillarda03e3652004-11-02 18:45:30 +000022588 if ((first != NULL) && (first->type != XML_TEXT_NODE)) {
Daniel Veillardce244ad2004-11-05 10:03:46 +000022589 xmlUnlinkNode(second);
Daniel Veillarda03e3652004-11-02 18:45:30 +000022590 xmlFreeNode(second) ; second = NULL ; }
Daniel Veillard8a32fe42004-11-02 22:10:16 +000022591 desret_xmlNodePtr(ret_val);
22592 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022593 des_xmlNodePtr_in(n_first, first, 0);
22594 des_xmlNodePtr_in(n_second, second, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022595 xmlResetLastError();
22596 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022597 printf("Leak of %d blocks found in xmlTextMerge",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022598 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022599 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022600 printf(" %d", n_first);
22601 printf(" %d", n_second);
22602 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022603 }
22604 }
22605 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000022606 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022607
Daniel Veillard42595322004-11-08 10:52:06 +000022608 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022609}
22610
22611
22612static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000022613test_xmlUnsetNsProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022614 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022615
William M. Brack21e4ef22005-01-02 09:53:13 +000022616#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000022617 int mem_base;
22618 int ret_val;
22619 xmlNodePtr node; /* the node */
22620 int n_node;
22621 xmlNsPtr ns; /* the namespace definition */
22622 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022623 xmlChar * name; /* the attribute name */
Daniel Veillard27f20102004-11-05 11:50:11 +000022624 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022625
Daniel Veillard27f20102004-11-05 11:50:11 +000022626 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22627 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
22628 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22629 mem_base = xmlMemBlocks();
22630 node = gen_xmlNodePtr(n_node, 0);
22631 ns = gen_xmlNsPtr(n_ns, 1);
22632 name = gen_const_xmlChar_ptr(n_name, 2);
22633
William M. Brackf13f77f2004-11-12 16:03:48 +000022634 ret_val = xmlUnsetNsProp(node, ns, (const xmlChar *)name);
Daniel Veillard27f20102004-11-05 11:50:11 +000022635 desret_int(ret_val);
22636 call_tests++;
22637 des_xmlNodePtr(n_node, node, 0);
22638 des_xmlNsPtr(n_ns, ns, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000022639 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillard27f20102004-11-05 11:50:11 +000022640 xmlResetLastError();
22641 if (mem_base != xmlMemBlocks()) {
22642 printf("Leak of %d blocks found in xmlUnsetNsProp",
22643 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022644 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000022645 printf(" %d", n_node);
22646 printf(" %d", n_ns);
22647 printf(" %d", n_name);
22648 printf("\n");
22649 }
22650 }
22651 }
22652 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022653 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000022654#endif
22655
Daniel Veillard42595322004-11-08 10:52:06 +000022656 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022657}
22658
22659
22660static int
22661test_xmlUnsetProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022662 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022663
William M. Brack21e4ef22005-01-02 09:53:13 +000022664#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000022665 int mem_base;
22666 int ret_val;
22667 xmlNodePtr node; /* the node */
22668 int n_node;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022669 xmlChar * name; /* the attribute name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022670 int n_name;
22671
22672 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
22673 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
22674 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022675 node = gen_xmlNodePtr(n_node, 0);
22676 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022677
William M. Brackf13f77f2004-11-12 16:03:48 +000022678 ret_val = xmlUnsetProp(node, (const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022679 desret_int(ret_val);
22680 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000022681 des_xmlNodePtr(n_node, node, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000022682 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022683 xmlResetLastError();
22684 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022685 printf("Leak of %d blocks found in xmlUnsetProp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022686 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022687 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022688 printf(" %d", n_node);
22689 printf(" %d", n_name);
22690 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022691 }
22692 }
22693 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022694 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022695#endif
22696
Daniel Veillard42595322004-11-08 10:52:06 +000022697 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022698}
22699
22700
22701static int
22702test_xmlValidateNCName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022703 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022704
William M. Brack21e4ef22005-01-02 09:53:13 +000022705#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000022706#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000022707 int mem_base;
22708 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022709 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022710 int n_value;
22711 int space; /* allow spaces in front and end of the string */
22712 int n_space;
22713
22714 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22715 for (n_space = 0;n_space < gen_nb_int;n_space++) {
22716 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022717 value = gen_const_xmlChar_ptr(n_value, 0);
22718 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022719
William M. Brackf13f77f2004-11-12 16:03:48 +000022720 ret_val = xmlValidateNCName((const xmlChar *)value, space);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022721 desret_int(ret_val);
22722 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000022723 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022724 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022725 xmlResetLastError();
22726 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022727 printf("Leak of %d blocks found in xmlValidateNCName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022728 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022729 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022730 printf(" %d", n_value);
22731 printf(" %d", n_space);
22732 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022733 }
22734 }
22735 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022736 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000022737#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000022738#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000022739
Daniel Veillard42595322004-11-08 10:52:06 +000022740 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022741}
22742
22743
22744static int
22745test_xmlValidateNMToken(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022746 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022747
William M. Brack21e4ef22005-01-02 09:53:13 +000022748#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000022749#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000022750 int mem_base;
22751 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022752 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022753 int n_value;
22754 int space; /* allow spaces in front and end of the string */
22755 int n_space;
22756
22757 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22758 for (n_space = 0;n_space < gen_nb_int;n_space++) {
22759 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022760 value = gen_const_xmlChar_ptr(n_value, 0);
22761 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022762
William M. Brackf13f77f2004-11-12 16:03:48 +000022763 ret_val = xmlValidateNMToken((const xmlChar *)value, space);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022764 desret_int(ret_val);
22765 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000022766 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022767 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022768 xmlResetLastError();
22769 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022770 printf("Leak of %d blocks found in xmlValidateNMToken",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022771 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022772 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022773 printf(" %d", n_value);
22774 printf(" %d", n_space);
22775 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022776 }
22777 }
22778 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022779 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000022780#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000022781#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000022782
Daniel Veillard42595322004-11-08 10:52:06 +000022783 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022784}
22785
22786
22787static int
22788test_xmlValidateName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022789 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022790
William M. Brack21e4ef22005-01-02 09:53:13 +000022791#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000022792#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000022793 int mem_base;
22794 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022795 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022796 int n_value;
22797 int space; /* allow spaces in front and end of the string */
22798 int n_space;
22799
22800 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22801 for (n_space = 0;n_space < gen_nb_int;n_space++) {
22802 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022803 value = gen_const_xmlChar_ptr(n_value, 0);
22804 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022805
William M. Brackf13f77f2004-11-12 16:03:48 +000022806 ret_val = xmlValidateName((const xmlChar *)value, space);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022807 desret_int(ret_val);
22808 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000022809 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022810 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022811 xmlResetLastError();
22812 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022813 printf("Leak of %d blocks found in xmlValidateName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022814 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022815 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022816 printf(" %d", n_value);
22817 printf(" %d", n_space);
22818 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022819 }
22820 }
22821 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022822 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000022823#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000022824#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000022825
Daniel Veillard42595322004-11-08 10:52:06 +000022826 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022827}
22828
22829
22830static int
22831test_xmlValidateQName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022832 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022833
William M. Brack21e4ef22005-01-02 09:53:13 +000022834#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000022835#ifdef LIBXML_TREE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000022836 int mem_base;
22837 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000022838 xmlChar * value; /* the value to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000022839 int n_value;
22840 int space; /* allow spaces in front and end of the string */
22841 int n_space;
22842
22843 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
22844 for (n_space = 0;n_space < gen_nb_int;n_space++) {
22845 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000022846 value = gen_const_xmlChar_ptr(n_value, 0);
22847 space = gen_int(n_space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022848
William M. Brackf13f77f2004-11-12 16:03:48 +000022849 ret_val = xmlValidateQName((const xmlChar *)value, space);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022850 desret_int(ret_val);
22851 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000022852 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000022853 des_int(n_space, space, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022854 xmlResetLastError();
22855 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000022856 printf("Leak of %d blocks found in xmlValidateQName",
Daniel Veillardd93f6252004-11-02 15:53:51 +000022857 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000022858 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000022859 printf(" %d", n_value);
22860 printf(" %d", n_space);
22861 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000022862 }
22863 }
22864 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022865 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000022866#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000022867#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000022868
Daniel Veillard42595322004-11-08 10:52:06 +000022869 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000022870}
22871
22872static int
22873test_tree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000022874 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000022875
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000022876 if (quiet == 0) printf("Testing tree : 129 of 146 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000022877 test_ret += test_xmlAddChild();
22878 test_ret += test_xmlAddChildList();
22879 test_ret += test_xmlAddNextSibling();
22880 test_ret += test_xmlAddPrevSibling();
22881 test_ret += test_xmlAddSibling();
22882 test_ret += test_xmlAttrSerializeTxtContent();
22883 test_ret += test_xmlBufferAdd();
22884 test_ret += test_xmlBufferAddHead();
22885 test_ret += test_xmlBufferCCat();
22886 test_ret += test_xmlBufferCat();
22887 test_ret += test_xmlBufferContent();
22888 test_ret += test_xmlBufferCreate();
22889 test_ret += test_xmlBufferCreateSize();
22890 test_ret += test_xmlBufferCreateStatic();
22891 test_ret += test_xmlBufferEmpty();
22892 test_ret += test_xmlBufferGrow();
22893 test_ret += test_xmlBufferLength();
22894 test_ret += test_xmlBufferResize();
22895 test_ret += test_xmlBufferSetAllocationScheme();
22896 test_ret += test_xmlBufferShrink();
22897 test_ret += test_xmlBufferWriteCHAR();
22898 test_ret += test_xmlBufferWriteChar();
22899 test_ret += test_xmlBufferWriteQuotedString();
22900 test_ret += test_xmlBuildQName();
22901 test_ret += test_xmlCopyDoc();
22902 test_ret += test_xmlCopyDtd();
22903 test_ret += test_xmlCopyNamespace();
22904 test_ret += test_xmlCopyNamespaceList();
22905 test_ret += test_xmlCopyNode();
22906 test_ret += test_xmlCopyNodeList();
22907 test_ret += test_xmlCopyProp();
22908 test_ret += test_xmlCopyPropList();
22909 test_ret += test_xmlCreateIntSubset();
22910 test_ret += test_xmlDocCopyNode();
22911 test_ret += test_xmlDocCopyNodeList();
22912 test_ret += test_xmlDocDump();
22913 test_ret += test_xmlDocDumpFormatMemory();
22914 test_ret += test_xmlDocDumpFormatMemoryEnc();
22915 test_ret += test_xmlDocDumpMemory();
22916 test_ret += test_xmlDocDumpMemoryEnc();
22917 test_ret += test_xmlDocFormatDump();
22918 test_ret += test_xmlDocGetRootElement();
22919 test_ret += test_xmlDocSetRootElement();
22920 test_ret += test_xmlElemDump();
22921 test_ret += test_xmlGetBufferAllocationScheme();
22922 test_ret += test_xmlGetCompressMode();
22923 test_ret += test_xmlGetDocCompressMode();
22924 test_ret += test_xmlGetIntSubset();
22925 test_ret += test_xmlGetLastChild();
22926 test_ret += test_xmlGetLineNo();
22927 test_ret += test_xmlGetNoNsProp();
22928 test_ret += test_xmlGetNodePath();
22929 test_ret += test_xmlGetNsList();
22930 test_ret += test_xmlGetNsProp();
22931 test_ret += test_xmlGetProp();
22932 test_ret += test_xmlHasNsProp();
22933 test_ret += test_xmlHasProp();
22934 test_ret += test_xmlIsBlankNode();
22935 test_ret += test_xmlIsXHTML();
22936 test_ret += test_xmlNewCDataBlock();
22937 test_ret += test_xmlNewCharRef();
22938 test_ret += test_xmlNewChild();
22939 test_ret += test_xmlNewComment();
22940 test_ret += test_xmlNewDoc();
22941 test_ret += test_xmlNewDocComment();
22942 test_ret += test_xmlNewDocFragment();
22943 test_ret += test_xmlNewDocNode();
22944 test_ret += test_xmlNewDocNodeEatName();
22945 test_ret += test_xmlNewDocPI();
22946 test_ret += test_xmlNewDocProp();
22947 test_ret += test_xmlNewDocRawNode();
22948 test_ret += test_xmlNewDocText();
22949 test_ret += test_xmlNewDocTextLen();
22950 test_ret += test_xmlNewDtd();
22951 test_ret += test_xmlNewNode();
22952 test_ret += test_xmlNewNodeEatName();
22953 test_ret += test_xmlNewNs();
22954 test_ret += test_xmlNewNsProp();
22955 test_ret += test_xmlNewNsPropEatName();
22956 test_ret += test_xmlNewPI();
22957 test_ret += test_xmlNewProp();
22958 test_ret += test_xmlNewReference();
22959 test_ret += test_xmlNewText();
22960 test_ret += test_xmlNewTextChild();
22961 test_ret += test_xmlNewTextLen();
22962 test_ret += test_xmlNodeAddContent();
22963 test_ret += test_xmlNodeAddContentLen();
22964 test_ret += test_xmlNodeBufGetContent();
22965 test_ret += test_xmlNodeDump();
22966 test_ret += test_xmlNodeDumpOutput();
22967 test_ret += test_xmlNodeGetBase();
22968 test_ret += test_xmlNodeGetContent();
22969 test_ret += test_xmlNodeGetLang();
22970 test_ret += test_xmlNodeGetSpacePreserve();
22971 test_ret += test_xmlNodeIsText();
22972 test_ret += test_xmlNodeListGetRawString();
22973 test_ret += test_xmlNodeListGetString();
22974 test_ret += test_xmlNodeSetBase();
22975 test_ret += test_xmlNodeSetContent();
22976 test_ret += test_xmlNodeSetContentLen();
22977 test_ret += test_xmlNodeSetLang();
22978 test_ret += test_xmlNodeSetName();
22979 test_ret += test_xmlNodeSetSpacePreserve();
22980 test_ret += test_xmlReconciliateNs();
22981 test_ret += test_xmlRemoveProp();
22982 test_ret += test_xmlReplaceNode();
22983 test_ret += test_xmlSaveFile();
22984 test_ret += test_xmlSaveFileEnc();
22985 test_ret += test_xmlSaveFileTo();
22986 test_ret += test_xmlSaveFormatFile();
22987 test_ret += test_xmlSaveFormatFileEnc();
22988 test_ret += test_xmlSaveFormatFileTo();
22989 test_ret += test_xmlSearchNs();
22990 test_ret += test_xmlSearchNsByHref();
22991 test_ret += test_xmlSetBufferAllocationScheme();
22992 test_ret += test_xmlSetCompressMode();
22993 test_ret += test_xmlSetDocCompressMode();
22994 test_ret += test_xmlSetNs();
22995 test_ret += test_xmlSetNsProp();
22996 test_ret += test_xmlSetProp();
22997 test_ret += test_xmlSplitQName2();
22998 test_ret += test_xmlSplitQName3();
22999 test_ret += test_xmlStringGetNodeList();
23000 test_ret += test_xmlStringLenGetNodeList();
23001 test_ret += test_xmlTextConcat();
23002 test_ret += test_xmlTextMerge();
23003 test_ret += test_xmlUnsetNsProp();
23004 test_ret += test_xmlUnsetProp();
23005 test_ret += test_xmlValidateNCName();
23006 test_ret += test_xmlValidateNMToken();
23007 test_ret += test_xmlValidateName();
23008 test_ret += test_xmlValidateQName();
Daniel Veillardd93f6252004-11-02 15:53:51 +000023009
Daniel Veillard42595322004-11-08 10:52:06 +000023010 if (test_ret != 0)
23011 printf("Module tree: %d errors\n", test_ret);
23012 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023013}
23014
23015static int
23016test_xmlBuildRelativeURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023017 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023018
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023019 int mem_base;
23020 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023021 xmlChar * URI; /* the URI reference under consideration */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023022 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023023 xmlChar * base; /* the base value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023024 int n_base;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023025
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023026 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
23027 for (n_base = 0;n_base < gen_nb_const_xmlChar_ptr;n_base++) {
23028 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023029 URI = gen_const_xmlChar_ptr(n_URI, 0);
23030 base = gen_const_xmlChar_ptr(n_base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023031
William M. Brackf13f77f2004-11-12 16:03:48 +000023032 ret_val = xmlBuildRelativeURI((const xmlChar *)URI, (const xmlChar *)base);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023033 desret_xmlChar_ptr(ret_val);
23034 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023035 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0);
23036 des_const_xmlChar_ptr(n_base, (const xmlChar *)base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023037 xmlResetLastError();
23038 if (mem_base != xmlMemBlocks()) {
23039 printf("Leak of %d blocks found in xmlBuildRelativeURI",
23040 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023041 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023042 printf(" %d", n_URI);
23043 printf(" %d", n_base);
23044 printf("\n");
23045 }
23046 }
23047 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023048 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023049
Daniel Veillard42595322004-11-08 10:52:06 +000023050 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023051}
23052
23053
23054static int
23055test_xmlBuildURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023056 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023057
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023058 int mem_base;
23059 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023060 xmlChar * URI; /* the URI instance found in the document */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023061 int n_URI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023062 xmlChar * base; /* the base value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023063 int n_base;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023064
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023065 for (n_URI = 0;n_URI < gen_nb_const_xmlChar_ptr;n_URI++) {
23066 for (n_base = 0;n_base < gen_nb_const_xmlChar_ptr;n_base++) {
23067 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023068 URI = gen_const_xmlChar_ptr(n_URI, 0);
23069 base = gen_const_xmlChar_ptr(n_base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023070
William M. Brackf13f77f2004-11-12 16:03:48 +000023071 ret_val = xmlBuildURI((const xmlChar *)URI, (const xmlChar *)base);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023072 desret_xmlChar_ptr(ret_val);
23073 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023074 des_const_xmlChar_ptr(n_URI, (const xmlChar *)URI, 0);
23075 des_const_xmlChar_ptr(n_base, (const xmlChar *)base, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023076 xmlResetLastError();
23077 if (mem_base != xmlMemBlocks()) {
23078 printf("Leak of %d blocks found in xmlBuildURI",
23079 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023080 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023081 printf(" %d", n_URI);
23082 printf(" %d", n_base);
23083 printf("\n");
23084 }
23085 }
23086 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023087 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023088
Daniel Veillard42595322004-11-08 10:52:06 +000023089 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023090}
23091
23092
23093static int
23094test_xmlCanonicPath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023095 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023096
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023097 int mem_base;
23098 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023099 xmlChar * path; /* the resource locator in a filesystem notation */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023100 int n_path;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023101
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023102 for (n_path = 0;n_path < gen_nb_const_xmlChar_ptr;n_path++) {
23103 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023104 path = gen_const_xmlChar_ptr(n_path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023105
William M. Brackf13f77f2004-11-12 16:03:48 +000023106 ret_val = xmlCanonicPath((const xmlChar *)path);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023107 desret_xmlChar_ptr(ret_val);
23108 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023109 des_const_xmlChar_ptr(n_path, (const xmlChar *)path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023110 xmlResetLastError();
23111 if (mem_base != xmlMemBlocks()) {
23112 printf("Leak of %d blocks found in xmlCanonicPath",
23113 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023114 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023115 printf(" %d", n_path);
23116 printf("\n");
23117 }
23118 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023119 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023120
Daniel Veillard42595322004-11-08 10:52:06 +000023121 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023122}
23123
23124
23125static int
23126test_xmlCreateURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023127 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023128
23129
23130 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023131 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023132}
23133
23134
23135static int
23136test_xmlNormalizeURIPath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023137 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023138
Daniel Veillardce682bc2004-11-05 17:22:25 +000023139 int mem_base;
23140 int ret_val;
23141 char * path; /* pointer to the path string */
23142 int n_path;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023143
Daniel Veillardce682bc2004-11-05 17:22:25 +000023144 for (n_path = 0;n_path < gen_nb_char_ptr;n_path++) {
23145 mem_base = xmlMemBlocks();
23146 path = gen_char_ptr(n_path, 0);
23147
23148 ret_val = xmlNormalizeURIPath(path);
23149 desret_int(ret_val);
23150 call_tests++;
23151 des_char_ptr(n_path, path, 0);
23152 xmlResetLastError();
23153 if (mem_base != xmlMemBlocks()) {
23154 printf("Leak of %d blocks found in xmlNormalizeURIPath",
23155 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023156 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023157 printf(" %d", n_path);
23158 printf("\n");
23159 }
23160 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000023161 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023162
Daniel Veillard42595322004-11-08 10:52:06 +000023163 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023164}
23165
23166
23167static int
23168test_xmlParseURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023169 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023170
23171
23172 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023173 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023174}
23175
23176
Daniel Veillardce682bc2004-11-05 17:22:25 +000023177#define gen_nb_xmlURIPtr 1
23178static xmlURIPtr gen_xmlURIPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23179 return(NULL);
23180}
23181static void des_xmlURIPtr(int no ATTRIBUTE_UNUSED, xmlURIPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23182}
23183
Daniel Veillardd93f6252004-11-02 15:53:51 +000023184static int
23185test_xmlParseURIReference(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023186 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023187
Daniel Veillardce682bc2004-11-05 17:22:25 +000023188 int mem_base;
23189 int ret_val;
23190 xmlURIPtr uri; /* pointer to an URI structure */
23191 int n_uri;
23192 char * str; /* the string to analyze */
23193 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023194
Daniel Veillardce682bc2004-11-05 17:22:25 +000023195 for (n_uri = 0;n_uri < gen_nb_xmlURIPtr;n_uri++) {
23196 for (n_str = 0;n_str < gen_nb_const_char_ptr;n_str++) {
23197 mem_base = xmlMemBlocks();
23198 uri = gen_xmlURIPtr(n_uri, 0);
23199 str = gen_const_char_ptr(n_str, 1);
23200
William M. Brackf13f77f2004-11-12 16:03:48 +000023201 ret_val = xmlParseURIReference(uri, (const char *)str);
Daniel Veillardce682bc2004-11-05 17:22:25 +000023202 desret_int(ret_val);
23203 call_tests++;
23204 des_xmlURIPtr(n_uri, uri, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000023205 des_const_char_ptr(n_str, (const char *)str, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000023206 xmlResetLastError();
23207 if (mem_base != xmlMemBlocks()) {
23208 printf("Leak of %d blocks found in xmlParseURIReference",
23209 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023210 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023211 printf(" %d", n_uri);
23212 printf(" %d", n_str);
23213 printf("\n");
23214 }
23215 }
23216 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000023217 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023218
Daniel Veillard42595322004-11-08 10:52:06 +000023219 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023220}
23221
23222
23223static int
23224test_xmlPrintURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023225 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023226
Daniel Veillardce682bc2004-11-05 17:22:25 +000023227 int mem_base;
23228 FILE * stream; /* a FILE* for the output */
23229 int n_stream;
23230 xmlURIPtr uri; /* pointer to an xmlURI */
23231 int n_uri;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023232
Daniel Veillardce682bc2004-11-05 17:22:25 +000023233 for (n_stream = 0;n_stream < gen_nb_FILE_ptr;n_stream++) {
23234 for (n_uri = 0;n_uri < gen_nb_xmlURIPtr;n_uri++) {
23235 mem_base = xmlMemBlocks();
23236 stream = gen_FILE_ptr(n_stream, 0);
23237 uri = gen_xmlURIPtr(n_uri, 1);
23238
23239 xmlPrintURI(stream, uri);
23240 call_tests++;
23241 des_FILE_ptr(n_stream, stream, 0);
23242 des_xmlURIPtr(n_uri, uri, 1);
23243 xmlResetLastError();
23244 if (mem_base != xmlMemBlocks()) {
23245 printf("Leak of %d blocks found in xmlPrintURI",
23246 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023247 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023248 printf(" %d", n_stream);
23249 printf(" %d", n_uri);
23250 printf("\n");
23251 }
23252 }
23253 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000023254 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023255
Daniel Veillard42595322004-11-08 10:52:06 +000023256 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023257}
23258
23259
23260static int
23261test_xmlSaveUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023262 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023263
Daniel Veillardce682bc2004-11-05 17:22:25 +000023264 int mem_base;
23265 xmlChar * ret_val;
23266 xmlURIPtr uri; /* pointer to an xmlURI */
23267 int n_uri;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023268
Daniel Veillardce682bc2004-11-05 17:22:25 +000023269 for (n_uri = 0;n_uri < gen_nb_xmlURIPtr;n_uri++) {
23270 mem_base = xmlMemBlocks();
23271 uri = gen_xmlURIPtr(n_uri, 0);
23272
23273 ret_val = xmlSaveUri(uri);
23274 desret_xmlChar_ptr(ret_val);
23275 call_tests++;
23276 des_xmlURIPtr(n_uri, uri, 0);
23277 xmlResetLastError();
23278 if (mem_base != xmlMemBlocks()) {
23279 printf("Leak of %d blocks found in xmlSaveUri",
23280 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023281 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023282 printf(" %d", n_uri);
23283 printf("\n");
23284 }
23285 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000023286 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023287
Daniel Veillard42595322004-11-08 10:52:06 +000023288 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023289}
23290
23291
23292static int
23293test_xmlURIEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023294 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023295
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023296 int mem_base;
23297 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023298 xmlChar * str; /* the string of the URI to escape */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023299 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023300
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023301 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
23302 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023303 str = gen_const_xmlChar_ptr(n_str, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023304
William M. Brackf13f77f2004-11-12 16:03:48 +000023305 ret_val = xmlURIEscape((const xmlChar *)str);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023306 desret_xmlChar_ptr(ret_val);
23307 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023308 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023309 xmlResetLastError();
23310 if (mem_base != xmlMemBlocks()) {
23311 printf("Leak of %d blocks found in xmlURIEscape",
23312 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023313 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023314 printf(" %d", n_str);
23315 printf("\n");
23316 }
23317 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023318 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023319
Daniel Veillard42595322004-11-08 10:52:06 +000023320 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023321}
23322
23323
23324static int
23325test_xmlURIEscapeStr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023326 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023327
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023328 int mem_base;
23329 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023330 xmlChar * str; /* string to escape */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023331 int n_str;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023332 xmlChar * list; /* exception list string of chars not to escape */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023333 int n_list;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023334
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023335 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
23336 for (n_list = 0;n_list < gen_nb_const_xmlChar_ptr;n_list++) {
23337 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000023338 str = gen_const_xmlChar_ptr(n_str, 0);
23339 list = gen_const_xmlChar_ptr(n_list, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023340
William M. Brackf13f77f2004-11-12 16:03:48 +000023341 ret_val = xmlURIEscapeStr((const xmlChar *)str, (const xmlChar *)list);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023342 desret_xmlChar_ptr(ret_val);
23343 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000023344 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
23345 des_const_xmlChar_ptr(n_list, (const xmlChar *)list, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023346 xmlResetLastError();
23347 if (mem_base != xmlMemBlocks()) {
23348 printf("Leak of %d blocks found in xmlURIEscapeStr",
23349 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023350 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000023351 printf(" %d", n_str);
23352 printf(" %d", n_list);
23353 printf("\n");
23354 }
23355 }
23356 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000023357 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023358
Daniel Veillard42595322004-11-08 10:52:06 +000023359 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023360}
23361
23362
23363static int
23364test_xmlURIUnescapeString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023365 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023366
23367
23368 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023369 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023370}
23371
23372static int
23373test_uri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023374 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023375
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023376 if (quiet == 0) printf("Testing uri : 9 of 13 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000023377 test_ret += test_xmlBuildRelativeURI();
23378 test_ret += test_xmlBuildURI();
23379 test_ret += test_xmlCanonicPath();
23380 test_ret += test_xmlCreateURI();
23381 test_ret += test_xmlNormalizeURIPath();
23382 test_ret += test_xmlParseURI();
23383 test_ret += test_xmlParseURIReference();
23384 test_ret += test_xmlPrintURI();
23385 test_ret += test_xmlSaveUri();
23386 test_ret += test_xmlURIEscape();
23387 test_ret += test_xmlURIEscapeStr();
23388 test_ret += test_xmlURIUnescapeString();
Daniel Veillardd93f6252004-11-02 15:53:51 +000023389
Daniel Veillard42595322004-11-08 10:52:06 +000023390 if (test_ret != 0)
23391 printf("Module uri: %d errors\n", test_ret);
23392 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023393}
23394
23395static int
23396test_xmlAddAttributeDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023397 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023398
Daniel Veillard42595322004-11-08 10:52:06 +000023399 int mem_base;
23400 xmlAttributePtr ret_val;
23401 xmlValidCtxtPtr ctxt; /* the validation context */
23402 int n_ctxt;
23403 xmlDtdPtr dtd; /* pointer to the DTD */
23404 int n_dtd;
23405 xmlChar * elem; /* the element name */
23406 int n_elem;
23407 xmlChar * name; /* the attribute name */
23408 int n_name;
23409 xmlChar * ns; /* the attribute namespace prefix */
23410 int n_ns;
23411 xmlAttributeType type; /* the attribute type */
23412 int n_type;
23413 xmlAttributeDefault def; /* the attribute default type */
23414 int n_def;
23415 xmlChar * defaultValue; /* the attribute default value */
23416 int n_defaultValue;
23417 xmlEnumerationPtr tree; /* if it's an enumeration, the associated list */
23418 int n_tree;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023419
Daniel Veillard42595322004-11-08 10:52:06 +000023420 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
23421 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
23422 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
23423 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
23424 for (n_ns = 0;n_ns < gen_nb_const_xmlChar_ptr;n_ns++) {
23425 for (n_type = 0;n_type < gen_nb_xmlAttributeType;n_type++) {
23426 for (n_def = 0;n_def < gen_nb_xmlAttributeDefault;n_def++) {
23427 for (n_defaultValue = 0;n_defaultValue < gen_nb_const_xmlChar_ptr;n_defaultValue++) {
23428 for (n_tree = 0;n_tree < gen_nb_xmlEnumerationPtr;n_tree++) {
23429 mem_base = xmlMemBlocks();
23430 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
23431 dtd = gen_xmlDtdPtr(n_dtd, 1);
23432 elem = gen_const_xmlChar_ptr(n_elem, 2);
23433 name = gen_const_xmlChar_ptr(n_name, 3);
23434 ns = gen_const_xmlChar_ptr(n_ns, 4);
23435 type = gen_xmlAttributeType(n_type, 5);
23436 def = gen_xmlAttributeDefault(n_def, 6);
23437 defaultValue = gen_const_xmlChar_ptr(n_defaultValue, 7);
23438 tree = gen_xmlEnumerationPtr(n_tree, 8);
23439
William M. Brackf13f77f2004-11-12 16:03:48 +000023440 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 +000023441 desret_xmlAttributePtr(ret_val);
23442 call_tests++;
23443 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
23444 des_xmlDtdPtr(n_dtd, dtd, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000023445 des_const_xmlChar_ptr(n_elem, (const xmlChar *)elem, 2);
23446 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 3);
23447 des_const_xmlChar_ptr(n_ns, (const xmlChar *)ns, 4);
Daniel Veillard42595322004-11-08 10:52:06 +000023448 des_xmlAttributeType(n_type, type, 5);
23449 des_xmlAttributeDefault(n_def, def, 6);
William M. Brackf13f77f2004-11-12 16:03:48 +000023450 des_const_xmlChar_ptr(n_defaultValue, (const xmlChar *)defaultValue, 7);
Daniel Veillard42595322004-11-08 10:52:06 +000023451 des_xmlEnumerationPtr(n_tree, tree, 8);
23452 xmlResetLastError();
23453 if (mem_base != xmlMemBlocks()) {
23454 printf("Leak of %d blocks found in xmlAddAttributeDecl",
23455 xmlMemBlocks() - mem_base);
23456 test_ret++;
23457 printf(" %d", n_ctxt);
23458 printf(" %d", n_dtd);
23459 printf(" %d", n_elem);
23460 printf(" %d", n_name);
23461 printf(" %d", n_ns);
23462 printf(" %d", n_type);
23463 printf(" %d", n_def);
23464 printf(" %d", n_defaultValue);
23465 printf(" %d", n_tree);
23466 printf("\n");
23467 }
23468 }
23469 }
23470 }
23471 }
23472 }
23473 }
23474 }
23475 }
23476 }
Daniel Veillard42595322004-11-08 10:52:06 +000023477 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023478
Daniel Veillard42595322004-11-08 10:52:06 +000023479 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023480}
23481
23482
23483static int
23484test_xmlAddElementDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023485 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023486
Daniel Veillard42595322004-11-08 10:52:06 +000023487 int mem_base;
23488 xmlElementPtr ret_val;
23489 xmlValidCtxtPtr ctxt; /* the validation context */
23490 int n_ctxt;
23491 xmlDtdPtr dtd; /* pointer to the DTD */
23492 int n_dtd;
23493 xmlChar * name; /* the entity name */
23494 int n_name;
23495 xmlElementTypeVal type; /* the element type */
23496 int n_type;
23497 xmlElementContentPtr content; /* the element content tree or NULL */
23498 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023499
Daniel Veillard42595322004-11-08 10:52:06 +000023500 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
23501 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
23502 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
23503 for (n_type = 0;n_type < gen_nb_xmlElementTypeVal;n_type++) {
23504 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
23505 mem_base = xmlMemBlocks();
23506 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
23507 dtd = gen_xmlDtdPtr(n_dtd, 1);
23508 name = gen_const_xmlChar_ptr(n_name, 2);
23509 type = gen_xmlElementTypeVal(n_type, 3);
23510 content = gen_xmlElementContentPtr(n_content, 4);
23511
William M. Brackf13f77f2004-11-12 16:03:48 +000023512 ret_val = xmlAddElementDecl(ctxt, dtd, (const xmlChar *)name, type, content);
Daniel Veillard42595322004-11-08 10:52:06 +000023513 desret_xmlElementPtr(ret_val);
23514 call_tests++;
23515 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
23516 des_xmlDtdPtr(n_dtd, dtd, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000023517 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillard42595322004-11-08 10:52:06 +000023518 des_xmlElementTypeVal(n_type, type, 3);
23519 des_xmlElementContentPtr(n_content, content, 4);
23520 xmlResetLastError();
23521 if (mem_base != xmlMemBlocks()) {
23522 printf("Leak of %d blocks found in xmlAddElementDecl",
23523 xmlMemBlocks() - mem_base);
23524 test_ret++;
23525 printf(" %d", n_ctxt);
23526 printf(" %d", n_dtd);
23527 printf(" %d", n_name);
23528 printf(" %d", n_type);
23529 printf(" %d", n_content);
23530 printf("\n");
23531 }
23532 }
23533 }
23534 }
23535 }
23536 }
Daniel Veillard42595322004-11-08 10:52:06 +000023537 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023538
Daniel Veillard42595322004-11-08 10:52:06 +000023539 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023540}
23541
23542
23543static int
23544test_xmlAddID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023545 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023546
23547
23548 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023549 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023550}
23551
23552
23553static int
23554test_xmlAddNotationDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023555 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023556
23557
23558 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023559 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023560}
23561
23562
23563static int
23564test_xmlAddRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023565 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023566
23567
23568 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023569 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023570}
23571
23572
Daniel Veillardce682bc2004-11-05 17:22:25 +000023573#define gen_nb_xmlAttributeTablePtr 1
23574static xmlAttributeTablePtr gen_xmlAttributeTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23575 return(NULL);
23576}
23577static void des_xmlAttributeTablePtr(int no ATTRIBUTE_UNUSED, xmlAttributeTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23578}
23579
Daniel Veillardd93f6252004-11-02 15:53:51 +000023580static int
23581test_xmlCopyAttributeTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023582 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023583
23584
23585 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023586 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023587}
23588
23589
23590static int
23591test_xmlCopyElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023592 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023593
William M. Brack094dd862004-11-14 14:28:34 +000023594 int mem_base;
23595 xmlElementContentPtr ret_val;
23596 xmlElementContentPtr cur; /* An element content pointer. */
23597 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023598
William M. Brack094dd862004-11-14 14:28:34 +000023599 for (n_cur = 0;n_cur < gen_nb_xmlElementContentPtr;n_cur++) {
23600 mem_base = xmlMemBlocks();
23601 cur = gen_xmlElementContentPtr(n_cur, 0);
23602
23603 ret_val = xmlCopyElementContent(cur);
23604 desret_xmlElementContentPtr(ret_val);
23605 call_tests++;
23606 des_xmlElementContentPtr(n_cur, cur, 0);
23607 xmlResetLastError();
23608 if (mem_base != xmlMemBlocks()) {
23609 printf("Leak of %d blocks found in xmlCopyElementContent",
23610 xmlMemBlocks() - mem_base);
23611 test_ret++;
23612 printf(" %d", n_cur);
23613 printf("\n");
23614 }
23615 }
23616 function_tests++;
23617
Daniel Veillard42595322004-11-08 10:52:06 +000023618 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023619}
23620
23621
Daniel Veillardce682bc2004-11-05 17:22:25 +000023622#define gen_nb_xmlElementTablePtr 1
23623static xmlElementTablePtr gen_xmlElementTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23624 return(NULL);
23625}
23626static void des_xmlElementTablePtr(int no ATTRIBUTE_UNUSED, xmlElementTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23627}
23628
Daniel Veillardd93f6252004-11-02 15:53:51 +000023629static int
23630test_xmlCopyElementTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023631 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023632
23633
23634 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023635 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023636}
23637
23638
23639static int
23640test_xmlCopyEnumeration(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023641 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023642
23643
23644 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023645 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023646}
23647
23648
Daniel Veillardce682bc2004-11-05 17:22:25 +000023649#define gen_nb_xmlNotationTablePtr 1
23650static xmlNotationTablePtr gen_xmlNotationTablePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23651 return(NULL);
23652}
23653static void des_xmlNotationTablePtr(int no ATTRIBUTE_UNUSED, xmlNotationTablePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23654}
23655
Daniel Veillardd93f6252004-11-02 15:53:51 +000023656static int
23657test_xmlCopyNotationTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023658 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023659
23660
23661 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023662 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023663}
23664
23665
23666static int
23667test_xmlCreateEnumeration(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023668 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023669
23670
23671 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000023672 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023673}
23674
23675
Daniel Veillardce682bc2004-11-05 17:22:25 +000023676#define gen_nb_xmlAttributePtr 1
23677static xmlAttributePtr gen_xmlAttributePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23678 return(NULL);
23679}
23680static void des_xmlAttributePtr(int no ATTRIBUTE_UNUSED, xmlAttributePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23681}
23682
Daniel Veillardd93f6252004-11-02 15:53:51 +000023683static int
23684test_xmlDumpAttributeDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023685 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023686
William M. Brack21e4ef22005-01-02 09:53:13 +000023687#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000023688 int mem_base;
23689 xmlBufferPtr buf; /* the XML buffer output */
23690 int n_buf;
23691 xmlAttributePtr attr; /* An attribute declaration */
23692 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023693
Daniel Veillardce682bc2004-11-05 17:22:25 +000023694 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23695 for (n_attr = 0;n_attr < gen_nb_xmlAttributePtr;n_attr++) {
23696 mem_base = xmlMemBlocks();
23697 buf = gen_xmlBufferPtr(n_buf, 0);
23698 attr = gen_xmlAttributePtr(n_attr, 1);
23699
23700 xmlDumpAttributeDecl(buf, attr);
23701 call_tests++;
23702 des_xmlBufferPtr(n_buf, buf, 0);
23703 des_xmlAttributePtr(n_attr, attr, 1);
23704 xmlResetLastError();
23705 if (mem_base != xmlMemBlocks()) {
23706 printf("Leak of %d blocks found in xmlDumpAttributeDecl",
23707 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023708 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023709 printf(" %d", n_buf);
23710 printf(" %d", n_attr);
23711 printf("\n");
23712 }
23713 }
23714 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023715 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023716#endif
23717
Daniel Veillard42595322004-11-08 10:52:06 +000023718 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023719}
23720
23721
23722static int
23723test_xmlDumpAttributeTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023724 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023725
William M. Brack21e4ef22005-01-02 09:53:13 +000023726#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000023727 int mem_base;
23728 xmlBufferPtr buf; /* the XML buffer output */
23729 int n_buf;
23730 xmlAttributeTablePtr table; /* An attribute table */
23731 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023732
Daniel Veillardce682bc2004-11-05 17:22:25 +000023733 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23734 for (n_table = 0;n_table < gen_nb_xmlAttributeTablePtr;n_table++) {
23735 mem_base = xmlMemBlocks();
23736 buf = gen_xmlBufferPtr(n_buf, 0);
23737 table = gen_xmlAttributeTablePtr(n_table, 1);
23738
23739 xmlDumpAttributeTable(buf, table);
23740 call_tests++;
23741 des_xmlBufferPtr(n_buf, buf, 0);
23742 des_xmlAttributeTablePtr(n_table, table, 1);
23743 xmlResetLastError();
23744 if (mem_base != xmlMemBlocks()) {
23745 printf("Leak of %d blocks found in xmlDumpAttributeTable",
23746 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023747 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023748 printf(" %d", n_buf);
23749 printf(" %d", n_table);
23750 printf("\n");
23751 }
23752 }
23753 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023754 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023755#endif
23756
Daniel Veillard42595322004-11-08 10:52:06 +000023757 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023758}
23759
23760
Daniel Veillardce682bc2004-11-05 17:22:25 +000023761#define gen_nb_xmlElementPtr 1
23762static xmlElementPtr gen_xmlElementPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23763 return(NULL);
23764}
23765static void des_xmlElementPtr(int no ATTRIBUTE_UNUSED, xmlElementPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23766}
23767
Daniel Veillardd93f6252004-11-02 15:53:51 +000023768static int
23769test_xmlDumpElementDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023770 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023771
William M. Brack21e4ef22005-01-02 09:53:13 +000023772#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000023773 int mem_base;
23774 xmlBufferPtr buf; /* the XML buffer output */
23775 int n_buf;
23776 xmlElementPtr elem; /* An element table */
23777 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023778
Daniel Veillardce682bc2004-11-05 17:22:25 +000023779 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23780 for (n_elem = 0;n_elem < gen_nb_xmlElementPtr;n_elem++) {
23781 mem_base = xmlMemBlocks();
23782 buf = gen_xmlBufferPtr(n_buf, 0);
23783 elem = gen_xmlElementPtr(n_elem, 1);
23784
23785 xmlDumpElementDecl(buf, elem);
23786 call_tests++;
23787 des_xmlBufferPtr(n_buf, buf, 0);
23788 des_xmlElementPtr(n_elem, elem, 1);
23789 xmlResetLastError();
23790 if (mem_base != xmlMemBlocks()) {
23791 printf("Leak of %d blocks found in xmlDumpElementDecl",
23792 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023793 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023794 printf(" %d", n_buf);
23795 printf(" %d", n_elem);
23796 printf("\n");
23797 }
23798 }
23799 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023800 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023801#endif
23802
Daniel Veillard42595322004-11-08 10:52:06 +000023803 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023804}
23805
23806
23807static int
23808test_xmlDumpElementTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023809 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023810
William M. Brack21e4ef22005-01-02 09:53:13 +000023811#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000023812 int mem_base;
23813 xmlBufferPtr buf; /* the XML buffer output */
23814 int n_buf;
23815 xmlElementTablePtr table; /* An element table */
23816 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023817
Daniel Veillardce682bc2004-11-05 17:22:25 +000023818 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23819 for (n_table = 0;n_table < gen_nb_xmlElementTablePtr;n_table++) {
23820 mem_base = xmlMemBlocks();
23821 buf = gen_xmlBufferPtr(n_buf, 0);
23822 table = gen_xmlElementTablePtr(n_table, 1);
23823
23824 xmlDumpElementTable(buf, table);
23825 call_tests++;
23826 des_xmlBufferPtr(n_buf, buf, 0);
23827 des_xmlElementTablePtr(n_table, table, 1);
23828 xmlResetLastError();
23829 if (mem_base != xmlMemBlocks()) {
23830 printf("Leak of %d blocks found in xmlDumpElementTable",
23831 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023832 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023833 printf(" %d", n_buf);
23834 printf(" %d", n_table);
23835 printf("\n");
23836 }
23837 }
23838 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023839 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023840#endif
23841
Daniel Veillard42595322004-11-08 10:52:06 +000023842 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023843}
23844
23845
Daniel Veillardce682bc2004-11-05 17:22:25 +000023846#define gen_nb_xmlNotationPtr 1
23847static xmlNotationPtr gen_xmlNotationPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23848 return(NULL);
23849}
23850static void des_xmlNotationPtr(int no ATTRIBUTE_UNUSED, xmlNotationPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
23851}
23852
Daniel Veillardd93f6252004-11-02 15:53:51 +000023853static int
23854test_xmlDumpNotationDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023855 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023856
William M. Brack21e4ef22005-01-02 09:53:13 +000023857#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000023858 int mem_base;
23859 xmlBufferPtr buf; /* the XML buffer output */
23860 int n_buf;
23861 xmlNotationPtr nota; /* A notation declaration */
23862 int n_nota;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023863
Daniel Veillardce682bc2004-11-05 17:22:25 +000023864 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23865 for (n_nota = 0;n_nota < gen_nb_xmlNotationPtr;n_nota++) {
23866 mem_base = xmlMemBlocks();
23867 buf = gen_xmlBufferPtr(n_buf, 0);
23868 nota = gen_xmlNotationPtr(n_nota, 1);
23869
23870 xmlDumpNotationDecl(buf, nota);
23871 call_tests++;
23872 des_xmlBufferPtr(n_buf, buf, 0);
23873 des_xmlNotationPtr(n_nota, nota, 1);
23874 xmlResetLastError();
23875 if (mem_base != xmlMemBlocks()) {
23876 printf("Leak of %d blocks found in xmlDumpNotationDecl",
23877 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023878 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023879 printf(" %d", n_buf);
23880 printf(" %d", n_nota);
23881 printf("\n");
23882 }
23883 }
23884 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023885 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023886#endif
23887
Daniel Veillard42595322004-11-08 10:52:06 +000023888 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023889}
23890
23891
23892static int
23893test_xmlDumpNotationTable(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023894 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023895
William M. Brack21e4ef22005-01-02 09:53:13 +000023896#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000023897 int mem_base;
23898 xmlBufferPtr buf; /* the XML buffer output */
23899 int n_buf;
23900 xmlNotationTablePtr table; /* A notation table */
23901 int n_table;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023902
Daniel Veillardce682bc2004-11-05 17:22:25 +000023903 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
23904 for (n_table = 0;n_table < gen_nb_xmlNotationTablePtr;n_table++) {
23905 mem_base = xmlMemBlocks();
23906 buf = gen_xmlBufferPtr(n_buf, 0);
23907 table = gen_xmlNotationTablePtr(n_table, 1);
23908
23909 xmlDumpNotationTable(buf, table);
23910 call_tests++;
23911 des_xmlBufferPtr(n_buf, buf, 0);
23912 des_xmlNotationTablePtr(n_table, table, 1);
23913 xmlResetLastError();
23914 if (mem_base != xmlMemBlocks()) {
23915 printf("Leak of %d blocks found in xmlDumpNotationTable",
23916 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000023917 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023918 printf(" %d", n_buf);
23919 printf(" %d", n_table);
23920 printf("\n");
23921 }
23922 }
23923 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023924 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000023925#endif
23926
Daniel Veillard42595322004-11-08 10:52:06 +000023927 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023928}
23929
23930
23931static int
23932test_xmlGetDtdAttrDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023933 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023934
Daniel Veillard42595322004-11-08 10:52:06 +000023935 int mem_base;
23936 xmlAttributePtr ret_val;
23937 xmlDtdPtr dtd; /* a pointer to the DtD to search */
23938 int n_dtd;
23939 xmlChar * elem; /* the element name */
23940 int n_elem;
23941 xmlChar * name; /* the attribute name */
23942 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023943
Daniel Veillard42595322004-11-08 10:52:06 +000023944 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
23945 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
23946 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
23947 mem_base = xmlMemBlocks();
23948 dtd = gen_xmlDtdPtr(n_dtd, 0);
23949 elem = gen_const_xmlChar_ptr(n_elem, 1);
23950 name = gen_const_xmlChar_ptr(n_name, 2);
23951
William M. Brackf13f77f2004-11-12 16:03:48 +000023952 ret_val = xmlGetDtdAttrDesc(dtd, (const xmlChar *)elem, (const xmlChar *)name);
Daniel Veillard42595322004-11-08 10:52:06 +000023953 desret_xmlAttributePtr(ret_val);
23954 call_tests++;
23955 des_xmlDtdPtr(n_dtd, dtd, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000023956 des_const_xmlChar_ptr(n_elem, (const xmlChar *)elem, 1);
23957 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillard42595322004-11-08 10:52:06 +000023958 xmlResetLastError();
23959 if (mem_base != xmlMemBlocks()) {
23960 printf("Leak of %d blocks found in xmlGetDtdAttrDesc",
23961 xmlMemBlocks() - mem_base);
23962 test_ret++;
23963 printf(" %d", n_dtd);
23964 printf(" %d", n_elem);
23965 printf(" %d", n_name);
23966 printf("\n");
23967 }
23968 }
23969 }
23970 }
Daniel Veillard42595322004-11-08 10:52:06 +000023971 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000023972
Daniel Veillard42595322004-11-08 10:52:06 +000023973 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000023974}
23975
23976
23977static int
23978test_xmlGetDtdElementDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000023979 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023980
Daniel Veillard42595322004-11-08 10:52:06 +000023981 int mem_base;
23982 xmlElementPtr ret_val;
23983 xmlDtdPtr dtd; /* a pointer to the DtD to search */
23984 int n_dtd;
23985 xmlChar * name; /* the element name */
23986 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000023987
Daniel Veillard42595322004-11-08 10:52:06 +000023988 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
23989 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
23990 mem_base = xmlMemBlocks();
23991 dtd = gen_xmlDtdPtr(n_dtd, 0);
23992 name = gen_const_xmlChar_ptr(n_name, 1);
23993
William M. Brackf13f77f2004-11-12 16:03:48 +000023994 ret_val = xmlGetDtdElementDesc(dtd, (const xmlChar *)name);
Daniel Veillard42595322004-11-08 10:52:06 +000023995 desret_xmlElementPtr(ret_val);
23996 call_tests++;
23997 des_xmlDtdPtr(n_dtd, dtd, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000023998 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000023999 xmlResetLastError();
24000 if (mem_base != xmlMemBlocks()) {
24001 printf("Leak of %d blocks found in xmlGetDtdElementDesc",
24002 xmlMemBlocks() - mem_base);
24003 test_ret++;
24004 printf(" %d", n_dtd);
24005 printf(" %d", n_name);
24006 printf("\n");
24007 }
24008 }
24009 }
Daniel Veillard42595322004-11-08 10:52:06 +000024010 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024011
Daniel Veillard42595322004-11-08 10:52:06 +000024012 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024013}
24014
24015
24016static int
24017test_xmlGetDtdNotationDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024018 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024019
24020
24021 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000024022 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024023}
24024
24025
24026static int
24027test_xmlGetDtdQAttrDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024028 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024029
Daniel Veillard42595322004-11-08 10:52:06 +000024030 int mem_base;
24031 xmlAttributePtr ret_val;
24032 xmlDtdPtr dtd; /* a pointer to the DtD to search */
24033 int n_dtd;
24034 xmlChar * elem; /* the element name */
24035 int n_elem;
24036 xmlChar * name; /* the attribute name */
24037 int n_name;
24038 xmlChar * prefix; /* the attribute namespace prefix */
24039 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024040
Daniel Veillard42595322004-11-08 10:52:06 +000024041 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
24042 for (n_elem = 0;n_elem < gen_nb_const_xmlChar_ptr;n_elem++) {
24043 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24044 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
24045 mem_base = xmlMemBlocks();
24046 dtd = gen_xmlDtdPtr(n_dtd, 0);
24047 elem = gen_const_xmlChar_ptr(n_elem, 1);
24048 name = gen_const_xmlChar_ptr(n_name, 2);
24049 prefix = gen_const_xmlChar_ptr(n_prefix, 3);
24050
William M. Brackf13f77f2004-11-12 16:03:48 +000024051 ret_val = xmlGetDtdQAttrDesc(dtd, (const xmlChar *)elem, (const xmlChar *)name, (const xmlChar *)prefix);
Daniel Veillard42595322004-11-08 10:52:06 +000024052 desret_xmlAttributePtr(ret_val);
24053 call_tests++;
24054 des_xmlDtdPtr(n_dtd, dtd, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024055 des_const_xmlChar_ptr(n_elem, (const xmlChar *)elem, 1);
24056 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
24057 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 3);
Daniel Veillard42595322004-11-08 10:52:06 +000024058 xmlResetLastError();
24059 if (mem_base != xmlMemBlocks()) {
24060 printf("Leak of %d blocks found in xmlGetDtdQAttrDesc",
24061 xmlMemBlocks() - mem_base);
24062 test_ret++;
24063 printf(" %d", n_dtd);
24064 printf(" %d", n_elem);
24065 printf(" %d", n_name);
24066 printf(" %d", n_prefix);
24067 printf("\n");
24068 }
24069 }
24070 }
24071 }
24072 }
Daniel Veillard42595322004-11-08 10:52:06 +000024073 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024074
Daniel Veillard42595322004-11-08 10:52:06 +000024075 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024076}
24077
24078
24079static int
24080test_xmlGetDtdQElementDesc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024081 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024082
Daniel Veillard42595322004-11-08 10:52:06 +000024083 int mem_base;
24084 xmlElementPtr ret_val;
24085 xmlDtdPtr dtd; /* a pointer to the DtD to search */
24086 int n_dtd;
24087 xmlChar * name; /* the element name */
24088 int n_name;
24089 xmlChar * prefix; /* the element namespace prefix */
24090 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024091
Daniel Veillard42595322004-11-08 10:52:06 +000024092 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
24093 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24094 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
24095 mem_base = xmlMemBlocks();
24096 dtd = gen_xmlDtdPtr(n_dtd, 0);
24097 name = gen_const_xmlChar_ptr(n_name, 1);
24098 prefix = gen_const_xmlChar_ptr(n_prefix, 2);
24099
William M. Brackf13f77f2004-11-12 16:03:48 +000024100 ret_val = xmlGetDtdQElementDesc(dtd, (const xmlChar *)name, (const xmlChar *)prefix);
Daniel Veillard42595322004-11-08 10:52:06 +000024101 desret_xmlElementPtr(ret_val);
24102 call_tests++;
24103 des_xmlDtdPtr(n_dtd, dtd, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024104 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
24105 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 2);
Daniel Veillard42595322004-11-08 10:52:06 +000024106 xmlResetLastError();
24107 if (mem_base != xmlMemBlocks()) {
24108 printf("Leak of %d blocks found in xmlGetDtdQElementDesc",
24109 xmlMemBlocks() - mem_base);
24110 test_ret++;
24111 printf(" %d", n_dtd);
24112 printf(" %d", n_name);
24113 printf(" %d", n_prefix);
24114 printf("\n");
24115 }
24116 }
24117 }
24118 }
Daniel Veillard42595322004-11-08 10:52:06 +000024119 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024120
Daniel Veillard42595322004-11-08 10:52:06 +000024121 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024122}
24123
24124
24125static int
24126test_xmlGetID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024127 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024128
Daniel Veillard57b25162004-11-06 14:50:18 +000024129 int mem_base;
24130 xmlAttrPtr ret_val;
24131 xmlDocPtr doc; /* pointer to the document */
24132 int n_doc;
24133 xmlChar * ID; /* the ID value */
24134 int n_ID;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024135
Daniel Veillard57b25162004-11-06 14:50:18 +000024136 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24137 for (n_ID = 0;n_ID < gen_nb_const_xmlChar_ptr;n_ID++) {
24138 mem_base = xmlMemBlocks();
24139 doc = gen_xmlDocPtr(n_doc, 0);
24140 ID = gen_const_xmlChar_ptr(n_ID, 1);
24141
William M. Brackf13f77f2004-11-12 16:03:48 +000024142 ret_val = xmlGetID(doc, (const xmlChar *)ID);
Daniel Veillard57b25162004-11-06 14:50:18 +000024143 desret_xmlAttrPtr(ret_val);
24144 call_tests++;
24145 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024146 des_const_xmlChar_ptr(n_ID, (const xmlChar *)ID, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +000024147 xmlResetLastError();
24148 if (mem_base != xmlMemBlocks()) {
24149 printf("Leak of %d blocks found in xmlGetID",
24150 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024151 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000024152 printf(" %d", n_doc);
24153 printf(" %d", n_ID);
24154 printf("\n");
24155 }
24156 }
24157 }
Daniel Veillard57b25162004-11-06 14:50:18 +000024158 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024159
Daniel Veillard42595322004-11-08 10:52:06 +000024160 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024161}
24162
24163
24164static int
24165test_xmlGetRefs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024166 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024167
24168
24169 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000024170 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024171}
24172
24173
24174static int
24175test_xmlIsID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024176 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024177
Daniel Veillardce244ad2004-11-05 10:03:46 +000024178 int mem_base;
24179 int ret_val;
24180 xmlDocPtr doc; /* the document */
24181 int n_doc;
24182 xmlNodePtr elem; /* the element carrying the attribute */
24183 int n_elem;
24184 xmlAttrPtr attr; /* the attribute */
24185 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024186
Daniel Veillardce244ad2004-11-05 10:03:46 +000024187 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24188 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
24189 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
24190 mem_base = xmlMemBlocks();
24191 doc = gen_xmlDocPtr(n_doc, 0);
24192 elem = gen_xmlNodePtr(n_elem, 1);
24193 attr = gen_xmlAttrPtr(n_attr, 2);
24194
24195 ret_val = xmlIsID(doc, elem, attr);
24196 desret_int(ret_val);
24197 call_tests++;
24198 des_xmlDocPtr(n_doc, doc, 0);
24199 des_xmlNodePtr(n_elem, elem, 1);
24200 des_xmlAttrPtr(n_attr, attr, 2);
24201 xmlResetLastError();
24202 if (mem_base != xmlMemBlocks()) {
24203 printf("Leak of %d blocks found in xmlIsID",
24204 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024205 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000024206 printf(" %d", n_doc);
24207 printf(" %d", n_elem);
24208 printf(" %d", n_attr);
24209 printf("\n");
24210 }
24211 }
24212 }
24213 }
Daniel Veillardce244ad2004-11-05 10:03:46 +000024214 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024215
Daniel Veillard42595322004-11-08 10:52:06 +000024216 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024217}
24218
24219
24220static int
24221test_xmlIsMixedElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024222 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024223
24224 int mem_base;
24225 int ret_val;
24226 xmlDocPtr doc; /* the document */
24227 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024228 xmlChar * name; /* the element name */
Daniel Veillardd93f6252004-11-02 15:53:51 +000024229 int n_name;
24230
24231 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24232 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24233 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024234 doc = gen_xmlDocPtr(n_doc, 0);
24235 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024236
William M. Brackf13f77f2004-11-12 16:03:48 +000024237 ret_val = xmlIsMixedElement(doc, (const xmlChar *)name);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024238 desret_int(ret_val);
24239 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024240 des_xmlDocPtr(n_doc, doc, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024241 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024242 xmlResetLastError();
24243 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000024244 printf("Leak of %d blocks found in xmlIsMixedElement",
Daniel Veillardd93f6252004-11-02 15:53:51 +000024245 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024246 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000024247 printf(" %d", n_doc);
24248 printf(" %d", n_name);
24249 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000024250 }
24251 }
24252 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000024253 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024254
Daniel Veillard42595322004-11-08 10:52:06 +000024255 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024256}
24257
24258
24259static int
24260test_xmlIsRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024261 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024262
Daniel Veillardce244ad2004-11-05 10:03:46 +000024263 int mem_base;
24264 int ret_val;
24265 xmlDocPtr doc; /* the document */
24266 int n_doc;
24267 xmlNodePtr elem; /* the element carrying the attribute */
24268 int n_elem;
24269 xmlAttrPtr attr; /* the attribute */
24270 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024271
Daniel Veillardce244ad2004-11-05 10:03:46 +000024272 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24273 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
24274 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
24275 mem_base = xmlMemBlocks();
24276 doc = gen_xmlDocPtr(n_doc, 0);
24277 elem = gen_xmlNodePtr(n_elem, 1);
24278 attr = gen_xmlAttrPtr(n_attr, 2);
24279
24280 ret_val = xmlIsRef(doc, elem, attr);
24281 desret_int(ret_val);
24282 call_tests++;
24283 des_xmlDocPtr(n_doc, doc, 0);
24284 des_xmlNodePtr(n_elem, elem, 1);
24285 des_xmlAttrPtr(n_attr, attr, 2);
24286 xmlResetLastError();
24287 if (mem_base != xmlMemBlocks()) {
24288 printf("Leak of %d blocks found in xmlIsRef",
24289 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024290 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000024291 printf(" %d", n_doc);
24292 printf(" %d", n_elem);
24293 printf(" %d", n_attr);
24294 printf("\n");
24295 }
24296 }
24297 }
24298 }
Daniel Veillardce244ad2004-11-05 10:03:46 +000024299 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024300
Daniel Veillard42595322004-11-08 10:52:06 +000024301 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024302}
24303
24304
24305static int
24306test_xmlNewElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024307 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024308
William M. Brack094dd862004-11-14 14:28:34 +000024309 int mem_base;
24310 xmlElementContentPtr ret_val;
24311 xmlChar * name; /* the subelement name or NULL */
24312 int n_name;
24313 xmlElementContentType type; /* the type of element content decl */
24314 int n_type;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024315
William M. Brack094dd862004-11-14 14:28:34 +000024316 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24317 for (n_type = 0;n_type < gen_nb_xmlElementContentType;n_type++) {
24318 mem_base = xmlMemBlocks();
24319 name = gen_const_xmlChar_ptr(n_name, 0);
24320 type = gen_xmlElementContentType(n_type, 1);
24321
24322 ret_val = xmlNewElementContent((const xmlChar *)name, type);
24323 desret_xmlElementContentPtr(ret_val);
24324 call_tests++;
24325 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
24326 des_xmlElementContentType(n_type, type, 1);
24327 xmlResetLastError();
24328 if (mem_base != xmlMemBlocks()) {
24329 printf("Leak of %d blocks found in xmlNewElementContent",
24330 xmlMemBlocks() - mem_base);
24331 test_ret++;
24332 printf(" %d", n_name);
24333 printf(" %d", n_type);
24334 printf("\n");
24335 }
24336 }
24337 }
24338 function_tests++;
24339
Daniel Veillard42595322004-11-08 10:52:06 +000024340 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024341}
24342
24343
24344static int
24345test_xmlNewValidCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024346 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024347
24348
24349 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000024350 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024351}
24352
24353
24354static int
24355test_xmlRemoveID(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024356 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024357
Daniel Veillardce244ad2004-11-05 10:03:46 +000024358 int mem_base;
24359 int ret_val;
24360 xmlDocPtr doc; /* the document */
24361 int n_doc;
24362 xmlAttrPtr attr; /* the attribute */
24363 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024364
Daniel Veillardce244ad2004-11-05 10:03:46 +000024365 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24366 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
24367 mem_base = xmlMemBlocks();
24368 doc = gen_xmlDocPtr(n_doc, 0);
24369 attr = gen_xmlAttrPtr(n_attr, 1);
24370
24371 ret_val = xmlRemoveID(doc, attr);
24372 desret_int(ret_val);
24373 call_tests++;
24374 des_xmlDocPtr(n_doc, doc, 0);
24375 des_xmlAttrPtr(n_attr, attr, 1);
24376 xmlResetLastError();
24377 if (mem_base != xmlMemBlocks()) {
24378 printf("Leak of %d blocks found in xmlRemoveID",
24379 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024380 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000024381 printf(" %d", n_doc);
24382 printf(" %d", n_attr);
24383 printf("\n");
24384 }
24385 }
24386 }
Daniel Veillardce244ad2004-11-05 10:03:46 +000024387 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024388
Daniel Veillard42595322004-11-08 10:52:06 +000024389 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024390}
24391
24392
24393static int
24394test_xmlRemoveRef(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024395 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024396
Daniel Veillardce244ad2004-11-05 10:03:46 +000024397 int mem_base;
24398 int ret_val;
24399 xmlDocPtr doc; /* the document */
24400 int n_doc;
24401 xmlAttrPtr attr; /* the attribute */
24402 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024403
Daniel Veillardce244ad2004-11-05 10:03:46 +000024404 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24405 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
24406 mem_base = xmlMemBlocks();
24407 doc = gen_xmlDocPtr(n_doc, 0);
24408 attr = gen_xmlAttrPtr(n_attr, 1);
24409
24410 ret_val = xmlRemoveRef(doc, attr);
24411 desret_int(ret_val);
24412 call_tests++;
24413 des_xmlDocPtr(n_doc, doc, 0);
24414 des_xmlAttrPtr(n_attr, attr, 1);
24415 xmlResetLastError();
24416 if (mem_base != xmlMemBlocks()) {
24417 printf("Leak of %d blocks found in xmlRemoveRef",
24418 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024419 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000024420 printf(" %d", n_doc);
24421 printf(" %d", n_attr);
24422 printf("\n");
24423 }
24424 }
24425 }
Daniel Veillardce244ad2004-11-05 10:03:46 +000024426 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024427
Daniel Veillard42595322004-11-08 10:52:06 +000024428 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024429}
24430
24431
24432static int
24433test_xmlSnprintfElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024434 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024435
Daniel Veillardce682bc2004-11-05 17:22:25 +000024436 int mem_base;
24437 char * buf; /* an output buffer */
24438 int n_buf;
24439 int size; /* the buffer size */
24440 int n_size;
24441 xmlElementContentPtr content; /* An element table */
24442 int n_content;
24443 int glob; /* 1 if one must print the englobing parenthesis, 0 otherwise */
24444 int n_glob;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024445
Daniel Veillardce682bc2004-11-05 17:22:25 +000024446 for (n_buf = 0;n_buf < gen_nb_char_ptr;n_buf++) {
24447 for (n_size = 0;n_size < gen_nb_int;n_size++) {
24448 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
24449 for (n_glob = 0;n_glob < gen_nb_int;n_glob++) {
24450 mem_base = xmlMemBlocks();
24451 buf = gen_char_ptr(n_buf, 0);
24452 size = gen_int(n_size, 1);
24453 content = gen_xmlElementContentPtr(n_content, 2);
24454 glob = gen_int(n_glob, 3);
24455
24456 xmlSnprintfElementContent(buf, size, content, glob);
24457 call_tests++;
24458 des_char_ptr(n_buf, buf, 0);
24459 des_int(n_size, size, 1);
24460 des_xmlElementContentPtr(n_content, content, 2);
24461 des_int(n_glob, glob, 3);
24462 xmlResetLastError();
24463 if (mem_base != xmlMemBlocks()) {
24464 printf("Leak of %d blocks found in xmlSnprintfElementContent",
24465 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024466 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024467 printf(" %d", n_buf);
24468 printf(" %d", n_size);
24469 printf(" %d", n_content);
24470 printf(" %d", n_glob);
24471 printf("\n");
24472 }
24473 }
24474 }
24475 }
24476 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000024477 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024478
Daniel Veillard42595322004-11-08 10:52:06 +000024479 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024480}
24481
24482
24483static int
24484test_xmlSprintfElementContent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024485 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024486
William M. Brack21e4ef22005-01-02 09:53:13 +000024487#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000024488#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000024489 int mem_base;
24490 char * buf; /* an output buffer */
24491 int n_buf;
24492 xmlElementContentPtr content; /* An element table */
24493 int n_content;
24494 int glob; /* 1 if one must print the englobing parenthesis, 0 otherwise */
24495 int n_glob;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024496
Daniel Veillardce682bc2004-11-05 17:22:25 +000024497 for (n_buf = 0;n_buf < gen_nb_char_ptr;n_buf++) {
24498 for (n_content = 0;n_content < gen_nb_xmlElementContentPtr;n_content++) {
24499 for (n_glob = 0;n_glob < gen_nb_int;n_glob++) {
24500 mem_base = xmlMemBlocks();
24501 buf = gen_char_ptr(n_buf, 0);
24502 content = gen_xmlElementContentPtr(n_content, 1);
24503 glob = gen_int(n_glob, 2);
24504
24505 xmlSprintfElementContent(buf, content, glob);
24506 call_tests++;
24507 des_char_ptr(n_buf, buf, 0);
24508 des_xmlElementContentPtr(n_content, content, 1);
24509 des_int(n_glob, glob, 2);
24510 xmlResetLastError();
24511 if (mem_base != xmlMemBlocks()) {
24512 printf("Leak of %d blocks found in xmlSprintfElementContent",
24513 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024514 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024515 printf(" %d", n_buf);
24516 printf(" %d", n_content);
24517 printf(" %d", n_glob);
24518 printf("\n");
24519 }
24520 }
24521 }
24522 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024523 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000024524#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000024525#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000024526
Daniel Veillard42595322004-11-08 10:52:06 +000024527 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024528}
24529
24530
24531static int
24532test_xmlValidBuildContentModel(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024533 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024534
William M. Brack21e4ef22005-01-02 09:53:13 +000024535#if defined(LIBXML_VALID_ENABLED) && defined(LIBXML_REGEXP_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000024536 int mem_base;
24537 int ret_val;
24538 xmlValidCtxtPtr ctxt; /* a validation context */
24539 int n_ctxt;
24540 xmlElementPtr elem; /* an element declaration node */
24541 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024542
Daniel Veillardce682bc2004-11-05 17:22:25 +000024543 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
24544 for (n_elem = 0;n_elem < gen_nb_xmlElementPtr;n_elem++) {
24545 mem_base = xmlMemBlocks();
24546 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
24547 elem = gen_xmlElementPtr(n_elem, 1);
24548
24549 ret_val = xmlValidBuildContentModel(ctxt, elem);
24550 desret_int(ret_val);
24551 call_tests++;
24552 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
24553 des_xmlElementPtr(n_elem, elem, 1);
24554 xmlResetLastError();
24555 if (mem_base != xmlMemBlocks()) {
24556 printf("Leak of %d blocks found in xmlValidBuildContentModel",
24557 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024558 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024559 printf(" %d", n_ctxt);
24560 printf(" %d", n_elem);
24561 printf("\n");
24562 }
24563 }
24564 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024565 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024566#endif
24567
Daniel Veillard42595322004-11-08 10:52:06 +000024568 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024569}
24570
24571
24572static int
24573test_xmlValidCtxtNormalizeAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024574 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024575
William M. Brack21e4ef22005-01-02 09:53:13 +000024576#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024577 int mem_base;
24578 xmlChar * ret_val;
24579 xmlValidCtxtPtr ctxt; /* the validation context or NULL */
24580 int n_ctxt;
24581 xmlDocPtr doc; /* the document */
24582 int n_doc;
24583 xmlNodePtr elem; /* the parent */
24584 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024585 xmlChar * name; /* the attribute name */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024586 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024587 xmlChar * value; /* the attribute value */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024588 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024589
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024590 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
24591 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24592 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
24593 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24594 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
24595 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024596 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
24597 doc = gen_xmlDocPtr(n_doc, 1);
24598 elem = gen_xmlNodePtr(n_elem, 2);
24599 name = gen_const_xmlChar_ptr(n_name, 3);
24600 value = gen_const_xmlChar_ptr(n_value, 4);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024601
William M. Brackf13f77f2004-11-12 16:03:48 +000024602 ret_val = xmlValidCtxtNormalizeAttributeValue(ctxt, doc, elem, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024603 desret_xmlChar_ptr(ret_val);
24604 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024605 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
24606 des_xmlDocPtr(n_doc, doc, 1);
24607 des_xmlNodePtr(n_elem, elem, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000024608 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 3);
24609 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 4);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024610 xmlResetLastError();
24611 if (mem_base != xmlMemBlocks()) {
24612 printf("Leak of %d blocks found in xmlValidCtxtNormalizeAttributeValue",
24613 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024614 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024615 printf(" %d", n_ctxt);
24616 printf(" %d", n_doc);
24617 printf(" %d", n_elem);
24618 printf(" %d", n_name);
24619 printf(" %d", n_value);
24620 printf("\n");
24621 }
24622 }
24623 }
24624 }
24625 }
24626 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024627 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024628#endif
24629
Daniel Veillard42595322004-11-08 10:52:06 +000024630 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024631}
24632
24633
Daniel Veillardce682bc2004-11-05 17:22:25 +000024634#define gen_nb_xmlElementContent_ptr 1
24635static xmlElementContent * gen_xmlElementContent_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
24636 return(NULL);
24637}
24638static void des_xmlElementContent_ptr(int no ATTRIBUTE_UNUSED, xmlElementContent * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
24639}
24640
Daniel Veillardd93f6252004-11-02 15:53:51 +000024641static int
24642test_xmlValidGetPotentialChildren(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024643 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024644
William M. Brack21e4ef22005-01-02 09:53:13 +000024645#if defined(LIBXML_VALID_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000024646#ifdef LIBXML_VALID_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024647 int mem_base;
24648 int ret_val;
24649 xmlElementContent * ctree; /* an element content tree */
24650 int n_ctree;
24651 xmlChar ** list; /* an array to store the list of child names */
24652 int n_list;
24653 int * len; /* a pointer to the number of element in the list */
24654 int n_len;
24655 int max; /* the size of the array */
24656 int n_max;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024657
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024658 for (n_ctree = 0;n_ctree < gen_nb_xmlElementContent_ptr;n_ctree++) {
24659 for (n_list = 0;n_list < gen_nb_const_xmlChar_ptr_ptr;n_list++) {
24660 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
24661 for (n_max = 0;n_max < gen_nb_int;n_max++) {
24662 mem_base = xmlMemBlocks();
24663 ctree = gen_xmlElementContent_ptr(n_ctree, 0);
24664 list = gen_const_xmlChar_ptr_ptr(n_list, 1);
24665 len = gen_int_ptr(n_len, 2);
24666 max = gen_int(n_max, 3);
24667
William M. Brackf13f77f2004-11-12 16:03:48 +000024668 ret_val = xmlValidGetPotentialChildren(ctree, (const xmlChar **)list, len, max);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024669 desret_int(ret_val);
24670 call_tests++;
24671 des_xmlElementContent_ptr(n_ctree, ctree, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024672 des_const_xmlChar_ptr_ptr(n_list, (const xmlChar **)list, 1);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024673 des_int_ptr(n_len, len, 2);
24674 des_int(n_max, max, 3);
24675 xmlResetLastError();
24676 if (mem_base != xmlMemBlocks()) {
24677 printf("Leak of %d blocks found in xmlValidGetPotentialChildren",
24678 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024679 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024680 printf(" %d", n_ctree);
24681 printf(" %d", n_list);
24682 printf(" %d", n_len);
24683 printf(" %d", n_max);
24684 printf("\n");
24685 }
24686 }
24687 }
24688 }
24689 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024690 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000024691#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000024692#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024693
Daniel Veillard42595322004-11-08 10:52:06 +000024694 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024695}
24696
24697
24698static int
24699test_xmlValidGetValidElements(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024700 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024701
William M. Brack21e4ef22005-01-02 09:53:13 +000024702#if defined(LIBXML_VALID_ENABLED)
Daniel Veillarda521d282004-11-09 14:59:59 +000024703#ifdef LIBXML_VALID_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024704 int mem_base;
24705 int ret_val;
24706 xmlNode * prev; /* an element to insert after */
24707 int n_prev;
24708 xmlNode * next; /* an element to insert next */
24709 int n_next;
24710 xmlChar ** names; /* an array to store the list of child names */
24711 int n_names;
24712 int max; /* the size of the array */
24713 int n_max;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024714
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024715 for (n_prev = 0;n_prev < gen_nb_xmlNodePtr;n_prev++) {
24716 for (n_next = 0;n_next < gen_nb_xmlNodePtr;n_next++) {
24717 for (n_names = 0;n_names < gen_nb_const_xmlChar_ptr_ptr;n_names++) {
24718 for (n_max = 0;n_max < gen_nb_int;n_max++) {
24719 mem_base = xmlMemBlocks();
24720 prev = gen_xmlNodePtr(n_prev, 0);
24721 next = gen_xmlNodePtr(n_next, 1);
24722 names = gen_const_xmlChar_ptr_ptr(n_names, 2);
24723 max = gen_int(n_max, 3);
24724
William M. Brackf13f77f2004-11-12 16:03:48 +000024725 ret_val = xmlValidGetValidElements(prev, next, (const xmlChar **)names, max);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024726 desret_int(ret_val);
24727 call_tests++;
24728 des_xmlNodePtr(n_prev, prev, 0);
24729 des_xmlNodePtr(n_next, next, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000024730 des_const_xmlChar_ptr_ptr(n_names, (const xmlChar **)names, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024731 des_int(n_max, max, 3);
24732 xmlResetLastError();
24733 if (mem_base != xmlMemBlocks()) {
24734 printf("Leak of %d blocks found in xmlValidGetValidElements",
24735 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024736 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024737 printf(" %d", n_prev);
24738 printf(" %d", n_next);
24739 printf(" %d", n_names);
24740 printf(" %d", n_max);
24741 printf("\n");
24742 }
24743 }
24744 }
24745 }
24746 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024747 function_tests++;
Daniel Veillarda521d282004-11-09 14:59:59 +000024748#endif
William M. Brack21e4ef22005-01-02 09:53:13 +000024749#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000024750
Daniel Veillard42595322004-11-08 10:52:06 +000024751 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024752}
24753
24754
24755static int
24756test_xmlValidNormalizeAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024757 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024758
William M. Brack21e4ef22005-01-02 09:53:13 +000024759#if defined(LIBXML_VALID_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024760 int mem_base;
24761 xmlChar * ret_val;
24762 xmlDocPtr doc; /* the document */
24763 int n_doc;
24764 xmlNodePtr elem; /* the parent */
24765 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024766 xmlChar * name; /* the attribute name */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024767 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024768 xmlChar * value; /* the attribute value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024769 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024770
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024771 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24772 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
24773 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
24774 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
24775 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024776 doc = gen_xmlDocPtr(n_doc, 0);
24777 elem = gen_xmlNodePtr(n_elem, 1);
24778 name = gen_const_xmlChar_ptr(n_name, 2);
24779 value = gen_const_xmlChar_ptr(n_value, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024780
William M. Brackf13f77f2004-11-12 16:03:48 +000024781 ret_val = xmlValidNormalizeAttributeValue(doc, elem, (const xmlChar *)name, (const xmlChar *)value);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024782 desret_xmlChar_ptr(ret_val);
24783 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024784 des_xmlDocPtr(n_doc, doc, 0);
24785 des_xmlNodePtr(n_elem, elem, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000024786 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
24787 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 3);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024788 xmlResetLastError();
24789 if (mem_base != xmlMemBlocks()) {
24790 printf("Leak of %d blocks found in xmlValidNormalizeAttributeValue",
24791 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024792 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024793 printf(" %d", n_doc);
24794 printf(" %d", n_elem);
24795 printf(" %d", n_name);
24796 printf(" %d", n_value);
24797 printf("\n");
24798 }
24799 }
24800 }
24801 }
24802 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024803 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000024804#endif
24805
Daniel Veillard42595322004-11-08 10:52:06 +000024806 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024807}
24808
24809
24810static int
24811test_xmlValidateAttributeDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024812 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024813
William M. Brack21e4ef22005-01-02 09:53:13 +000024814#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000024815 int mem_base;
24816 int ret_val;
24817 xmlValidCtxtPtr ctxt; /* the validation context */
24818 int n_ctxt;
24819 xmlDocPtr doc; /* a document instance */
24820 int n_doc;
24821 xmlAttributePtr attr; /* an attribute definition */
24822 int n_attr;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024823
Daniel Veillardce682bc2004-11-05 17:22:25 +000024824 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
24825 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24826 for (n_attr = 0;n_attr < gen_nb_xmlAttributePtr;n_attr++) {
24827 mem_base = xmlMemBlocks();
24828 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
24829 doc = gen_xmlDocPtr(n_doc, 1);
24830 attr = gen_xmlAttributePtr(n_attr, 2);
24831
24832 ret_val = xmlValidateAttributeDecl(ctxt, doc, attr);
24833 desret_int(ret_val);
24834 call_tests++;
24835 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
24836 des_xmlDocPtr(n_doc, doc, 1);
24837 des_xmlAttributePtr(n_attr, attr, 2);
24838 xmlResetLastError();
24839 if (mem_base != xmlMemBlocks()) {
24840 printf("Leak of %d blocks found in xmlValidateAttributeDecl",
24841 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024842 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024843 printf(" %d", n_ctxt);
24844 printf(" %d", n_doc);
24845 printf(" %d", n_attr);
24846 printf("\n");
24847 }
24848 }
24849 }
24850 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024851 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000024852#endif
24853
Daniel Veillard42595322004-11-08 10:52:06 +000024854 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024855}
24856
24857
24858static int
24859test_xmlValidateAttributeValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024860 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024861
William M. Brack21e4ef22005-01-02 09:53:13 +000024862#if defined(LIBXML_VALID_ENABLED)
Daniel Veillard57b25162004-11-06 14:50:18 +000024863 int mem_base;
24864 int ret_val;
24865 xmlAttributeType type; /* an attribute type */
24866 int n_type;
24867 xmlChar * value; /* an attribute value */
24868 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024869
Daniel Veillard57b25162004-11-06 14:50:18 +000024870 for (n_type = 0;n_type < gen_nb_xmlAttributeType;n_type++) {
24871 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
24872 mem_base = xmlMemBlocks();
24873 type = gen_xmlAttributeType(n_type, 0);
24874 value = gen_const_xmlChar_ptr(n_value, 1);
24875
William M. Brackf13f77f2004-11-12 16:03:48 +000024876 ret_val = xmlValidateAttributeValue(type, (const xmlChar *)value);
Daniel Veillard57b25162004-11-06 14:50:18 +000024877 desret_int(ret_val);
24878 call_tests++;
24879 des_xmlAttributeType(n_type, type, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000024880 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillard57b25162004-11-06 14:50:18 +000024881 xmlResetLastError();
24882 if (mem_base != xmlMemBlocks()) {
24883 printf("Leak of %d blocks found in xmlValidateAttributeValue",
24884 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024885 test_ret++;
Daniel Veillard57b25162004-11-06 14:50:18 +000024886 printf(" %d", n_type);
24887 printf(" %d", n_value);
24888 printf("\n");
24889 }
24890 }
24891 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024892 function_tests++;
Daniel Veillard57b25162004-11-06 14:50:18 +000024893#endif
24894
Daniel Veillard42595322004-11-08 10:52:06 +000024895 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024896}
24897
24898
24899static int
24900test_xmlValidateDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024901 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024902
William M. Brack21e4ef22005-01-02 09:53:13 +000024903#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024904 int mem_base;
24905 int ret_val;
24906 xmlValidCtxtPtr ctxt; /* the validation context */
24907 int n_ctxt;
24908 xmlDocPtr doc; /* a document instance */
24909 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024910
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024911 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
24912 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24913 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024914 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
24915 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024916
24917 ret_val = xmlValidateDocument(ctxt, doc);
24918 desret_int(ret_val);
24919 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024920 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
24921 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024922 xmlResetLastError();
24923 if (mem_base != xmlMemBlocks()) {
24924 printf("Leak of %d blocks found in xmlValidateDocument",
24925 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024926 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024927 printf(" %d", n_ctxt);
24928 printf(" %d", n_doc);
24929 printf("\n");
24930 }
24931 }
24932 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024933 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024934#endif
24935
Daniel Veillard42595322004-11-08 10:52:06 +000024936 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024937}
24938
24939
24940static int
24941test_xmlValidateDocumentFinal(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024942 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024943
William M. Brack21e4ef22005-01-02 09:53:13 +000024944#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024945 int mem_base;
24946 int ret_val;
24947 xmlValidCtxtPtr ctxt; /* the validation context */
24948 int n_ctxt;
24949 xmlDocPtr doc; /* a document instance */
24950 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024951
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024952 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
24953 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24954 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000024955 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
24956 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024957
24958 ret_val = xmlValidateDocumentFinal(ctxt, doc);
24959 desret_int(ret_val);
24960 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000024961 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
24962 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024963 xmlResetLastError();
24964 if (mem_base != xmlMemBlocks()) {
24965 printf("Leak of %d blocks found in xmlValidateDocumentFinal",
24966 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000024967 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024968 printf(" %d", n_ctxt);
24969 printf(" %d", n_doc);
24970 printf("\n");
24971 }
24972 }
24973 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000024974 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000024975#endif
24976
Daniel Veillard42595322004-11-08 10:52:06 +000024977 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000024978}
24979
24980
24981static int
24982test_xmlValidateDtd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000024983 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024984
William M. Brack21e4ef22005-01-02 09:53:13 +000024985#if defined(LIBXML_VALID_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000024986 int mem_base;
24987 int ret_val;
24988 xmlValidCtxtPtr ctxt; /* the validation context */
24989 int n_ctxt;
24990 xmlDocPtr doc; /* a document instance */
24991 int n_doc;
24992 xmlDtdPtr dtd; /* a dtd instance */
24993 int n_dtd;
Daniel Veillardd93f6252004-11-02 15:53:51 +000024994
Daniel Veillard27f20102004-11-05 11:50:11 +000024995 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
24996 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
24997 for (n_dtd = 0;n_dtd < gen_nb_xmlDtdPtr;n_dtd++) {
24998 mem_base = xmlMemBlocks();
24999 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25000 doc = gen_xmlDocPtr(n_doc, 1);
25001 dtd = gen_xmlDtdPtr(n_dtd, 2);
25002
25003 ret_val = xmlValidateDtd(ctxt, doc, dtd);
25004 desret_int(ret_val);
25005 call_tests++;
25006 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25007 des_xmlDocPtr(n_doc, doc, 1);
25008 des_xmlDtdPtr(n_dtd, dtd, 2);
25009 xmlResetLastError();
25010 if (mem_base != xmlMemBlocks()) {
25011 printf("Leak of %d blocks found in xmlValidateDtd",
25012 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025013 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000025014 printf(" %d", n_ctxt);
25015 printf(" %d", n_doc);
25016 printf(" %d", n_dtd);
25017 printf("\n");
25018 }
25019 }
25020 }
25021 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025022 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000025023#endif
25024
Daniel Veillard42595322004-11-08 10:52:06 +000025025 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025026}
25027
25028
25029static int
25030test_xmlValidateDtdFinal(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025031 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025032
William M. Brack21e4ef22005-01-02 09:53:13 +000025033#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025034 int mem_base;
25035 int ret_val;
25036 xmlValidCtxtPtr ctxt; /* the validation context */
25037 int n_ctxt;
25038 xmlDocPtr doc; /* a document instance */
25039 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025040
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025041 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25042 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25043 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025044 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25045 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025046
25047 ret_val = xmlValidateDtdFinal(ctxt, doc);
25048 desret_int(ret_val);
25049 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025050 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25051 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025052 xmlResetLastError();
25053 if (mem_base != xmlMemBlocks()) {
25054 printf("Leak of %d blocks found in xmlValidateDtdFinal",
25055 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025056 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025057 printf(" %d", n_ctxt);
25058 printf(" %d", n_doc);
25059 printf("\n");
25060 }
25061 }
25062 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025063 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025064#endif
25065
Daniel Veillard42595322004-11-08 10:52:06 +000025066 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025067}
25068
25069
25070static int
25071test_xmlValidateElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025072 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025073
William M. Brack21e4ef22005-01-02 09:53:13 +000025074#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025075 int mem_base;
25076 int ret_val;
25077 xmlValidCtxtPtr ctxt; /* the validation context */
25078 int n_ctxt;
25079 xmlDocPtr doc; /* a document instance */
25080 int n_doc;
25081 xmlNodePtr elem; /* an element instance */
25082 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025083
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025084 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25085 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25086 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25087 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025088 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25089 doc = gen_xmlDocPtr(n_doc, 1);
25090 elem = gen_xmlNodePtr(n_elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025091
25092 ret_val = xmlValidateElement(ctxt, doc, elem);
25093 desret_int(ret_val);
25094 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025095 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25096 des_xmlDocPtr(n_doc, doc, 1);
25097 des_xmlNodePtr(n_elem, elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025098 xmlResetLastError();
25099 if (mem_base != xmlMemBlocks()) {
25100 printf("Leak of %d blocks found in xmlValidateElement",
25101 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025102 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025103 printf(" %d", n_ctxt);
25104 printf(" %d", n_doc);
25105 printf(" %d", n_elem);
25106 printf("\n");
25107 }
25108 }
25109 }
25110 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025111 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025112#endif
25113
Daniel Veillard42595322004-11-08 10:52:06 +000025114 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025115}
25116
25117
25118static int
25119test_xmlValidateElementDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025120 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025121
William M. Brack21e4ef22005-01-02 09:53:13 +000025122#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000025123 int mem_base;
25124 int ret_val;
25125 xmlValidCtxtPtr ctxt; /* the validation context */
25126 int n_ctxt;
25127 xmlDocPtr doc; /* a document instance */
25128 int n_doc;
25129 xmlElementPtr elem; /* an element definition */
25130 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025131
Daniel Veillardce682bc2004-11-05 17:22:25 +000025132 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25133 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25134 for (n_elem = 0;n_elem < gen_nb_xmlElementPtr;n_elem++) {
25135 mem_base = xmlMemBlocks();
25136 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25137 doc = gen_xmlDocPtr(n_doc, 1);
25138 elem = gen_xmlElementPtr(n_elem, 2);
25139
25140 ret_val = xmlValidateElementDecl(ctxt, doc, elem);
25141 desret_int(ret_val);
25142 call_tests++;
25143 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25144 des_xmlDocPtr(n_doc, doc, 1);
25145 des_xmlElementPtr(n_elem, elem, 2);
25146 xmlResetLastError();
25147 if (mem_base != xmlMemBlocks()) {
25148 printf("Leak of %d blocks found in xmlValidateElementDecl",
25149 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025150 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025151 printf(" %d", n_ctxt);
25152 printf(" %d", n_doc);
25153 printf(" %d", n_elem);
25154 printf("\n");
25155 }
25156 }
25157 }
25158 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025159 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025160#endif
25161
Daniel Veillard42595322004-11-08 10:52:06 +000025162 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025163}
25164
25165
25166static int
25167test_xmlValidateNameValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025168 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025169
William M. Brack21e4ef22005-01-02 09:53:13 +000025170#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000025171 int mem_base;
25172 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025173 xmlChar * value; /* an Name value */
Daniel Veillardd93f6252004-11-02 15:53:51 +000025174 int n_value;
25175
25176 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25177 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025178 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025179
William M. Brackf13f77f2004-11-12 16:03:48 +000025180 ret_val = xmlValidateNameValue((const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025181 desret_int(ret_val);
25182 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000025183 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025184 xmlResetLastError();
25185 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025186 printf("Leak of %d blocks found in xmlValidateNameValue",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025187 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025188 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025189 printf(" %d", n_value);
25190 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025191 }
25192 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025193 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025194#endif
25195
Daniel Veillard42595322004-11-08 10:52:06 +000025196 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025197}
25198
25199
25200static int
25201test_xmlValidateNamesValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025202 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025203
William M. Brack21e4ef22005-01-02 09:53:13 +000025204#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000025205 int mem_base;
25206 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025207 xmlChar * value; /* an Names value */
Daniel Veillardd93f6252004-11-02 15:53:51 +000025208 int n_value;
25209
25210 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25211 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025212 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025213
William M. Brackf13f77f2004-11-12 16:03:48 +000025214 ret_val = xmlValidateNamesValue((const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025215 desret_int(ret_val);
25216 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000025217 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025218 xmlResetLastError();
25219 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025220 printf("Leak of %d blocks found in xmlValidateNamesValue",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025221 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025222 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025223 printf(" %d", n_value);
25224 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025225 }
25226 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025227 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025228#endif
25229
Daniel Veillard42595322004-11-08 10:52:06 +000025230 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025231}
25232
25233
25234static int
25235test_xmlValidateNmtokenValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025236 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025237
William M. Brack21e4ef22005-01-02 09:53:13 +000025238#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000025239 int mem_base;
25240 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025241 xmlChar * value; /* an Nmtoken value */
Daniel Veillardd93f6252004-11-02 15:53:51 +000025242 int n_value;
25243
25244 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25245 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025246 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025247
William M. Brackf13f77f2004-11-12 16:03:48 +000025248 ret_val = xmlValidateNmtokenValue((const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025249 desret_int(ret_val);
25250 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000025251 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025252 xmlResetLastError();
25253 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025254 printf("Leak of %d blocks found in xmlValidateNmtokenValue",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025255 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025256 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025257 printf(" %d", n_value);
25258 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025259 }
25260 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025261 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025262#endif
25263
Daniel Veillard42595322004-11-08 10:52:06 +000025264 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025265}
25266
25267
25268static int
25269test_xmlValidateNmtokensValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025270 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025271
William M. Brack21e4ef22005-01-02 09:53:13 +000025272#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000025273 int mem_base;
25274 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025275 xmlChar * value; /* an Nmtokens value */
Daniel Veillardd93f6252004-11-02 15:53:51 +000025276 int n_value;
25277
25278 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25279 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025280 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025281
William M. Brackf13f77f2004-11-12 16:03:48 +000025282 ret_val = xmlValidateNmtokensValue((const xmlChar *)value);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025283 desret_int(ret_val);
25284 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000025285 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025286 xmlResetLastError();
25287 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025288 printf("Leak of %d blocks found in xmlValidateNmtokensValue",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025289 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025290 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025291 printf(" %d", n_value);
25292 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025293 }
25294 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025295 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025296#endif
25297
Daniel Veillard42595322004-11-08 10:52:06 +000025298 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025299}
25300
25301
25302static int
25303test_xmlValidateNotationDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025304 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025305
William M. Brack21e4ef22005-01-02 09:53:13 +000025306#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000025307 int mem_base;
25308 int ret_val;
25309 xmlValidCtxtPtr ctxt; /* the validation context */
25310 int n_ctxt;
25311 xmlDocPtr doc; /* a document instance */
25312 int n_doc;
25313 xmlNotationPtr nota; /* a notation definition */
25314 int n_nota;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025315
Daniel Veillardce682bc2004-11-05 17:22:25 +000025316 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25317 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25318 for (n_nota = 0;n_nota < gen_nb_xmlNotationPtr;n_nota++) {
25319 mem_base = xmlMemBlocks();
25320 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25321 doc = gen_xmlDocPtr(n_doc, 1);
25322 nota = gen_xmlNotationPtr(n_nota, 2);
25323
25324 ret_val = xmlValidateNotationDecl(ctxt, doc, nota);
25325 desret_int(ret_val);
25326 call_tests++;
25327 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25328 des_xmlDocPtr(n_doc, doc, 1);
25329 des_xmlNotationPtr(n_nota, nota, 2);
25330 xmlResetLastError();
25331 if (mem_base != xmlMemBlocks()) {
25332 printf("Leak of %d blocks found in xmlValidateNotationDecl",
25333 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025334 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025335 printf(" %d", n_ctxt);
25336 printf(" %d", n_doc);
25337 printf(" %d", n_nota);
25338 printf("\n");
25339 }
25340 }
25341 }
25342 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025343 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025344#endif
25345
Daniel Veillard42595322004-11-08 10:52:06 +000025346 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025347}
25348
25349
25350static int
25351test_xmlValidateNotationUse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025352 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025353
William M. Brack21e4ef22005-01-02 09:53:13 +000025354#if defined(LIBXML_VALID_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025355 int mem_base;
25356 int ret_val;
25357 xmlValidCtxtPtr ctxt; /* the validation context */
25358 int n_ctxt;
25359 xmlDocPtr doc; /* the document */
25360 int n_doc;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025361 xmlChar * notationName; /* the notation name to check */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025362 int n_notationName;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025363
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025364 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25365 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25366 for (n_notationName = 0;n_notationName < gen_nb_const_xmlChar_ptr;n_notationName++) {
25367 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025368 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25369 doc = gen_xmlDocPtr(n_doc, 1);
25370 notationName = gen_const_xmlChar_ptr(n_notationName, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025371
William M. Brackf13f77f2004-11-12 16:03:48 +000025372 ret_val = xmlValidateNotationUse(ctxt, doc, (const xmlChar *)notationName);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025373 desret_int(ret_val);
25374 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025375 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25376 des_xmlDocPtr(n_doc, doc, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000025377 des_const_xmlChar_ptr(n_notationName, (const xmlChar *)notationName, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025378 xmlResetLastError();
25379 if (mem_base != xmlMemBlocks()) {
25380 printf("Leak of %d blocks found in xmlValidateNotationUse",
25381 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025382 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025383 printf(" %d", n_ctxt);
25384 printf(" %d", n_doc);
25385 printf(" %d", n_notationName);
25386 printf("\n");
25387 }
25388 }
25389 }
25390 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025391 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025392#endif
25393
Daniel Veillard42595322004-11-08 10:52:06 +000025394 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025395}
25396
25397
25398static int
25399test_xmlValidateOneAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025400 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025401
William M. Brack21e4ef22005-01-02 09:53:13 +000025402#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardce244ad2004-11-05 10:03:46 +000025403 int mem_base;
25404 int ret_val;
25405 xmlValidCtxtPtr ctxt; /* the validation context */
25406 int n_ctxt;
25407 xmlDocPtr doc; /* a document instance */
25408 int n_doc;
25409 xmlNodePtr elem; /* an element instance */
25410 int n_elem;
25411 xmlAttrPtr attr; /* an attribute instance */
25412 int n_attr;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025413 xmlChar * value; /* the attribute value (without entities processing) */
Daniel Veillardce244ad2004-11-05 10:03:46 +000025414 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025415
Daniel Veillardce244ad2004-11-05 10:03:46 +000025416 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25417 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25418 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25419 for (n_attr = 0;n_attr < gen_nb_xmlAttrPtr;n_attr++) {
25420 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25421 mem_base = xmlMemBlocks();
25422 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25423 doc = gen_xmlDocPtr(n_doc, 1);
25424 elem = gen_xmlNodePtr(n_elem, 2);
25425 attr = gen_xmlAttrPtr(n_attr, 3);
25426 value = gen_const_xmlChar_ptr(n_value, 4);
25427
William M. Brackf13f77f2004-11-12 16:03:48 +000025428 ret_val = xmlValidateOneAttribute(ctxt, doc, elem, attr, (const xmlChar *)value);
Daniel Veillardce244ad2004-11-05 10:03:46 +000025429 desret_int(ret_val);
25430 call_tests++;
25431 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25432 des_xmlDocPtr(n_doc, doc, 1);
25433 des_xmlNodePtr(n_elem, elem, 2);
25434 des_xmlAttrPtr(n_attr, attr, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000025435 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 4);
Daniel Veillardce244ad2004-11-05 10:03:46 +000025436 xmlResetLastError();
25437 if (mem_base != xmlMemBlocks()) {
25438 printf("Leak of %d blocks found in xmlValidateOneAttribute",
25439 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025440 test_ret++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000025441 printf(" %d", n_ctxt);
25442 printf(" %d", n_doc);
25443 printf(" %d", n_elem);
25444 printf(" %d", n_attr);
25445 printf(" %d", n_value);
25446 printf("\n");
25447 }
25448 }
25449 }
25450 }
25451 }
25452 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025453 function_tests++;
Daniel Veillardce244ad2004-11-05 10:03:46 +000025454#endif
25455
Daniel Veillard42595322004-11-08 10:52:06 +000025456 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025457}
25458
25459
25460static int
25461test_xmlValidateOneElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025462 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025463
William M. Brack21e4ef22005-01-02 09:53:13 +000025464#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025465 int mem_base;
25466 int ret_val;
25467 xmlValidCtxtPtr ctxt; /* the validation context */
25468 int n_ctxt;
25469 xmlDocPtr doc; /* a document instance */
25470 int n_doc;
25471 xmlNodePtr elem; /* an element instance */
25472 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025473
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025474 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25475 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25476 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25477 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025478 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25479 doc = gen_xmlDocPtr(n_doc, 1);
25480 elem = gen_xmlNodePtr(n_elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025481
25482 ret_val = xmlValidateOneElement(ctxt, doc, elem);
25483 desret_int(ret_val);
25484 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025485 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25486 des_xmlDocPtr(n_doc, doc, 1);
25487 des_xmlNodePtr(n_elem, elem, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025488 xmlResetLastError();
25489 if (mem_base != xmlMemBlocks()) {
25490 printf("Leak of %d blocks found in xmlValidateOneElement",
25491 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025492 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025493 printf(" %d", n_ctxt);
25494 printf(" %d", n_doc);
25495 printf(" %d", n_elem);
25496 printf("\n");
25497 }
25498 }
25499 }
25500 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025501 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025502#endif
25503
Daniel Veillard42595322004-11-08 10:52:06 +000025504 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025505}
25506
25507
25508static int
25509test_xmlValidateOneNamespace(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025510 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025511
William M. Brack21e4ef22005-01-02 09:53:13 +000025512#if defined(LIBXML_VALID_ENABLED)
Daniel Veillard27f20102004-11-05 11:50:11 +000025513 int mem_base;
25514 int ret_val;
25515 xmlValidCtxtPtr ctxt; /* the validation context */
25516 int n_ctxt;
25517 xmlDocPtr doc; /* a document instance */
25518 int n_doc;
25519 xmlNodePtr elem; /* an element instance */
25520 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025521 xmlChar * prefix; /* the namespace prefix */
Daniel Veillard27f20102004-11-05 11:50:11 +000025522 int n_prefix;
25523 xmlNsPtr ns; /* an namespace declaration instance */
25524 int n_ns;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025525 xmlChar * value; /* the attribute value (without entities processing) */
Daniel Veillard27f20102004-11-05 11:50:11 +000025526 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025527
Daniel Veillard27f20102004-11-05 11:50:11 +000025528 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25529 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25530 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25531 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
25532 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
25533 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
25534 mem_base = xmlMemBlocks();
25535 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25536 doc = gen_xmlDocPtr(n_doc, 1);
25537 elem = gen_xmlNodePtr(n_elem, 2);
25538 prefix = gen_const_xmlChar_ptr(n_prefix, 3);
25539 ns = gen_xmlNsPtr(n_ns, 4);
25540 value = gen_const_xmlChar_ptr(n_value, 5);
25541
William M. Brackf13f77f2004-11-12 16:03:48 +000025542 ret_val = xmlValidateOneNamespace(ctxt, doc, elem, (const xmlChar *)prefix, ns, (const xmlChar *)value);
Daniel Veillard27f20102004-11-05 11:50:11 +000025543 desret_int(ret_val);
25544 call_tests++;
25545 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25546 des_xmlDocPtr(n_doc, doc, 1);
25547 des_xmlNodePtr(n_elem, elem, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000025548 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 3);
Daniel Veillard27f20102004-11-05 11:50:11 +000025549 des_xmlNsPtr(n_ns, ns, 4);
William M. Brackf13f77f2004-11-12 16:03:48 +000025550 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 5);
Daniel Veillard27f20102004-11-05 11:50:11 +000025551 xmlResetLastError();
25552 if (mem_base != xmlMemBlocks()) {
25553 printf("Leak of %d blocks found in xmlValidateOneNamespace",
25554 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025555 test_ret++;
Daniel Veillard27f20102004-11-05 11:50:11 +000025556 printf(" %d", n_ctxt);
25557 printf(" %d", n_doc);
25558 printf(" %d", n_elem);
25559 printf(" %d", n_prefix);
25560 printf(" %d", n_ns);
25561 printf(" %d", n_value);
25562 printf("\n");
25563 }
25564 }
25565 }
25566 }
25567 }
25568 }
25569 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025570 function_tests++;
Daniel Veillard27f20102004-11-05 11:50:11 +000025571#endif
25572
Daniel Veillard42595322004-11-08 10:52:06 +000025573 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025574}
25575
25576
25577static int
25578test_xmlValidatePopElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025579 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025580
William M. Brack21e4ef22005-01-02 09:53:13 +000025581#if defined(LIBXML_VALID_ENABLED) && defined(LIBXML_REGEXP_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025582 int mem_base;
25583 int ret_val;
25584 xmlValidCtxtPtr ctxt; /* the validation context */
25585 int n_ctxt;
25586 xmlDocPtr doc; /* a document instance */
25587 int n_doc;
25588 xmlNodePtr elem; /* an element instance */
25589 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025590 xmlChar * qname; /* the qualified name as appearing in the serialization */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025591 int n_qname;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025592
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025593 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25594 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25595 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25596 for (n_qname = 0;n_qname < gen_nb_const_xmlChar_ptr;n_qname++) {
25597 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025598 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25599 doc = gen_xmlDocPtr(n_doc, 1);
25600 elem = gen_xmlNodePtr(n_elem, 2);
25601 qname = gen_const_xmlChar_ptr(n_qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025602
William M. Brackf13f77f2004-11-12 16:03:48 +000025603 ret_val = xmlValidatePopElement(ctxt, doc, elem, (const xmlChar *)qname);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025604 desret_int(ret_val);
25605 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025606 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25607 des_xmlDocPtr(n_doc, doc, 1);
25608 des_xmlNodePtr(n_elem, elem, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000025609 des_const_xmlChar_ptr(n_qname, (const xmlChar *)qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025610 xmlResetLastError();
25611 if (mem_base != xmlMemBlocks()) {
25612 printf("Leak of %d blocks found in xmlValidatePopElement",
25613 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025614 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025615 printf(" %d", n_ctxt);
25616 printf(" %d", n_doc);
25617 printf(" %d", n_elem);
25618 printf(" %d", n_qname);
25619 printf("\n");
25620 }
25621 }
25622 }
25623 }
25624 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025625 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025626#endif
25627
Daniel Veillard42595322004-11-08 10:52:06 +000025628 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025629}
25630
25631
25632static int
25633test_xmlValidatePushCData(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025634 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025635
William M. Brack21e4ef22005-01-02 09:53:13 +000025636#if defined(LIBXML_VALID_ENABLED) && defined(LIBXML_REGEXP_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025637 int mem_base;
25638 int ret_val;
25639 xmlValidCtxtPtr ctxt; /* the validation context */
25640 int n_ctxt;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025641 xmlChar * data; /* some character data read */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025642 int n_data;
25643 int len; /* the lenght of the data */
25644 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025645
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025646 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25647 for (n_data = 0;n_data < gen_nb_const_xmlChar_ptr;n_data++) {
25648 for (n_len = 0;n_len < gen_nb_int;n_len++) {
25649 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025650 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25651 data = gen_const_xmlChar_ptr(n_data, 1);
25652 len = gen_int(n_len, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025653
William M. Brackf13f77f2004-11-12 16:03:48 +000025654 ret_val = xmlValidatePushCData(ctxt, (const xmlChar *)data, len);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025655 desret_int(ret_val);
25656 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025657 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000025658 des_const_xmlChar_ptr(n_data, (const xmlChar *)data, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000025659 des_int(n_len, len, 2);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025660 xmlResetLastError();
25661 if (mem_base != xmlMemBlocks()) {
25662 printf("Leak of %d blocks found in xmlValidatePushCData",
25663 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025664 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025665 printf(" %d", n_ctxt);
25666 printf(" %d", n_data);
25667 printf(" %d", n_len);
25668 printf("\n");
25669 }
25670 }
25671 }
25672 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025673 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025674#endif
25675
Daniel Veillard42595322004-11-08 10:52:06 +000025676 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025677}
25678
25679
25680static int
25681test_xmlValidatePushElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025682 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025683
William M. Brack21e4ef22005-01-02 09:53:13 +000025684#if defined(LIBXML_VALID_ENABLED) && defined(LIBXML_REGEXP_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025685 int mem_base;
25686 int ret_val;
25687 xmlValidCtxtPtr ctxt; /* the validation context */
25688 int n_ctxt;
25689 xmlDocPtr doc; /* a document instance */
25690 int n_doc;
25691 xmlNodePtr elem; /* an element instance */
25692 int n_elem;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025693 xmlChar * qname; /* the qualified name as appearing in the serialization */
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025694 int n_qname;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025695
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025696 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25697 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25698 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
25699 for (n_qname = 0;n_qname < gen_nb_const_xmlChar_ptr;n_qname++) {
25700 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025701 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25702 doc = gen_xmlDocPtr(n_doc, 1);
25703 elem = gen_xmlNodePtr(n_elem, 2);
25704 qname = gen_const_xmlChar_ptr(n_qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025705
William M. Brackf13f77f2004-11-12 16:03:48 +000025706 ret_val = xmlValidatePushElement(ctxt, doc, elem, (const xmlChar *)qname);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025707 desret_int(ret_val);
25708 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025709 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25710 des_xmlDocPtr(n_doc, doc, 1);
25711 des_xmlNodePtr(n_elem, elem, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000025712 des_const_xmlChar_ptr(n_qname, (const xmlChar *)qname, 3);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025713 xmlResetLastError();
25714 if (mem_base != xmlMemBlocks()) {
25715 printf("Leak of %d blocks found in xmlValidatePushElement",
25716 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025717 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025718 printf(" %d", n_ctxt);
25719 printf(" %d", n_doc);
25720 printf(" %d", n_elem);
25721 printf(" %d", n_qname);
25722 printf("\n");
25723 }
25724 }
25725 }
25726 }
25727 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025728 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025729#endif
25730
Daniel Veillard42595322004-11-08 10:52:06 +000025731 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025732}
25733
25734
25735static int
25736test_xmlValidateRoot(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025737 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025738
William M. Brack21e4ef22005-01-02 09:53:13 +000025739#if defined(LIBXML_VALID_ENABLED)
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025740 int mem_base;
25741 int ret_val;
25742 xmlValidCtxtPtr ctxt; /* the validation context */
25743 int n_ctxt;
25744 xmlDocPtr doc; /* a document instance */
25745 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025746
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025747 for (n_ctxt = 0;n_ctxt < gen_nb_xmlValidCtxtPtr;n_ctxt++) {
25748 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25749 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025750 ctxt = gen_xmlValidCtxtPtr(n_ctxt, 0);
25751 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025752
25753 ret_val = xmlValidateRoot(ctxt, doc);
25754 desret_int(ret_val);
25755 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025756 des_xmlValidCtxtPtr(n_ctxt, ctxt, 0);
25757 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025758 xmlResetLastError();
25759 if (mem_base != xmlMemBlocks()) {
25760 printf("Leak of %d blocks found in xmlValidateRoot",
25761 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025762 test_ret++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025763 printf(" %d", n_ctxt);
25764 printf(" %d", n_doc);
25765 printf("\n");
25766 }
25767 }
25768 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025769 function_tests++;
Daniel Veillardc0be74b2004-11-03 19:16:55 +000025770#endif
25771
Daniel Veillard42595322004-11-08 10:52:06 +000025772 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025773}
25774
25775static int
25776test_valid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025777 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025778
William M. Brack094dd862004-11-14 14:28:34 +000025779 if (quiet == 0) printf("Testing valid : 48 of 67 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000025780 test_ret += test_xmlAddAttributeDecl();
25781 test_ret += test_xmlAddElementDecl();
25782 test_ret += test_xmlAddID();
25783 test_ret += test_xmlAddNotationDecl();
25784 test_ret += test_xmlAddRef();
25785 test_ret += test_xmlCopyAttributeTable();
25786 test_ret += test_xmlCopyElementContent();
25787 test_ret += test_xmlCopyElementTable();
25788 test_ret += test_xmlCopyEnumeration();
25789 test_ret += test_xmlCopyNotationTable();
25790 test_ret += test_xmlCreateEnumeration();
25791 test_ret += test_xmlDumpAttributeDecl();
25792 test_ret += test_xmlDumpAttributeTable();
25793 test_ret += test_xmlDumpElementDecl();
25794 test_ret += test_xmlDumpElementTable();
25795 test_ret += test_xmlDumpNotationDecl();
25796 test_ret += test_xmlDumpNotationTable();
25797 test_ret += test_xmlGetDtdAttrDesc();
25798 test_ret += test_xmlGetDtdElementDesc();
25799 test_ret += test_xmlGetDtdNotationDesc();
25800 test_ret += test_xmlGetDtdQAttrDesc();
25801 test_ret += test_xmlGetDtdQElementDesc();
25802 test_ret += test_xmlGetID();
25803 test_ret += test_xmlGetRefs();
25804 test_ret += test_xmlIsID();
25805 test_ret += test_xmlIsMixedElement();
25806 test_ret += test_xmlIsRef();
25807 test_ret += test_xmlNewElementContent();
25808 test_ret += test_xmlNewValidCtxt();
25809 test_ret += test_xmlRemoveID();
25810 test_ret += test_xmlRemoveRef();
25811 test_ret += test_xmlSnprintfElementContent();
25812 test_ret += test_xmlSprintfElementContent();
25813 test_ret += test_xmlValidBuildContentModel();
25814 test_ret += test_xmlValidCtxtNormalizeAttributeValue();
25815 test_ret += test_xmlValidGetPotentialChildren();
25816 test_ret += test_xmlValidGetValidElements();
25817 test_ret += test_xmlValidNormalizeAttributeValue();
25818 test_ret += test_xmlValidateAttributeDecl();
25819 test_ret += test_xmlValidateAttributeValue();
25820 test_ret += test_xmlValidateDocument();
25821 test_ret += test_xmlValidateDocumentFinal();
25822 test_ret += test_xmlValidateDtd();
25823 test_ret += test_xmlValidateDtdFinal();
25824 test_ret += test_xmlValidateElement();
25825 test_ret += test_xmlValidateElementDecl();
25826 test_ret += test_xmlValidateNameValue();
25827 test_ret += test_xmlValidateNamesValue();
25828 test_ret += test_xmlValidateNmtokenValue();
25829 test_ret += test_xmlValidateNmtokensValue();
25830 test_ret += test_xmlValidateNotationDecl();
25831 test_ret += test_xmlValidateNotationUse();
25832 test_ret += test_xmlValidateOneAttribute();
25833 test_ret += test_xmlValidateOneElement();
25834 test_ret += test_xmlValidateOneNamespace();
25835 test_ret += test_xmlValidatePopElement();
25836 test_ret += test_xmlValidatePushCData();
25837 test_ret += test_xmlValidatePushElement();
25838 test_ret += test_xmlValidateRoot();
Daniel Veillardd93f6252004-11-02 15:53:51 +000025839
Daniel Veillard42595322004-11-08 10:52:06 +000025840 if (test_ret != 0)
25841 printf("Module valid: %d errors\n", test_ret);
25842 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025843}
25844
25845static int
25846test_xmlXIncludeNewContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025847 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025848
25849
25850 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000025851 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025852}
25853
25854
25855static int
25856test_xmlXIncludeProcess(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025857 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025858
William M. Brack21e4ef22005-01-02 09:53:13 +000025859#if defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000025860 int mem_base;
25861 int ret_val;
25862 xmlDocPtr doc; /* an XML document */
25863 int n_doc;
25864
25865 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25866 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025867 doc = gen_xmlDocPtr(n_doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025868
25869 ret_val = xmlXIncludeProcess(doc);
25870 desret_int(ret_val);
25871 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025872 des_xmlDocPtr(n_doc, doc, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025873 xmlResetLastError();
25874 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025875 printf("Leak of %d blocks found in xmlXIncludeProcess",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025876 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025877 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025878 printf(" %d", n_doc);
25879 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025880 }
25881 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025882 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025883#endif
25884
Daniel Veillard42595322004-11-08 10:52:06 +000025885 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025886}
25887
25888
25889static int
25890test_xmlXIncludeProcessFlags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025891 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025892
William M. Brack21e4ef22005-01-02 09:53:13 +000025893#if defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000025894 int mem_base;
25895 int ret_val;
25896 xmlDocPtr doc; /* an XML document */
25897 int n_doc;
25898 int flags; /* a set of xmlParserOption used for parsing XML includes */
25899 int n_flags;
25900
25901 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
25902 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
25903 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025904 doc = gen_xmlDocPtr(n_doc, 0);
25905 flags = gen_int(n_flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025906
25907 ret_val = xmlXIncludeProcessFlags(doc, flags);
25908 desret_int(ret_val);
25909 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025910 des_xmlDocPtr(n_doc, doc, 0);
25911 des_int(n_flags, flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025912 xmlResetLastError();
25913 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000025914 printf("Leak of %d blocks found in xmlXIncludeProcessFlags",
Daniel Veillardd93f6252004-11-02 15:53:51 +000025915 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025916 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000025917 printf(" %d", n_doc);
25918 printf(" %d", n_flags);
25919 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000025920 }
25921 }
25922 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025923 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025924#endif
25925
Daniel Veillard42595322004-11-08 10:52:06 +000025926 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025927}
25928
Daniel Veillarda521d282004-11-09 14:59:59 +000025929#ifdef LIBXML_XINCLUDE_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000025930
Daniel Veillardce682bc2004-11-05 17:22:25 +000025931#define gen_nb_xmlXIncludeCtxtPtr 1
25932static xmlXIncludeCtxtPtr gen_xmlXIncludeCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
25933 return(NULL);
25934}
25935static void des_xmlXIncludeCtxtPtr(int no ATTRIBUTE_UNUSED, xmlXIncludeCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
25936}
Daniel Veillarda521d282004-11-09 14:59:59 +000025937#endif
25938
Daniel Veillardce682bc2004-11-05 17:22:25 +000025939
Daniel Veillardd93f6252004-11-02 15:53:51 +000025940static int
25941test_xmlXIncludeProcessNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025942 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025943
William M. Brack21e4ef22005-01-02 09:53:13 +000025944#if defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000025945 int mem_base;
25946 int ret_val;
25947 xmlXIncludeCtxtPtr ctxt; /* an existing XInclude context */
25948 int n_ctxt;
25949 xmlNodePtr node; /* a node in an XML document */
25950 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025951
Daniel Veillardce682bc2004-11-05 17:22:25 +000025952 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXIncludeCtxtPtr;n_ctxt++) {
25953 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
25954 mem_base = xmlMemBlocks();
25955 ctxt = gen_xmlXIncludeCtxtPtr(n_ctxt, 0);
25956 node = gen_xmlNodePtr(n_node, 1);
25957
25958 ret_val = xmlXIncludeProcessNode(ctxt, node);
25959 desret_int(ret_val);
25960 call_tests++;
25961 des_xmlXIncludeCtxtPtr(n_ctxt, ctxt, 0);
25962 des_xmlNodePtr(n_node, node, 1);
25963 xmlResetLastError();
25964 if (mem_base != xmlMemBlocks()) {
25965 printf("Leak of %d blocks found in xmlXIncludeProcessNode",
25966 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000025967 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025968 printf(" %d", n_ctxt);
25969 printf(" %d", n_node);
25970 printf("\n");
25971 }
25972 }
25973 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000025974 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000025975#endif
25976
Daniel Veillard42595322004-11-08 10:52:06 +000025977 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025978}
25979
25980
25981static int
25982test_xmlXIncludeProcessTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000025983 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000025984
William M. Brack21e4ef22005-01-02 09:53:13 +000025985#if defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000025986 int mem_base;
25987 int ret_val;
25988 xmlNodePtr tree; /* a node in an XML document */
25989 int n_tree;
25990
25991 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
25992 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000025993 tree = gen_xmlNodePtr(n_tree, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025994
25995 ret_val = xmlXIncludeProcessTree(tree);
25996 desret_int(ret_val);
25997 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000025998 des_xmlNodePtr(n_tree, tree, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000025999 xmlResetLastError();
26000 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026001 printf("Leak of %d blocks found in xmlXIncludeProcessTree",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026002 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026003 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026004 printf(" %d", n_tree);
26005 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026006 }
26007 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026008 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026009#endif
26010
Daniel Veillard42595322004-11-08 10:52:06 +000026011 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026012}
26013
26014
26015static int
26016test_xmlXIncludeProcessTreeFlags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026017 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026018
William M. Brack21e4ef22005-01-02 09:53:13 +000026019#if defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000026020 int mem_base;
26021 int ret_val;
26022 xmlNodePtr tree; /* a node in an XML document */
26023 int n_tree;
26024 int flags; /* a set of xmlParserOption used for parsing XML includes */
26025 int n_flags;
26026
26027 for (n_tree = 0;n_tree < gen_nb_xmlNodePtr;n_tree++) {
26028 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
26029 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026030 tree = gen_xmlNodePtr(n_tree, 0);
26031 flags = gen_int(n_flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026032
26033 ret_val = xmlXIncludeProcessTreeFlags(tree, flags);
26034 desret_int(ret_val);
26035 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026036 des_xmlNodePtr(n_tree, tree, 0);
26037 des_int(n_flags, flags, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026038 xmlResetLastError();
26039 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026040 printf("Leak of %d blocks found in xmlXIncludeProcessTreeFlags",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026041 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026042 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026043 printf(" %d", n_tree);
26044 printf(" %d", n_flags);
26045 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026046 }
26047 }
26048 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026049 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026050#endif
26051
Daniel Veillard42595322004-11-08 10:52:06 +000026052 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026053}
26054
26055
26056static int
26057test_xmlXIncludeSetFlags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026058 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026059
William M. Brack21e4ef22005-01-02 09:53:13 +000026060#if defined(LIBXML_XINCLUDE_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000026061 int mem_base;
26062 int ret_val;
26063 xmlXIncludeCtxtPtr ctxt; /* an XInclude processing context */
26064 int n_ctxt;
26065 int flags; /* a set of xmlParserOption used for parsing XML includes */
26066 int n_flags;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026067
Daniel Veillardce682bc2004-11-05 17:22:25 +000026068 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXIncludeCtxtPtr;n_ctxt++) {
26069 for (n_flags = 0;n_flags < gen_nb_int;n_flags++) {
26070 mem_base = xmlMemBlocks();
26071 ctxt = gen_xmlXIncludeCtxtPtr(n_ctxt, 0);
26072 flags = gen_int(n_flags, 1);
26073
26074 ret_val = xmlXIncludeSetFlags(ctxt, flags);
26075 desret_int(ret_val);
26076 call_tests++;
26077 des_xmlXIncludeCtxtPtr(n_ctxt, ctxt, 0);
26078 des_int(n_flags, flags, 1);
26079 xmlResetLastError();
26080 if (mem_base != xmlMemBlocks()) {
26081 printf("Leak of %d blocks found in xmlXIncludeSetFlags",
26082 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026083 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026084 printf(" %d", n_ctxt);
26085 printf(" %d", n_flags);
26086 printf("\n");
26087 }
26088 }
26089 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026090 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026091#endif
26092
Daniel Veillard42595322004-11-08 10:52:06 +000026093 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026094}
26095
26096static int
26097test_xinclude(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026098 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026099
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026100 if (quiet == 0) printf("Testing xinclude : 6 of 8 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000026101 test_ret += test_xmlXIncludeNewContext();
26102 test_ret += test_xmlXIncludeProcess();
26103 test_ret += test_xmlXIncludeProcessFlags();
26104 test_ret += test_xmlXIncludeProcessNode();
26105 test_ret += test_xmlXIncludeProcessTree();
26106 test_ret += test_xmlXIncludeProcessTreeFlags();
26107 test_ret += test_xmlXIncludeSetFlags();
Daniel Veillardd93f6252004-11-02 15:53:51 +000026108
Daniel Veillard42595322004-11-08 10:52:06 +000026109 if (test_ret != 0)
26110 printf("Module xinclude: %d errors\n", test_ret);
26111 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026112}
26113
26114static int
26115test_xmlAllocOutputBuffer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026116 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026117
William M. Brack21e4ef22005-01-02 09:53:13 +000026118#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000026119 int mem_base;
26120 xmlOutputBufferPtr ret_val;
26121 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
26122 int n_encoder;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026123
Daniel Veillard3d95c732004-11-06 22:25:14 +000026124 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
26125 mem_base = xmlMemBlocks();
26126 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 0);
26127
26128 ret_val = xmlAllocOutputBuffer(encoder);
26129 desret_xmlOutputBufferPtr(ret_val);
26130 call_tests++;
26131 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 0);
26132 xmlResetLastError();
26133 if (mem_base != xmlMemBlocks()) {
26134 printf("Leak of %d blocks found in xmlAllocOutputBuffer",
26135 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026136 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000026137 printf(" %d", n_encoder);
26138 printf("\n");
26139 }
26140 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026141 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000026142#endif
26143
Daniel Veillard42595322004-11-08 10:52:06 +000026144 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026145}
26146
26147
26148static int
26149test_xmlAllocParserInputBuffer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026150 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026151
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026152 int mem_base;
26153 xmlParserInputBufferPtr ret_val;
26154 xmlCharEncoding enc; /* the charset encoding if known */
26155 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026156
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026157 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
26158 mem_base = xmlMemBlocks();
26159 enc = gen_xmlCharEncoding(n_enc, 0);
26160
26161 ret_val = xmlAllocParserInputBuffer(enc);
26162 desret_xmlParserInputBufferPtr(ret_val);
26163 call_tests++;
26164 des_xmlCharEncoding(n_enc, enc, 0);
26165 xmlResetLastError();
26166 if (mem_base != xmlMemBlocks()) {
26167 printf("Leak of %d blocks found in xmlAllocParserInputBuffer",
26168 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026169 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026170 printf(" %d", n_enc);
26171 printf("\n");
26172 }
26173 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000026174 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026175
Daniel Veillard42595322004-11-08 10:52:06 +000026176 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026177}
26178
26179
26180static int
26181test_xmlCheckFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026182 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026183
26184 int mem_base;
26185 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026186 char * path; /* the path to check */
Daniel Veillardd93f6252004-11-02 15:53:51 +000026187 int n_path;
26188
26189 for (n_path = 0;n_path < gen_nb_const_char_ptr;n_path++) {
26190 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026191 path = gen_const_char_ptr(n_path, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026192
William M. Brackf13f77f2004-11-12 16:03:48 +000026193 ret_val = xmlCheckFilename((const char *)path);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026194 desret_int(ret_val);
26195 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000026196 des_const_char_ptr(n_path, (const char *)path, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026197 xmlResetLastError();
26198 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026199 printf("Leak of %d blocks found in xmlCheckFilename",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026200 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026201 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026202 printf(" %d", n_path);
26203 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026204 }
26205 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026206 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026207
Daniel Veillard42595322004-11-08 10:52:06 +000026208 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026209}
26210
26211
26212static int
26213test_xmlCheckHTTPInput(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026214 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026215
Daniel Veillard42595322004-11-08 10:52:06 +000026216 int mem_base;
26217 xmlParserInputPtr ret_val;
26218 xmlParserCtxtPtr ctxt; /* an XML parser context */
26219 int n_ctxt;
26220 xmlParserInputPtr ret; /* an XML parser input */
26221 int n_ret;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026222
Daniel Veillard42595322004-11-08 10:52:06 +000026223 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
26224 for (n_ret = 0;n_ret < gen_nb_xmlParserInputPtr;n_ret++) {
26225 mem_base = xmlMemBlocks();
26226 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
26227 ret = gen_xmlParserInputPtr(n_ret, 1);
26228
26229 ret_val = xmlCheckHTTPInput(ctxt, ret);
26230 desret_xmlParserInputPtr(ret_val);
26231 call_tests++;
26232 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
26233 des_xmlParserInputPtr(n_ret, ret, 1);
26234 xmlResetLastError();
26235 if (mem_base != xmlMemBlocks()) {
26236 printf("Leak of %d blocks found in xmlCheckHTTPInput",
26237 xmlMemBlocks() - mem_base);
26238 test_ret++;
26239 printf(" %d", n_ctxt);
26240 printf(" %d", n_ret);
26241 printf("\n");
26242 }
26243 }
26244 }
Daniel Veillard42595322004-11-08 10:52:06 +000026245 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026246
Daniel Veillard42595322004-11-08 10:52:06 +000026247 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026248}
26249
26250
26251static int
26252test_xmlCleanupInputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026253 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026254
26255 int mem_base;
26256
26257 mem_base = xmlMemBlocks();
26258
26259 xmlCleanupInputCallbacks();
26260 call_tests++;
26261 xmlResetLastError();
26262 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026263 printf("Leak of %d blocks found in xmlCleanupInputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026264 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026265 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026266 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026267 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026268 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026269
Daniel Veillard42595322004-11-08 10:52:06 +000026270 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026271}
26272
26273
26274static int
26275test_xmlCleanupOutputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026276 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026277
William M. Brack21e4ef22005-01-02 09:53:13 +000026278#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000026279 int mem_base;
26280
26281 mem_base = xmlMemBlocks();
26282
26283 xmlCleanupOutputCallbacks();
26284 call_tests++;
26285 xmlResetLastError();
26286 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026287 printf("Leak of %d blocks found in xmlCleanupOutputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026288 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026289 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026290 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026291 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026292 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026293#endif
26294
Daniel Veillard42595322004-11-08 10:52:06 +000026295 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026296}
26297
26298
26299static int
26300test_xmlFileClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026301 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026302
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026303 int mem_base;
26304 int ret_val;
26305 void * context; /* the I/O context */
26306 int n_context;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026307
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026308 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26309 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026310 context = gen_void_ptr(n_context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026311
26312 ret_val = xmlFileClose(context);
26313 desret_int(ret_val);
26314 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026315 des_void_ptr(n_context, context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026316 xmlResetLastError();
26317 if (mem_base != xmlMemBlocks()) {
26318 printf("Leak of %d blocks found in xmlFileClose",
26319 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026320 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026321 printf(" %d", n_context);
26322 printf("\n");
26323 }
26324 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026325 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026326
Daniel Veillard42595322004-11-08 10:52:06 +000026327 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026328}
26329
26330
26331static int
26332test_xmlFileMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026333 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026334
26335 int mem_base;
26336 int ret_val;
26337 const char * filename; /* the URI for matching */
26338 int n_filename;
26339
26340 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26341 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026342 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026343
26344 ret_val = xmlFileMatch(filename);
26345 desret_int(ret_val);
26346 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026347 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026348 xmlResetLastError();
26349 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026350 printf("Leak of %d blocks found in xmlFileMatch",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026351 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026352 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026353 printf(" %d", n_filename);
26354 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026355 }
26356 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026357 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026358
Daniel Veillard42595322004-11-08 10:52:06 +000026359 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026360}
26361
26362
26363static int
26364test_xmlFileOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026365 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026366
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026367 int mem_base;
26368 void * ret_val;
26369 const char * filename; /* the URI for matching */
26370 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026371
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026372 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26373 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026374 filename = gen_filepath(n_filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026375
26376 ret_val = xmlFileOpen(filename);
26377 desret_void_ptr(ret_val);
26378 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026379 des_filepath(n_filename, filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026380 xmlResetLastError();
26381 if (mem_base != xmlMemBlocks()) {
26382 printf("Leak of %d blocks found in xmlFileOpen",
26383 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026384 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026385 printf(" %d", n_filename);
26386 printf("\n");
26387 }
26388 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026389 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026390
Daniel Veillard42595322004-11-08 10:52:06 +000026391 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026392}
26393
26394
26395static int
26396test_xmlFileRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026397 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026398
Daniel Veillardce682bc2004-11-05 17:22:25 +000026399 int mem_base;
26400 int ret_val;
26401 void * context; /* the I/O context */
26402 int n_context;
26403 char * buffer; /* where to drop data */
26404 int n_buffer;
26405 int len; /* number of bytes to write */
26406 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026407
Daniel Veillardce682bc2004-11-05 17:22:25 +000026408 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26409 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
26410 for (n_len = 0;n_len < gen_nb_int;n_len++) {
26411 mem_base = xmlMemBlocks();
26412 context = gen_void_ptr(n_context, 0);
26413 buffer = gen_char_ptr(n_buffer, 1);
26414 len = gen_int(n_len, 2);
26415
26416 ret_val = xmlFileRead(context, buffer, len);
26417 desret_int(ret_val);
26418 call_tests++;
26419 des_void_ptr(n_context, context, 0);
26420 des_char_ptr(n_buffer, buffer, 1);
26421 des_int(n_len, len, 2);
26422 xmlResetLastError();
26423 if (mem_base != xmlMemBlocks()) {
26424 printf("Leak of %d blocks found in xmlFileRead",
26425 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026426 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026427 printf(" %d", n_context);
26428 printf(" %d", n_buffer);
26429 printf(" %d", n_len);
26430 printf("\n");
26431 }
26432 }
26433 }
26434 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000026435 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026436
Daniel Veillard42595322004-11-08 10:52:06 +000026437 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026438}
26439
26440
26441static int
26442test_xmlIOFTPClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026443 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026444
William M. Brack21e4ef22005-01-02 09:53:13 +000026445#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026446 int mem_base;
26447 int ret_val;
26448 void * context; /* the I/O context */
26449 int n_context;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026450
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026451 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26452 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026453 context = gen_void_ptr(n_context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026454
26455 ret_val = xmlIOFTPClose(context);
26456 desret_int(ret_val);
26457 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026458 des_void_ptr(n_context, context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026459 xmlResetLastError();
26460 if (mem_base != xmlMemBlocks()) {
26461 printf("Leak of %d blocks found in xmlIOFTPClose",
26462 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026463 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026464 printf(" %d", n_context);
26465 printf("\n");
26466 }
26467 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026468 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026469#endif
26470
Daniel Veillard42595322004-11-08 10:52:06 +000026471 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026472}
26473
26474
26475static int
26476test_xmlIOFTPMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026477 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026478
William M. Brack21e4ef22005-01-02 09:53:13 +000026479#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000026480 int mem_base;
26481 int ret_val;
26482 const char * filename; /* the URI for matching */
26483 int n_filename;
26484
26485 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26486 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026487 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026488
26489 ret_val = xmlIOFTPMatch(filename);
26490 desret_int(ret_val);
26491 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026492 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026493 xmlResetLastError();
26494 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026495 printf("Leak of %d blocks found in xmlIOFTPMatch",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026496 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026497 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026498 printf(" %d", n_filename);
26499 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026500 }
26501 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026502 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026503#endif
26504
Daniel Veillard42595322004-11-08 10:52:06 +000026505 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026506}
26507
26508
26509static int
26510test_xmlIOFTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026511 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026512
William M. Brack21e4ef22005-01-02 09:53:13 +000026513#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026514 int mem_base;
26515 void * ret_val;
26516 const char * filename; /* the URI for matching */
26517 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026518
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026519 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26520 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026521 filename = gen_filepath(n_filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026522
26523 ret_val = xmlIOFTPOpen(filename);
26524 desret_void_ptr(ret_val);
26525 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026526 des_filepath(n_filename, filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026527 xmlResetLastError();
26528 if (mem_base != xmlMemBlocks()) {
26529 printf("Leak of %d blocks found in xmlIOFTPOpen",
26530 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026531 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026532 printf(" %d", n_filename);
26533 printf("\n");
26534 }
26535 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026536 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026537#endif
26538
Daniel Veillard42595322004-11-08 10:52:06 +000026539 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026540}
26541
26542
26543static int
26544test_xmlIOFTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026545 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026546
William M. Brack21e4ef22005-01-02 09:53:13 +000026547#if defined(LIBXML_FTP_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000026548 int mem_base;
26549 int ret_val;
26550 void * context; /* the I/O context */
26551 int n_context;
26552 char * buffer; /* where to drop data */
26553 int n_buffer;
26554 int len; /* number of bytes to write */
26555 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026556
Daniel Veillardce682bc2004-11-05 17:22:25 +000026557 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26558 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
26559 for (n_len = 0;n_len < gen_nb_int;n_len++) {
26560 mem_base = xmlMemBlocks();
26561 context = gen_void_ptr(n_context, 0);
26562 buffer = gen_char_ptr(n_buffer, 1);
26563 len = gen_int(n_len, 2);
26564
26565 ret_val = xmlIOFTPRead(context, buffer, len);
26566 desret_int(ret_val);
26567 call_tests++;
26568 des_void_ptr(n_context, context, 0);
26569 des_char_ptr(n_buffer, buffer, 1);
26570 des_int(n_len, len, 2);
26571 xmlResetLastError();
26572 if (mem_base != xmlMemBlocks()) {
26573 printf("Leak of %d blocks found in xmlIOFTPRead",
26574 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026575 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026576 printf(" %d", n_context);
26577 printf(" %d", n_buffer);
26578 printf(" %d", n_len);
26579 printf("\n");
26580 }
26581 }
26582 }
26583 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026584 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026585#endif
26586
Daniel Veillard42595322004-11-08 10:52:06 +000026587 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026588}
26589
26590
26591static int
26592test_xmlIOHTTPClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026593 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026594
William M. Brack21e4ef22005-01-02 09:53:13 +000026595#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026596 int mem_base;
26597 int ret_val;
26598 void * context; /* the I/O context */
26599 int n_context;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026600
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026601 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26602 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026603 context = gen_void_ptr(n_context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026604
26605 ret_val = xmlIOHTTPClose(context);
26606 desret_int(ret_val);
26607 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026608 des_void_ptr(n_context, context, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026609 xmlResetLastError();
26610 if (mem_base != xmlMemBlocks()) {
26611 printf("Leak of %d blocks found in xmlIOHTTPClose",
26612 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026613 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026614 printf(" %d", n_context);
26615 printf("\n");
26616 }
26617 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026618 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026619#endif
26620
Daniel Veillard42595322004-11-08 10:52:06 +000026621 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026622}
26623
26624
26625static int
26626test_xmlIOHTTPMatch(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026627 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026628
William M. Brack21e4ef22005-01-02 09:53:13 +000026629#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000026630 int mem_base;
26631 int ret_val;
26632 const char * filename; /* the URI for matching */
26633 int n_filename;
26634
26635 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26636 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026637 filename = gen_filepath(n_filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026638
26639 ret_val = xmlIOHTTPMatch(filename);
26640 desret_int(ret_val);
26641 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026642 des_filepath(n_filename, filename, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026643 xmlResetLastError();
26644 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000026645 printf("Leak of %d blocks found in xmlIOHTTPMatch",
Daniel Veillardd93f6252004-11-02 15:53:51 +000026646 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026647 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000026648 printf(" %d", n_filename);
26649 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000026650 }
26651 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026652 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026653#endif
26654
Daniel Veillard42595322004-11-08 10:52:06 +000026655 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026656}
26657
26658
26659static int
26660test_xmlIOHTTPOpen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026661 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026662
William M. Brack21e4ef22005-01-02 09:53:13 +000026663#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026664 int mem_base;
26665 void * ret_val;
26666 const char * filename; /* the URI for matching */
26667 int n_filename;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026668
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026669 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
26670 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026671 filename = gen_filepath(n_filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026672
26673 ret_val = xmlIOHTTPOpen(filename);
26674 desret_void_ptr(ret_val);
26675 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026676 des_filepath(n_filename, filename, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026677 xmlResetLastError();
26678 if (mem_base != xmlMemBlocks()) {
26679 printf("Leak of %d blocks found in xmlIOHTTPOpen",
26680 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026681 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026682 printf(" %d", n_filename);
26683 printf("\n");
26684 }
26685 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026686 function_tests++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000026687#endif
26688
Daniel Veillard42595322004-11-08 10:52:06 +000026689 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026690}
26691
26692
26693static int
26694test_xmlIOHTTPOpenW(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026695 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026696
26697
26698 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000026699 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026700}
26701
26702
26703static int
26704test_xmlIOHTTPRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026705 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026706
William M. Brack21e4ef22005-01-02 09:53:13 +000026707#if defined(LIBXML_HTTP_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000026708 int mem_base;
26709 int ret_val;
26710 void * context; /* the I/O context */
26711 int n_context;
26712 char * buffer; /* where to drop data */
26713 int n_buffer;
26714 int len; /* number of bytes to write */
26715 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026716
Daniel Veillardce682bc2004-11-05 17:22:25 +000026717 for (n_context = 0;n_context < gen_nb_void_ptr;n_context++) {
26718 for (n_buffer = 0;n_buffer < gen_nb_char_ptr;n_buffer++) {
26719 for (n_len = 0;n_len < gen_nb_int;n_len++) {
26720 mem_base = xmlMemBlocks();
26721 context = gen_void_ptr(n_context, 0);
26722 buffer = gen_char_ptr(n_buffer, 1);
26723 len = gen_int(n_len, 2);
26724
26725 ret_val = xmlIOHTTPRead(context, buffer, len);
26726 desret_int(ret_val);
26727 call_tests++;
26728 des_void_ptr(n_context, context, 0);
26729 des_char_ptr(n_buffer, buffer, 1);
26730 des_int(n_len, len, 2);
26731 xmlResetLastError();
26732 if (mem_base != xmlMemBlocks()) {
26733 printf("Leak of %d blocks found in xmlIOHTTPRead",
26734 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026735 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026736 printf(" %d", n_context);
26737 printf(" %d", n_buffer);
26738 printf(" %d", n_len);
26739 printf("\n");
26740 }
26741 }
26742 }
26743 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026744 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026745#endif
26746
Daniel Veillard42595322004-11-08 10:52:06 +000026747 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026748}
26749
26750
26751static int
26752test_xmlNoNetExternalEntityLoader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026753 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026754
Daniel Veillard42595322004-11-08 10:52:06 +000026755 int mem_base;
26756 xmlParserInputPtr ret_val;
26757 const char * URL; /* the URL for the entity to load */
26758 int n_URL;
26759 char * ID; /* the System ID for the entity to load */
26760 int n_ID;
26761 xmlParserCtxtPtr ctxt; /* the context in which the entity is called or NULL */
26762 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026763
Daniel Veillard42595322004-11-08 10:52:06 +000026764 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
26765 for (n_ID = 0;n_ID < gen_nb_const_char_ptr;n_ID++) {
26766 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
26767 mem_base = xmlMemBlocks();
26768 URL = gen_filepath(n_URL, 0);
26769 ID = gen_const_char_ptr(n_ID, 1);
26770 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 2);
26771
William M. Brackf13f77f2004-11-12 16:03:48 +000026772 ret_val = xmlNoNetExternalEntityLoader(URL, (const char *)ID, ctxt);
Daniel Veillard42595322004-11-08 10:52:06 +000026773 desret_xmlParserInputPtr(ret_val);
26774 call_tests++;
26775 des_filepath(n_URL, URL, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000026776 des_const_char_ptr(n_ID, (const char *)ID, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000026777 des_xmlParserCtxtPtr(n_ctxt, ctxt, 2);
26778 xmlResetLastError();
26779 if (mem_base != xmlMemBlocks()) {
26780 printf("Leak of %d blocks found in xmlNoNetExternalEntityLoader",
26781 xmlMemBlocks() - mem_base);
26782 test_ret++;
26783 printf(" %d", n_URL);
26784 printf(" %d", n_ID);
26785 printf(" %d", n_ctxt);
26786 printf("\n");
26787 }
26788 }
26789 }
26790 }
Daniel Veillard42595322004-11-08 10:52:06 +000026791 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026792
Daniel Veillard42595322004-11-08 10:52:06 +000026793 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026794}
26795
26796
26797static int
26798test_xmlNormalizeWindowsPath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026799 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026800
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026801 int mem_base;
26802 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000026803 xmlChar * path; /* the input file path */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026804 int n_path;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026805
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026806 for (n_path = 0;n_path < gen_nb_const_xmlChar_ptr;n_path++) {
26807 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000026808 path = gen_const_xmlChar_ptr(n_path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026809
William M. Brackf13f77f2004-11-12 16:03:48 +000026810 ret_val = xmlNormalizeWindowsPath((const xmlChar *)path);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026811 desret_xmlChar_ptr(ret_val);
26812 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000026813 des_const_xmlChar_ptr(n_path, (const xmlChar *)path, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026814 xmlResetLastError();
26815 if (mem_base != xmlMemBlocks()) {
26816 printf("Leak of %d blocks found in xmlNormalizeWindowsPath",
26817 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026818 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000026819 printf(" %d", n_path);
26820 printf("\n");
26821 }
26822 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000026823 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026824
Daniel Veillard42595322004-11-08 10:52:06 +000026825 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026826}
26827
26828
26829static int
26830test_xmlOutputBufferCreateFd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026831 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026832
William M. Brack21e4ef22005-01-02 09:53:13 +000026833#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000026834 int mem_base;
26835 xmlOutputBufferPtr ret_val;
26836 int fd; /* a file descriptor number */
26837 int n_fd;
26838 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
26839 int n_encoder;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026840
Daniel Veillard3d95c732004-11-06 22:25:14 +000026841 for (n_fd = 0;n_fd < gen_nb_int;n_fd++) {
26842 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
26843 mem_base = xmlMemBlocks();
26844 fd = gen_int(n_fd, 0);
26845 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 1);
26846
26847 ret_val = xmlOutputBufferCreateFd(fd, encoder);
26848 desret_xmlOutputBufferPtr(ret_val);
26849 call_tests++;
26850 des_int(n_fd, fd, 0);
26851 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 1);
26852 xmlResetLastError();
26853 if (mem_base != xmlMemBlocks()) {
26854 printf("Leak of %d blocks found in xmlOutputBufferCreateFd",
26855 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026856 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000026857 printf(" %d", n_fd);
26858 printf(" %d", n_encoder);
26859 printf("\n");
26860 }
26861 }
26862 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026863 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000026864#endif
26865
Daniel Veillard42595322004-11-08 10:52:06 +000026866 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026867}
26868
26869
26870static int
26871test_xmlOutputBufferCreateFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026872 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026873
William M. Brack21e4ef22005-01-02 09:53:13 +000026874#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000026875 int mem_base;
26876 xmlOutputBufferPtr ret_val;
26877 FILE * file; /* a FILE* */
26878 int n_file;
26879 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
26880 int n_encoder;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026881
Daniel Veillard3d95c732004-11-06 22:25:14 +000026882 for (n_file = 0;n_file < gen_nb_FILE_ptr;n_file++) {
26883 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
26884 mem_base = xmlMemBlocks();
26885 file = gen_FILE_ptr(n_file, 0);
26886 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 1);
26887
26888 ret_val = xmlOutputBufferCreateFile(file, encoder);
26889 desret_xmlOutputBufferPtr(ret_val);
26890 call_tests++;
26891 des_FILE_ptr(n_file, file, 0);
26892 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 1);
26893 xmlResetLastError();
26894 if (mem_base != xmlMemBlocks()) {
26895 printf("Leak of %d blocks found in xmlOutputBufferCreateFile",
26896 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026897 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000026898 printf(" %d", n_file);
26899 printf(" %d", n_encoder);
26900 printf("\n");
26901 }
26902 }
26903 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026904 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000026905#endif
26906
Daniel Veillard42595322004-11-08 10:52:06 +000026907 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026908}
26909
26910
26911static int
26912test_xmlOutputBufferCreateFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026913 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026914
William M. Brack21e4ef22005-01-02 09:53:13 +000026915#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000026916 int mem_base;
26917 xmlOutputBufferPtr ret_val;
26918 const char * URI; /* a C string containing the URI or filename */
26919 int n_URI;
26920 xmlCharEncodingHandlerPtr encoder; /* the encoding converter or NULL */
26921 int n_encoder;
26922 int compression; /* the compression ration (0 none, 9 max). */
26923 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026924
Daniel Veillard42595322004-11-08 10:52:06 +000026925 for (n_URI = 0;n_URI < gen_nb_fileoutput;n_URI++) {
Daniel Veillard3d95c732004-11-06 22:25:14 +000026926 for (n_encoder = 0;n_encoder < gen_nb_xmlCharEncodingHandlerPtr;n_encoder++) {
26927 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
26928 mem_base = xmlMemBlocks();
Daniel Veillard42595322004-11-08 10:52:06 +000026929 URI = gen_fileoutput(n_URI, 0);
Daniel Veillard3d95c732004-11-06 22:25:14 +000026930 encoder = gen_xmlCharEncodingHandlerPtr(n_encoder, 1);
26931 compression = gen_int(n_compression, 2);
26932
26933 ret_val = xmlOutputBufferCreateFilename(URI, encoder, compression);
26934 desret_xmlOutputBufferPtr(ret_val);
26935 call_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000026936 des_fileoutput(n_URI, URI, 0);
Daniel Veillard3d95c732004-11-06 22:25:14 +000026937 des_xmlCharEncodingHandlerPtr(n_encoder, encoder, 1);
26938 des_int(n_compression, compression, 2);
26939 xmlResetLastError();
26940 if (mem_base != xmlMemBlocks()) {
26941 printf("Leak of %d blocks found in xmlOutputBufferCreateFilename",
26942 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026943 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000026944 printf(" %d", n_URI);
26945 printf(" %d", n_encoder);
26946 printf(" %d", n_compression);
26947 printf("\n");
26948 }
26949 }
26950 }
26951 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026952 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000026953#endif
26954
Daniel Veillard42595322004-11-08 10:52:06 +000026955 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026956}
26957
26958
26959static int
26960test_xmlOutputBufferFlush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026961 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026962
William M. Brack21e4ef22005-01-02 09:53:13 +000026963#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000026964 int mem_base;
26965 int ret_val;
26966 xmlOutputBufferPtr out; /* a buffered output */
26967 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026968
Daniel Veillard3d97e662004-11-04 10:49:00 +000026969 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
26970 mem_base = xmlMemBlocks();
26971 out = gen_xmlOutputBufferPtr(n_out, 0);
26972
26973 ret_val = xmlOutputBufferFlush(out);
26974 desret_int(ret_val);
26975 call_tests++;
26976 des_xmlOutputBufferPtr(n_out, out, 0);
26977 xmlResetLastError();
26978 if (mem_base != xmlMemBlocks()) {
26979 printf("Leak of %d blocks found in xmlOutputBufferFlush",
26980 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000026981 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026982 printf(" %d", n_out);
26983 printf("\n");
26984 }
26985 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000026986 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000026987#endif
26988
Daniel Veillard42595322004-11-08 10:52:06 +000026989 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000026990}
26991
26992
26993static int
26994test_xmlOutputBufferWrite(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000026995 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000026996
William M. Brack21e4ef22005-01-02 09:53:13 +000026997#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000026998 int mem_base;
26999 int ret_val;
27000 xmlOutputBufferPtr out; /* a buffered parser output */
27001 int n_out;
27002 int len; /* the size in bytes of the array. */
27003 int n_len;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027004 char * buf; /* an char array */
Daniel Veillard3d97e662004-11-04 10:49:00 +000027005 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027006
Daniel Veillard3d97e662004-11-04 10:49:00 +000027007 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
27008 for (n_len = 0;n_len < gen_nb_int;n_len++) {
27009 for (n_buf = 0;n_buf < gen_nb_const_char_ptr;n_buf++) {
27010 mem_base = xmlMemBlocks();
27011 out = gen_xmlOutputBufferPtr(n_out, 0);
27012 len = gen_int(n_len, 1);
27013 buf = gen_const_char_ptr(n_buf, 2);
27014
William M. Brackf13f77f2004-11-12 16:03:48 +000027015 ret_val = xmlOutputBufferWrite(out, len, (const char *)buf);
Daniel Veillard3d97e662004-11-04 10:49:00 +000027016 desret_int(ret_val);
27017 call_tests++;
27018 des_xmlOutputBufferPtr(n_out, out, 0);
27019 des_int(n_len, len, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000027020 des_const_char_ptr(n_buf, (const char *)buf, 2);
Daniel Veillard3d97e662004-11-04 10:49:00 +000027021 xmlResetLastError();
27022 if (mem_base != xmlMemBlocks()) {
27023 printf("Leak of %d blocks found in xmlOutputBufferWrite",
27024 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027025 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027026 printf(" %d", n_out);
27027 printf(" %d", n_len);
27028 printf(" %d", n_buf);
27029 printf("\n");
27030 }
27031 }
27032 }
27033 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027034 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027035#endif
27036
Daniel Veillard42595322004-11-08 10:52:06 +000027037 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027038}
27039
27040
27041static int
27042test_xmlOutputBufferWriteEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027043 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027044
27045
27046 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000027047 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027048}
27049
27050
27051static int
27052test_xmlOutputBufferWriteString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027053 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027054
William M. Brack21e4ef22005-01-02 09:53:13 +000027055#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000027056 int mem_base;
27057 int ret_val;
27058 xmlOutputBufferPtr out; /* a buffered parser output */
27059 int n_out;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027060 char * str; /* a zero terminated C string */
Daniel Veillard3d97e662004-11-04 10:49:00 +000027061 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027062
Daniel Veillard3d97e662004-11-04 10:49:00 +000027063 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
27064 for (n_str = 0;n_str < gen_nb_const_char_ptr;n_str++) {
27065 mem_base = xmlMemBlocks();
27066 out = gen_xmlOutputBufferPtr(n_out, 0);
27067 str = gen_const_char_ptr(n_str, 1);
27068
William M. Brackf13f77f2004-11-12 16:03:48 +000027069 ret_val = xmlOutputBufferWriteString(out, (const char *)str);
Daniel Veillard3d97e662004-11-04 10:49:00 +000027070 desret_int(ret_val);
27071 call_tests++;
27072 des_xmlOutputBufferPtr(n_out, out, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000027073 des_const_char_ptr(n_str, (const char *)str, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000027074 xmlResetLastError();
27075 if (mem_base != xmlMemBlocks()) {
27076 printf("Leak of %d blocks found in xmlOutputBufferWriteString",
27077 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027078 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027079 printf(" %d", n_out);
27080 printf(" %d", n_str);
27081 printf("\n");
27082 }
27083 }
27084 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027085 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000027086#endif
27087
Daniel Veillard42595322004-11-08 10:52:06 +000027088 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027089}
27090
27091
27092static int
27093test_xmlParserGetDirectory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027094 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027095
27096
27097 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000027098 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027099}
27100
27101
27102static int
27103test_xmlParserInputBufferCreateFd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027104 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027105
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027106 int mem_base;
27107 xmlParserInputBufferPtr ret_val;
27108 int fd; /* a file descriptor number */
27109 int n_fd;
27110 xmlCharEncoding enc; /* the charset encoding if known */
27111 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027112
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027113 for (n_fd = 0;n_fd < gen_nb_int;n_fd++) {
27114 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27115 mem_base = xmlMemBlocks();
27116 fd = gen_int(n_fd, 0);
27117 enc = gen_xmlCharEncoding(n_enc, 1);
27118 if (fd >= 0) fd = -1;
27119
27120 ret_val = xmlParserInputBufferCreateFd(fd, enc);
27121 desret_xmlParserInputBufferPtr(ret_val);
27122 call_tests++;
27123 des_int(n_fd, fd, 0);
27124 des_xmlCharEncoding(n_enc, enc, 1);
27125 xmlResetLastError();
27126 if (mem_base != xmlMemBlocks()) {
27127 printf("Leak of %d blocks found in xmlParserInputBufferCreateFd",
27128 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027129 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027130 printf(" %d", n_fd);
27131 printf(" %d", n_enc);
27132 printf("\n");
27133 }
27134 }
27135 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027136 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027137
Daniel Veillard42595322004-11-08 10:52:06 +000027138 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027139}
27140
27141
27142static int
27143test_xmlParserInputBufferCreateFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027144 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027145
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027146 int mem_base;
27147 xmlParserInputBufferPtr ret_val;
27148 FILE * file; /* a FILE* */
27149 int n_file;
27150 xmlCharEncoding enc; /* the charset encoding if known */
27151 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027152
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027153 for (n_file = 0;n_file < gen_nb_FILE_ptr;n_file++) {
27154 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27155 mem_base = xmlMemBlocks();
27156 file = gen_FILE_ptr(n_file, 0);
27157 enc = gen_xmlCharEncoding(n_enc, 1);
27158
27159 ret_val = xmlParserInputBufferCreateFile(file, enc);
27160 desret_xmlParserInputBufferPtr(ret_val);
27161 call_tests++;
27162 des_FILE_ptr(n_file, file, 0);
27163 des_xmlCharEncoding(n_enc, enc, 1);
27164 xmlResetLastError();
27165 if (mem_base != xmlMemBlocks()) {
27166 printf("Leak of %d blocks found in xmlParserInputBufferCreateFile",
27167 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027168 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027169 printf(" %d", n_file);
27170 printf(" %d", n_enc);
27171 printf("\n");
27172 }
27173 }
27174 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027175 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027176
Daniel Veillard42595322004-11-08 10:52:06 +000027177 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027178}
27179
27180
27181static int
27182test_xmlParserInputBufferCreateFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027183 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027184
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027185 int mem_base;
27186 xmlParserInputBufferPtr ret_val;
27187 const char * URI; /* a C string containing the URI or filename */
27188 int n_URI;
27189 xmlCharEncoding enc; /* the charset encoding if known */
27190 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027191
Daniel Veillard42595322004-11-08 10:52:06 +000027192 for (n_URI = 0;n_URI < gen_nb_fileoutput;n_URI++) {
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027193 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27194 mem_base = xmlMemBlocks();
Daniel Veillard42595322004-11-08 10:52:06 +000027195 URI = gen_fileoutput(n_URI, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027196 enc = gen_xmlCharEncoding(n_enc, 1);
27197
27198 ret_val = xmlParserInputBufferCreateFilename(URI, enc);
27199 desret_xmlParserInputBufferPtr(ret_val);
27200 call_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000027201 des_fileoutput(n_URI, URI, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027202 des_xmlCharEncoding(n_enc, enc, 1);
27203 xmlResetLastError();
27204 if (mem_base != xmlMemBlocks()) {
27205 printf("Leak of %d blocks found in xmlParserInputBufferCreateFilename",
27206 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027207 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027208 printf(" %d", n_URI);
27209 printf(" %d", n_enc);
27210 printf("\n");
27211 }
27212 }
27213 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027214 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027215
Daniel Veillard42595322004-11-08 10:52:06 +000027216 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027217}
27218
27219
27220static int
27221test_xmlParserInputBufferCreateMem(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027222 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027223
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027224 int mem_base;
27225 xmlParserInputBufferPtr ret_val;
27226 char * mem; /* the memory input */
27227 int n_mem;
27228 int size; /* the length of the memory block */
27229 int n_size;
27230 xmlCharEncoding enc; /* the charset encoding if known */
27231 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027232
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027233 for (n_mem = 0;n_mem < gen_nb_const_char_ptr;n_mem++) {
27234 for (n_size = 0;n_size < gen_nb_int;n_size++) {
27235 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27236 mem_base = xmlMemBlocks();
27237 mem = gen_const_char_ptr(n_mem, 0);
27238 size = gen_int(n_size, 1);
27239 enc = gen_xmlCharEncoding(n_enc, 2);
27240
William M. Brackf13f77f2004-11-12 16:03:48 +000027241 ret_val = xmlParserInputBufferCreateMem((const char *)mem, size, enc);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027242 desret_xmlParserInputBufferPtr(ret_val);
27243 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000027244 des_const_char_ptr(n_mem, (const char *)mem, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027245 des_int(n_size, size, 1);
27246 des_xmlCharEncoding(n_enc, enc, 2);
27247 xmlResetLastError();
27248 if (mem_base != xmlMemBlocks()) {
27249 printf("Leak of %d blocks found in xmlParserInputBufferCreateMem",
27250 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027251 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027252 printf(" %d", n_mem);
27253 printf(" %d", n_size);
27254 printf(" %d", n_enc);
27255 printf("\n");
27256 }
27257 }
27258 }
27259 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027260 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027261
Daniel Veillard42595322004-11-08 10:52:06 +000027262 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027263}
27264
27265
27266static int
27267test_xmlParserInputBufferCreateStatic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027268 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027269
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027270 int mem_base;
27271 xmlParserInputBufferPtr ret_val;
27272 char * mem; /* the memory input */
27273 int n_mem;
27274 int size; /* the length of the memory block */
27275 int n_size;
27276 xmlCharEncoding enc; /* the charset encoding if known */
27277 int n_enc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027278
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027279 for (n_mem = 0;n_mem < gen_nb_const_char_ptr;n_mem++) {
27280 for (n_size = 0;n_size < gen_nb_int;n_size++) {
27281 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
27282 mem_base = xmlMemBlocks();
27283 mem = gen_const_char_ptr(n_mem, 0);
27284 size = gen_int(n_size, 1);
27285 enc = gen_xmlCharEncoding(n_enc, 2);
27286
William M. Brackf13f77f2004-11-12 16:03:48 +000027287 ret_val = xmlParserInputBufferCreateStatic((const char *)mem, size, enc);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027288 desret_xmlParserInputBufferPtr(ret_val);
27289 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000027290 des_const_char_ptr(n_mem, (const char *)mem, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027291 des_int(n_size, size, 1);
27292 des_xmlCharEncoding(n_enc, enc, 2);
27293 xmlResetLastError();
27294 if (mem_base != xmlMemBlocks()) {
27295 printf("Leak of %d blocks found in xmlParserInputBufferCreateStatic",
27296 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027297 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027298 printf(" %d", n_mem);
27299 printf(" %d", n_size);
27300 printf(" %d", n_enc);
27301 printf("\n");
27302 }
27303 }
27304 }
27305 }
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000027306 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027307
Daniel Veillard42595322004-11-08 10:52:06 +000027308 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027309}
27310
27311
27312static int
27313test_xmlParserInputBufferGrow(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027314 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027315
Daniel Veillard34099b42004-11-04 17:34:35 +000027316 int mem_base;
27317 int ret_val;
27318 xmlParserInputBufferPtr in; /* a buffered parser input */
27319 int n_in;
27320 int len; /* indicative value of the amount of chars to read */
27321 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027322
Daniel Veillard34099b42004-11-04 17:34:35 +000027323 for (n_in = 0;n_in < gen_nb_xmlParserInputBufferPtr;n_in++) {
27324 for (n_len = 0;n_len < gen_nb_int;n_len++) {
27325 mem_base = xmlMemBlocks();
27326 in = gen_xmlParserInputBufferPtr(n_in, 0);
27327 len = gen_int(n_len, 1);
27328
27329 ret_val = xmlParserInputBufferGrow(in, len);
27330 desret_int(ret_val);
27331 call_tests++;
27332 des_xmlParserInputBufferPtr(n_in, in, 0);
27333 des_int(n_len, len, 1);
27334 xmlResetLastError();
27335 if (mem_base != xmlMemBlocks()) {
27336 printf("Leak of %d blocks found in xmlParserInputBufferGrow",
27337 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027338 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000027339 printf(" %d", n_in);
27340 printf(" %d", n_len);
27341 printf("\n");
27342 }
27343 }
27344 }
Daniel Veillard34099b42004-11-04 17:34:35 +000027345 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027346
Daniel Veillard42595322004-11-08 10:52:06 +000027347 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027348}
27349
27350
27351static int
27352test_xmlParserInputBufferPush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027353 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027354
Daniel Veillard34099b42004-11-04 17:34:35 +000027355 int mem_base;
27356 int ret_val;
27357 xmlParserInputBufferPtr in; /* a buffered parser input */
27358 int n_in;
27359 int len; /* the size in bytes of the array. */
27360 int n_len;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027361 char * buf; /* an char array */
Daniel Veillard34099b42004-11-04 17:34:35 +000027362 int n_buf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027363
Daniel Veillard34099b42004-11-04 17:34:35 +000027364 for (n_in = 0;n_in < gen_nb_xmlParserInputBufferPtr;n_in++) {
27365 for (n_len = 0;n_len < gen_nb_int;n_len++) {
27366 for (n_buf = 0;n_buf < gen_nb_const_char_ptr;n_buf++) {
27367 mem_base = xmlMemBlocks();
27368 in = gen_xmlParserInputBufferPtr(n_in, 0);
27369 len = gen_int(n_len, 1);
27370 buf = gen_const_char_ptr(n_buf, 2);
27371
William M. Brackf13f77f2004-11-12 16:03:48 +000027372 ret_val = xmlParserInputBufferPush(in, len, (const char *)buf);
Daniel Veillard34099b42004-11-04 17:34:35 +000027373 desret_int(ret_val);
27374 call_tests++;
27375 des_xmlParserInputBufferPtr(n_in, in, 0);
27376 des_int(n_len, len, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000027377 des_const_char_ptr(n_buf, (const char *)buf, 2);
Daniel Veillard34099b42004-11-04 17:34:35 +000027378 xmlResetLastError();
27379 if (mem_base != xmlMemBlocks()) {
27380 printf("Leak of %d blocks found in xmlParserInputBufferPush",
27381 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027382 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000027383 printf(" %d", n_in);
27384 printf(" %d", n_len);
27385 printf(" %d", n_buf);
27386 printf("\n");
27387 }
27388 }
27389 }
27390 }
Daniel Veillard34099b42004-11-04 17:34:35 +000027391 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027392
Daniel Veillard42595322004-11-08 10:52:06 +000027393 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027394}
27395
27396
27397static int
27398test_xmlParserInputBufferRead(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027399 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027400
Daniel Veillard34099b42004-11-04 17:34:35 +000027401 int mem_base;
27402 int ret_val;
27403 xmlParserInputBufferPtr in; /* a buffered parser input */
27404 int n_in;
27405 int len; /* indicative value of the amount of chars to read */
27406 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027407
Daniel Veillard34099b42004-11-04 17:34:35 +000027408 for (n_in = 0;n_in < gen_nb_xmlParserInputBufferPtr;n_in++) {
27409 for (n_len = 0;n_len < gen_nb_int;n_len++) {
27410 mem_base = xmlMemBlocks();
27411 in = gen_xmlParserInputBufferPtr(n_in, 0);
27412 len = gen_int(n_len, 1);
27413
27414 ret_val = xmlParserInputBufferRead(in, len);
27415 desret_int(ret_val);
27416 call_tests++;
27417 des_xmlParserInputBufferPtr(n_in, in, 0);
27418 des_int(n_len, len, 1);
27419 xmlResetLastError();
27420 if (mem_base != xmlMemBlocks()) {
27421 printf("Leak of %d blocks found in xmlParserInputBufferRead",
27422 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027423 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000027424 printf(" %d", n_in);
27425 printf(" %d", n_len);
27426 printf("\n");
27427 }
27428 }
27429 }
Daniel Veillard34099b42004-11-04 17:34:35 +000027430 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027431
Daniel Veillard42595322004-11-08 10:52:06 +000027432 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027433}
27434
27435
27436static int
27437test_xmlPopInputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027438 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027439
27440 int mem_base;
27441 int ret_val;
27442
27443 mem_base = xmlMemBlocks();
27444
27445 ret_val = xmlPopInputCallbacks();
27446 desret_int(ret_val);
27447 call_tests++;
27448 xmlResetLastError();
27449 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027450 printf("Leak of %d blocks found in xmlPopInputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027451 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027452 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027453 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027454 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000027455 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027456
Daniel Veillard42595322004-11-08 10:52:06 +000027457 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027458}
27459
27460
27461static int
27462test_xmlRegisterDefaultInputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027463 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027464
27465 int mem_base;
27466
27467 mem_base = xmlMemBlocks();
27468
27469 xmlRegisterDefaultInputCallbacks();
27470 call_tests++;
27471 xmlResetLastError();
27472 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027473 printf("Leak of %d blocks found in xmlRegisterDefaultInputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027474 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027475 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027476 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027477 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000027478 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027479
Daniel Veillard42595322004-11-08 10:52:06 +000027480 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027481}
27482
27483
27484static int
27485test_xmlRegisterDefaultOutputCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027486 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027487
William M. Brack21e4ef22005-01-02 09:53:13 +000027488#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000027489 int mem_base;
27490
27491 mem_base = xmlMemBlocks();
27492
27493 xmlRegisterDefaultOutputCallbacks();
27494 call_tests++;
27495 xmlResetLastError();
27496 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027497 printf("Leak of %d blocks found in xmlRegisterDefaultOutputCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027498 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027499 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027500 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027501 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027502 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027503#endif
27504
Daniel Veillard42595322004-11-08 10:52:06 +000027505 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027506}
27507
27508
27509static int
27510test_xmlRegisterHTTPPostCallbacks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027511 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027512
William M. Brack21e4ef22005-01-02 09:53:13 +000027513#if defined(LIBXML_OUTPUT_ENABLED) && defined(LIBXML_HTTP_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000027514 int mem_base;
27515
27516 mem_base = xmlMemBlocks();
27517
27518 xmlRegisterHTTPPostCallbacks();
27519 call_tests++;
27520 xmlResetLastError();
27521 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000027522 printf("Leak of %d blocks found in xmlRegisterHTTPPostCallbacks",
Daniel Veillardd93f6252004-11-02 15:53:51 +000027523 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027524 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000027525 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000027526 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027527 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027528#endif
27529
Daniel Veillard42595322004-11-08 10:52:06 +000027530 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027531}
27532
27533static int
27534test_xmlIO(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027535 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027536
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027537 if (quiet == 0) printf("Testing xmlIO : 38 of 47 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000027538 test_ret += test_xmlAllocOutputBuffer();
27539 test_ret += test_xmlAllocParserInputBuffer();
27540 test_ret += test_xmlCheckFilename();
27541 test_ret += test_xmlCheckHTTPInput();
27542 test_ret += test_xmlCleanupInputCallbacks();
27543 test_ret += test_xmlCleanupOutputCallbacks();
27544 test_ret += test_xmlFileClose();
27545 test_ret += test_xmlFileMatch();
27546 test_ret += test_xmlFileOpen();
27547 test_ret += test_xmlFileRead();
27548 test_ret += test_xmlIOFTPClose();
27549 test_ret += test_xmlIOFTPMatch();
27550 test_ret += test_xmlIOFTPOpen();
27551 test_ret += test_xmlIOFTPRead();
27552 test_ret += test_xmlIOHTTPClose();
27553 test_ret += test_xmlIOHTTPMatch();
27554 test_ret += test_xmlIOHTTPOpen();
27555 test_ret += test_xmlIOHTTPOpenW();
27556 test_ret += test_xmlIOHTTPRead();
27557 test_ret += test_xmlNoNetExternalEntityLoader();
27558 test_ret += test_xmlNormalizeWindowsPath();
27559 test_ret += test_xmlOutputBufferCreateFd();
27560 test_ret += test_xmlOutputBufferCreateFile();
27561 test_ret += test_xmlOutputBufferCreateFilename();
27562 test_ret += test_xmlOutputBufferFlush();
27563 test_ret += test_xmlOutputBufferWrite();
27564 test_ret += test_xmlOutputBufferWriteEscape();
27565 test_ret += test_xmlOutputBufferWriteString();
27566 test_ret += test_xmlParserGetDirectory();
27567 test_ret += test_xmlParserInputBufferCreateFd();
27568 test_ret += test_xmlParserInputBufferCreateFile();
27569 test_ret += test_xmlParserInputBufferCreateFilename();
27570 test_ret += test_xmlParserInputBufferCreateMem();
27571 test_ret += test_xmlParserInputBufferCreateStatic();
27572 test_ret += test_xmlParserInputBufferGrow();
27573 test_ret += test_xmlParserInputBufferPush();
27574 test_ret += test_xmlParserInputBufferRead();
27575 test_ret += test_xmlPopInputCallbacks();
27576 test_ret += test_xmlRegisterDefaultInputCallbacks();
27577 test_ret += test_xmlRegisterDefaultOutputCallbacks();
27578 test_ret += test_xmlRegisterHTTPPostCallbacks();
Daniel Veillardd93f6252004-11-02 15:53:51 +000027579
Daniel Veillard42595322004-11-08 10:52:06 +000027580 if (test_ret != 0)
27581 printf("Module xmlIO: %d errors\n", test_ret);
27582 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027583}
Daniel Veillarda521d282004-11-09 14:59:59 +000027584#ifdef LIBXML_AUTOMATA_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000027585
Daniel Veillarda82b1822004-11-08 16:24:57 +000027586#define gen_nb_xmlAutomataPtr 1
27587static xmlAutomataPtr gen_xmlAutomataPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27588 return(NULL);
27589}
27590static void des_xmlAutomataPtr(int no ATTRIBUTE_UNUSED, xmlAutomataPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27591}
Daniel Veillarda521d282004-11-09 14:59:59 +000027592#endif
27593
Daniel Veillarda82b1822004-11-08 16:24:57 +000027594
27595static int
27596test_xmlAutomataCompile(void) {
27597 int test_ret = 0;
27598
27599
27600 /* missing type support */
27601 return(test_ret);
27602}
27603
27604
27605static int
27606test_xmlAutomataGetInitState(void) {
27607 int test_ret = 0;
27608
27609
27610 /* missing type support */
27611 return(test_ret);
27612}
27613
27614
27615static int
27616test_xmlAutomataIsDeterminist(void) {
27617 int test_ret = 0;
27618
William M. Brack21e4ef22005-01-02 09:53:13 +000027619#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_AUTOMATA_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000027620 int mem_base;
27621 int ret_val;
27622 xmlAutomataPtr am; /* an automata */
27623 int n_am;
27624
27625 for (n_am = 0;n_am < gen_nb_xmlAutomataPtr;n_am++) {
27626 mem_base = xmlMemBlocks();
27627 am = gen_xmlAutomataPtr(n_am, 0);
27628
27629 ret_val = xmlAutomataIsDeterminist(am);
27630 desret_int(ret_val);
27631 call_tests++;
27632 des_xmlAutomataPtr(n_am, am, 0);
27633 xmlResetLastError();
27634 if (mem_base != xmlMemBlocks()) {
27635 printf("Leak of %d blocks found in xmlAutomataIsDeterminist",
27636 xmlMemBlocks() - mem_base);
27637 test_ret++;
27638 printf(" %d", n_am);
27639 printf("\n");
27640 }
27641 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027642 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000027643#endif
27644
Daniel Veillarda82b1822004-11-08 16:24:57 +000027645 return(test_ret);
27646}
27647
Daniel Veillarda521d282004-11-09 14:59:59 +000027648#ifdef LIBXML_AUTOMATA_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +000027649
27650#define gen_nb_xmlAutomataStatePtr 1
27651static xmlAutomataStatePtr gen_xmlAutomataStatePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27652 return(NULL);
27653}
27654static void des_xmlAutomataStatePtr(int no ATTRIBUTE_UNUSED, xmlAutomataStatePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27655}
Daniel Veillarda521d282004-11-09 14:59:59 +000027656#endif
27657
Daniel Veillarda82b1822004-11-08 16:24:57 +000027658
27659static int
27660test_xmlAutomataNewAllTrans(void) {
27661 int test_ret = 0;
27662
27663
27664 /* missing type support */
27665 return(test_ret);
27666}
27667
27668
27669static int
27670test_xmlAutomataNewCountTrans(void) {
27671 int test_ret = 0;
27672
27673
27674 /* missing type support */
27675 return(test_ret);
27676}
27677
27678
27679static int
27680test_xmlAutomataNewCountTrans2(void) {
27681 int test_ret = 0;
27682
27683
27684 /* missing type support */
27685 return(test_ret);
27686}
27687
27688
27689static int
27690test_xmlAutomataNewCountedTrans(void) {
27691 int test_ret = 0;
27692
27693
27694 /* missing type support */
27695 return(test_ret);
27696}
27697
27698
27699static int
27700test_xmlAutomataNewCounter(void) {
27701 int test_ret = 0;
27702
William M. Brack21e4ef22005-01-02 09:53:13 +000027703#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_AUTOMATA_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000027704 int mem_base;
27705 int ret_val;
27706 xmlAutomataPtr am; /* an automata */
27707 int n_am;
27708 int min; /* the minimal value on the counter */
27709 int n_min;
27710 int max; /* the maximal value on the counter */
27711 int n_max;
27712
27713 for (n_am = 0;n_am < gen_nb_xmlAutomataPtr;n_am++) {
27714 for (n_min = 0;n_min < gen_nb_int;n_min++) {
27715 for (n_max = 0;n_max < gen_nb_int;n_max++) {
27716 mem_base = xmlMemBlocks();
27717 am = gen_xmlAutomataPtr(n_am, 0);
27718 min = gen_int(n_min, 1);
27719 max = gen_int(n_max, 2);
27720
27721 ret_val = xmlAutomataNewCounter(am, min, max);
27722 desret_int(ret_val);
27723 call_tests++;
27724 des_xmlAutomataPtr(n_am, am, 0);
27725 des_int(n_min, min, 1);
27726 des_int(n_max, max, 2);
27727 xmlResetLastError();
27728 if (mem_base != xmlMemBlocks()) {
27729 printf("Leak of %d blocks found in xmlAutomataNewCounter",
27730 xmlMemBlocks() - mem_base);
27731 test_ret++;
27732 printf(" %d", n_am);
27733 printf(" %d", n_min);
27734 printf(" %d", n_max);
27735 printf("\n");
27736 }
27737 }
27738 }
27739 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027740 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000027741#endif
27742
Daniel Veillarda82b1822004-11-08 16:24:57 +000027743 return(test_ret);
27744}
27745
27746
27747static int
27748test_xmlAutomataNewCounterTrans(void) {
27749 int test_ret = 0;
27750
27751
27752 /* missing type support */
27753 return(test_ret);
27754}
27755
27756
27757static int
27758test_xmlAutomataNewEpsilon(void) {
27759 int test_ret = 0;
27760
27761
27762 /* missing type support */
27763 return(test_ret);
27764}
27765
27766
27767static int
27768test_xmlAutomataNewOnceTrans(void) {
27769 int test_ret = 0;
27770
27771
27772 /* missing type support */
27773 return(test_ret);
27774}
27775
27776
27777static int
27778test_xmlAutomataNewOnceTrans2(void) {
27779 int test_ret = 0;
27780
27781
27782 /* missing type support */
27783 return(test_ret);
27784}
27785
27786
27787static int
27788test_xmlAutomataNewState(void) {
27789 int test_ret = 0;
27790
27791
27792 /* missing type support */
27793 return(test_ret);
27794}
27795
27796
27797static int
27798test_xmlAutomataNewTransition(void) {
27799 int test_ret = 0;
27800
27801
27802 /* missing type support */
27803 return(test_ret);
27804}
27805
27806
27807static int
27808test_xmlAutomataNewTransition2(void) {
27809 int test_ret = 0;
27810
27811
27812 /* missing type support */
27813 return(test_ret);
27814}
27815
27816
27817static int
27818test_xmlAutomataSetFinalState(void) {
27819 int test_ret = 0;
27820
William M. Brack21e4ef22005-01-02 09:53:13 +000027821#if defined(LIBXML_REGEXP_ENABLED) && defined(LIBXML_AUTOMATA_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000027822 int mem_base;
27823 int ret_val;
27824 xmlAutomataPtr am; /* an automata */
27825 int n_am;
27826 xmlAutomataStatePtr state; /* a state in this automata */
27827 int n_state;
27828
27829 for (n_am = 0;n_am < gen_nb_xmlAutomataPtr;n_am++) {
27830 for (n_state = 0;n_state < gen_nb_xmlAutomataStatePtr;n_state++) {
27831 mem_base = xmlMemBlocks();
27832 am = gen_xmlAutomataPtr(n_am, 0);
27833 state = gen_xmlAutomataStatePtr(n_state, 1);
27834
27835 ret_val = xmlAutomataSetFinalState(am, state);
27836 desret_int(ret_val);
27837 call_tests++;
27838 des_xmlAutomataPtr(n_am, am, 0);
27839 des_xmlAutomataStatePtr(n_state, state, 1);
27840 xmlResetLastError();
27841 if (mem_base != xmlMemBlocks()) {
27842 printf("Leak of %d blocks found in xmlAutomataSetFinalState",
27843 xmlMemBlocks() - mem_base);
27844 test_ret++;
27845 printf(" %d", n_am);
27846 printf(" %d", n_state);
27847 printf("\n");
27848 }
27849 }
27850 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027851 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000027852#endif
27853
Daniel Veillarda82b1822004-11-08 16:24:57 +000027854 return(test_ret);
27855}
27856
27857
27858static int
27859test_xmlNewAutomata(void) {
27860 int test_ret = 0;
27861
27862
27863 /* missing type support */
27864 return(test_ret);
27865}
27866
27867static int
27868test_xmlautomata(void) {
27869 int test_ret = 0;
27870
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027871 if (quiet == 0) printf("Testing xmlautomata : 3 of 18 functions ...\n");
Daniel Veillarda82b1822004-11-08 16:24:57 +000027872 test_ret += test_xmlAutomataCompile();
27873 test_ret += test_xmlAutomataGetInitState();
27874 test_ret += test_xmlAutomataIsDeterminist();
27875 test_ret += test_xmlAutomataNewAllTrans();
27876 test_ret += test_xmlAutomataNewCountTrans();
27877 test_ret += test_xmlAutomataNewCountTrans2();
27878 test_ret += test_xmlAutomataNewCountedTrans();
27879 test_ret += test_xmlAutomataNewCounter();
27880 test_ret += test_xmlAutomataNewCounterTrans();
27881 test_ret += test_xmlAutomataNewEpsilon();
27882 test_ret += test_xmlAutomataNewOnceTrans();
27883 test_ret += test_xmlAutomataNewOnceTrans2();
27884 test_ret += test_xmlAutomataNewState();
27885 test_ret += test_xmlAutomataNewTransition();
27886 test_ret += test_xmlAutomataNewTransition2();
27887 test_ret += test_xmlAutomataSetFinalState();
27888 test_ret += test_xmlNewAutomata();
27889
27890 if (test_ret != 0)
27891 printf("Module xmlautomata: %d errors\n", test_ret);
27892 return(test_ret);
27893}
27894
Daniel Veillardce682bc2004-11-05 17:22:25 +000027895#define gen_nb_xmlGenericErrorFunc_ptr 1
27896static xmlGenericErrorFunc * gen_xmlGenericErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27897 return(NULL);
27898}
27899static void des_xmlGenericErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlGenericErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27900}
27901
Daniel Veillardd93f6252004-11-02 15:53:51 +000027902static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000027903test_initGenericErrorDefaultFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027904 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027905
Daniel Veillardce682bc2004-11-05 17:22:25 +000027906 int mem_base;
27907 xmlGenericErrorFunc * handler; /* the handler */
27908 int n_handler;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027909
Daniel Veillardce682bc2004-11-05 17:22:25 +000027910 for (n_handler = 0;n_handler < gen_nb_xmlGenericErrorFunc_ptr;n_handler++) {
27911 mem_base = xmlMemBlocks();
27912 handler = gen_xmlGenericErrorFunc_ptr(n_handler, 0);
27913
27914 initGenericErrorDefaultFunc(handler);
27915 call_tests++;
27916 des_xmlGenericErrorFunc_ptr(n_handler, handler, 0);
27917 xmlResetLastError();
27918 if (mem_base != xmlMemBlocks()) {
27919 printf("Leak of %d blocks found in initGenericErrorDefaultFunc",
27920 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027921 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027922 printf(" %d", n_handler);
27923 printf("\n");
27924 }
27925 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000027926 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027927
Daniel Veillard42595322004-11-08 10:52:06 +000027928 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027929}
27930
27931
Daniel Veillardce682bc2004-11-05 17:22:25 +000027932#define gen_nb_xmlErrorPtr 1
27933static xmlErrorPtr gen_xmlErrorPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27934 return(NULL);
27935}
27936static void des_xmlErrorPtr(int no ATTRIBUTE_UNUSED, xmlErrorPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
27937}
27938
Daniel Veillardd93f6252004-11-02 15:53:51 +000027939static int
27940test_xmlCopyError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027941 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027942
Daniel Veillardce682bc2004-11-05 17:22:25 +000027943 int mem_base;
27944 int ret_val;
27945 xmlErrorPtr from; /* a source error */
27946 int n_from;
27947 xmlErrorPtr to; /* a target error */
27948 int n_to;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027949
Daniel Veillardce682bc2004-11-05 17:22:25 +000027950 for (n_from = 0;n_from < gen_nb_xmlErrorPtr;n_from++) {
27951 for (n_to = 0;n_to < gen_nb_xmlErrorPtr;n_to++) {
27952 mem_base = xmlMemBlocks();
27953 from = gen_xmlErrorPtr(n_from, 0);
27954 to = gen_xmlErrorPtr(n_to, 1);
27955
27956 ret_val = xmlCopyError(from, to);
27957 desret_int(ret_val);
27958 call_tests++;
27959 des_xmlErrorPtr(n_from, from, 0);
27960 des_xmlErrorPtr(n_to, to, 1);
27961 xmlResetLastError();
27962 if (mem_base != xmlMemBlocks()) {
27963 printf("Leak of %d blocks found in xmlCopyError",
27964 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000027965 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000027966 printf(" %d", n_from);
27967 printf(" %d", n_to);
27968 printf("\n");
27969 }
27970 }
27971 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000027972 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000027973
Daniel Veillard42595322004-11-08 10:52:06 +000027974 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027975}
27976
27977
27978static int
27979test_xmlCtxtGetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027980 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027981
27982
27983 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000027984 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000027985}
27986
27987
27988static int
27989test_xmlCtxtResetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000027990 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027991
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000027992 int mem_base;
27993 void * ctx; /* an XML parser context */
27994 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000027995
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000027996 for (n_ctx = 0;n_ctx < gen_nb_void_ptr;n_ctx++) {
27997 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000027998 ctx = gen_void_ptr(n_ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000027999
28000 xmlCtxtResetLastError(ctx);
28001 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028002 des_void_ptr(n_ctx, ctx, 0);
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000028003 xmlResetLastError();
28004 if (mem_base != xmlMemBlocks()) {
28005 printf("Leak of %d blocks found in xmlCtxtResetLastError",
28006 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028007 test_ret++;
Daniel Veillardb1b3a3e2004-11-03 23:25:47 +000028008 printf(" %d", n_ctx);
28009 printf("\n");
28010 }
28011 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000028012 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028013
Daniel Veillard42595322004-11-08 10:52:06 +000028014 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028015}
28016
28017
28018static int
28019test_xmlGetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028020 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028021
28022
28023 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028024 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028025}
28026
28027
28028static int
28029test_xmlParserError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028030 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028031
28032
28033 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028034 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028035}
28036
28037
28038static int
28039test_xmlParserPrintFileContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028040 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028041
Daniel Veillardce682bc2004-11-05 17:22:25 +000028042 int mem_base;
28043 xmlParserInputPtr input; /* an xmlParserInputPtr input */
28044 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028045
Daniel Veillardce682bc2004-11-05 17:22:25 +000028046 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
28047 mem_base = xmlMemBlocks();
28048 input = gen_xmlParserInputPtr(n_input, 0);
28049
28050 xmlParserPrintFileContext(input);
28051 call_tests++;
28052 des_xmlParserInputPtr(n_input, input, 0);
28053 xmlResetLastError();
28054 if (mem_base != xmlMemBlocks()) {
28055 printf("Leak of %d blocks found in xmlParserPrintFileContext",
28056 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028057 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028058 printf(" %d", n_input);
28059 printf("\n");
28060 }
28061 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000028062 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028063
Daniel Veillard42595322004-11-08 10:52:06 +000028064 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028065}
28066
28067
28068static int
28069test_xmlParserPrintFileInfo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028070 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028071
Daniel Veillardce682bc2004-11-05 17:22:25 +000028072 int mem_base;
28073 xmlParserInputPtr input; /* an xmlParserInputPtr input */
28074 int n_input;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028075
Daniel Veillardce682bc2004-11-05 17:22:25 +000028076 for (n_input = 0;n_input < gen_nb_xmlParserInputPtr;n_input++) {
28077 mem_base = xmlMemBlocks();
28078 input = gen_xmlParserInputPtr(n_input, 0);
28079
28080 xmlParserPrintFileInfo(input);
28081 call_tests++;
28082 des_xmlParserInputPtr(n_input, input, 0);
28083 xmlResetLastError();
28084 if (mem_base != xmlMemBlocks()) {
28085 printf("Leak of %d blocks found in xmlParserPrintFileInfo",
28086 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028087 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028088 printf(" %d", n_input);
28089 printf("\n");
28090 }
28091 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000028092 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028093
Daniel Veillard42595322004-11-08 10:52:06 +000028094 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028095}
28096
28097
28098static int
28099test_xmlParserValidityError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028100 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028101
28102
28103 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028104 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028105}
28106
28107
28108static int
28109test_xmlParserValidityWarning(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028110 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028111
28112
28113 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028114 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028115}
28116
28117
28118static int
28119test_xmlParserWarning(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028120 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028121
28122
28123 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028124 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028125}
28126
28127
28128static int
28129test_xmlResetError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028130 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028131
Daniel Veillardce682bc2004-11-05 17:22:25 +000028132 int mem_base;
28133 xmlErrorPtr err; /* pointer to the error. */
28134 int n_err;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028135
Daniel Veillardce682bc2004-11-05 17:22:25 +000028136 for (n_err = 0;n_err < gen_nb_xmlErrorPtr;n_err++) {
28137 mem_base = xmlMemBlocks();
28138 err = gen_xmlErrorPtr(n_err, 0);
28139
28140 xmlResetError(err);
28141 call_tests++;
28142 des_xmlErrorPtr(n_err, err, 0);
28143 xmlResetLastError();
28144 if (mem_base != xmlMemBlocks()) {
28145 printf("Leak of %d blocks found in xmlResetError",
28146 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028147 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028148 printf(" %d", n_err);
28149 printf("\n");
28150 }
28151 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000028152 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028153
Daniel Veillard42595322004-11-08 10:52:06 +000028154 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028155}
28156
28157
28158static int
28159test_xmlResetLastError(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028160 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028161
28162
28163
28164 xmlResetLastError();
28165 call_tests++;
28166 xmlResetLastError();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028167 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028168
Daniel Veillard42595322004-11-08 10:52:06 +000028169 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028170}
28171
28172
28173static int
28174test_xmlSetGenericErrorFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028175 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028176
28177
28178 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028179 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028180}
28181
28182
28183static int
28184test_xmlSetStructuredErrorFunc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028185 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028186
28187
28188 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000028189 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028190}
28191
28192static int
28193test_xmlerror(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028194 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028195
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028196 if (quiet == 0) printf("Testing xmlerror : 7 of 15 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000028197 test_ret += test_initGenericErrorDefaultFunc();
28198 test_ret += test_xmlCopyError();
28199 test_ret += test_xmlCtxtGetLastError();
28200 test_ret += test_xmlCtxtResetLastError();
28201 test_ret += test_xmlGetLastError();
28202 test_ret += test_xmlParserError();
28203 test_ret += test_xmlParserPrintFileContext();
28204 test_ret += test_xmlParserPrintFileInfo();
28205 test_ret += test_xmlParserValidityError();
28206 test_ret += test_xmlParserValidityWarning();
28207 test_ret += test_xmlParserWarning();
28208 test_ret += test_xmlResetError();
28209 test_ret += test_xmlResetLastError();
28210 test_ret += test_xmlSetGenericErrorFunc();
28211 test_ret += test_xmlSetStructuredErrorFunc();
Daniel Veillardd93f6252004-11-02 15:53:51 +000028212
Daniel Veillard42595322004-11-08 10:52:06 +000028213 if (test_ret != 0)
28214 printf("Module xmlerror: %d errors\n", test_ret);
28215 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028216}
Daniel Veillardd93f6252004-11-02 15:53:51 +000028217
28218static int
28219test_xmlNewTextReader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028220 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028221
William M. Brack21e4ef22005-01-02 09:53:13 +000028222#if defined(LIBXML_READER_ENABLED)
Daniel Veillard34099b42004-11-04 17:34:35 +000028223 int mem_base;
28224 xmlTextReaderPtr ret_val;
28225 xmlParserInputBufferPtr input; /* the xmlParserInputBufferPtr used to read data */
28226 int n_input;
28227 const char * URI; /* the URI information for the source if available */
28228 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028229
Daniel Veillard34099b42004-11-04 17:34:35 +000028230 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
28231 for (n_URI = 0;n_URI < gen_nb_filepath;n_URI++) {
28232 mem_base = xmlMemBlocks();
28233 input = gen_xmlParserInputBufferPtr(n_input, 0);
28234 URI = gen_filepath(n_URI, 1);
28235
28236 ret_val = xmlNewTextReader(input, URI);
28237 desret_xmlTextReaderPtr(ret_val);
28238 call_tests++;
28239 des_xmlParserInputBufferPtr(n_input, input, 0);
28240 des_filepath(n_URI, URI, 1);
28241 xmlResetLastError();
28242 if (mem_base != xmlMemBlocks()) {
28243 printf("Leak of %d blocks found in xmlNewTextReader",
28244 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028245 test_ret++;
Daniel Veillard34099b42004-11-04 17:34:35 +000028246 printf(" %d", n_input);
28247 printf(" %d", n_URI);
28248 printf("\n");
28249 }
28250 }
28251 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028252 function_tests++;
Daniel Veillard34099b42004-11-04 17:34:35 +000028253#endif
28254
Daniel Veillard42595322004-11-08 10:52:06 +000028255 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028256}
28257
28258
28259static int
28260test_xmlNewTextReaderFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028261 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028262
William M. Brack21e4ef22005-01-02 09:53:13 +000028263#if defined(LIBXML_READER_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028264 int mem_base;
28265 xmlTextReaderPtr ret_val;
28266 const char * URI; /* the URI of the resource to process */
28267 int n_URI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028268
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028269 for (n_URI = 0;n_URI < gen_nb_filepath;n_URI++) {
28270 mem_base = xmlMemBlocks();
28271 URI = gen_filepath(n_URI, 0);
28272
28273 ret_val = xmlNewTextReaderFilename(URI);
28274 desret_xmlTextReaderPtr(ret_val);
28275 call_tests++;
28276 des_filepath(n_URI, URI, 0);
28277 xmlResetLastError();
28278 if (mem_base != xmlMemBlocks()) {
28279 printf("Leak of %d blocks found in xmlNewTextReaderFilename",
28280 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028281 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028282 printf(" %d", n_URI);
28283 printf("\n");
28284 }
28285 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028286 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028287#endif
28288
Daniel Veillard42595322004-11-08 10:52:06 +000028289 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028290}
28291
28292
28293static int
28294test_xmlReaderForDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028295 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028296
William M. Brack21e4ef22005-01-02 09:53:13 +000028297#if defined(LIBXML_READER_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028298 int mem_base;
28299 xmlTextReaderPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028300 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028301 int n_cur;
28302 const char * URL; /* the base URL to use for the document */
28303 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028304 char * encoding; /* the document encoding, or NULL */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028305 int n_encoding;
28306 int options; /* a combination of xmlParserOption */
28307 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028308
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028309 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
28310 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28311 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028312 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028313 mem_base = xmlMemBlocks();
28314 cur = gen_const_xmlChar_ptr(n_cur, 0);
28315 URL = gen_filepath(n_URL, 1);
28316 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000028317 options = gen_parseroptions(n_options, 3);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028318
William M. Brackf13f77f2004-11-12 16:03:48 +000028319 ret_val = xmlReaderForDoc((const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028320 desret_xmlTextReaderPtr(ret_val);
28321 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000028322 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028323 des_filepath(n_URL, URL, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000028324 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000028325 des_parseroptions(n_options, options, 3);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028326 xmlResetLastError();
28327 if (mem_base != xmlMemBlocks()) {
28328 printf("Leak of %d blocks found in xmlReaderForDoc",
28329 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028330 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028331 printf(" %d", n_cur);
28332 printf(" %d", n_URL);
28333 printf(" %d", n_encoding);
28334 printf(" %d", n_options);
28335 printf("\n");
28336 }
28337 }
28338 }
28339 }
28340 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028341 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028342#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000028343
Daniel Veillard42595322004-11-08 10:52:06 +000028344 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028345}
28346
28347
28348static int
28349test_xmlReaderForFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028350 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028351
William M. Brack21e4ef22005-01-02 09:53:13 +000028352#if defined(LIBXML_READER_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028353 int mem_base;
28354 xmlTextReaderPtr ret_val;
28355 const char * filename; /* a file or URL */
28356 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028357 char * encoding; /* the document encoding, or NULL */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028358 int n_encoding;
28359 int options; /* a combination of xmlParserOption */
28360 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028361
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028362 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
28363 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028364 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028365 mem_base = xmlMemBlocks();
28366 filename = gen_filepath(n_filename, 0);
28367 encoding = gen_const_char_ptr(n_encoding, 1);
Daniel Veillard6128c012004-11-08 17:16:15 +000028368 options = gen_parseroptions(n_options, 2);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028369
William M. Brackf13f77f2004-11-12 16:03:48 +000028370 ret_val = xmlReaderForFile(filename, (const char *)encoding, options);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028371 desret_xmlTextReaderPtr(ret_val);
28372 call_tests++;
28373 des_filepath(n_filename, filename, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000028374 des_const_char_ptr(n_encoding, (const char *)encoding, 1);
Daniel Veillard6128c012004-11-08 17:16:15 +000028375 des_parseroptions(n_options, options, 2);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028376 xmlResetLastError();
28377 if (mem_base != xmlMemBlocks()) {
28378 printf("Leak of %d blocks found in xmlReaderForFile",
28379 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028380 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028381 printf(" %d", n_filename);
28382 printf(" %d", n_encoding);
28383 printf(" %d", n_options);
28384 printf("\n");
28385 }
28386 }
28387 }
28388 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028389 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028390#endif
28391
Daniel Veillard42595322004-11-08 10:52:06 +000028392 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028393}
28394
28395
28396static int
28397test_xmlReaderForMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028398 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028399
William M. Brack21e4ef22005-01-02 09:53:13 +000028400#if defined(LIBXML_READER_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028401 int mem_base;
28402 xmlTextReaderPtr ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028403 char * buffer; /* a pointer to a char array */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028404 int n_buffer;
28405 int size; /* the size of the array */
28406 int n_size;
28407 const char * URL; /* the base URL to use for the document */
28408 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028409 char * encoding; /* the document encoding, or NULL */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028410 int n_encoding;
28411 int options; /* a combination of xmlParserOption */
28412 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028413
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028414 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
28415 for (n_size = 0;n_size < gen_nb_int;n_size++) {
28416 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28417 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028418 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028419 mem_base = xmlMemBlocks();
28420 buffer = gen_const_char_ptr(n_buffer, 0);
28421 size = gen_int(n_size, 1);
28422 URL = gen_filepath(n_URL, 2);
28423 encoding = gen_const_char_ptr(n_encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000028424 options = gen_parseroptions(n_options, 4);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028425
William M. Brackf13f77f2004-11-12 16:03:48 +000028426 ret_val = xmlReaderForMemory((const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028427 desret_xmlTextReaderPtr(ret_val);
28428 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000028429 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028430 des_int(n_size, size, 1);
28431 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000028432 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000028433 des_parseroptions(n_options, options, 4);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028434 xmlResetLastError();
28435 if (mem_base != xmlMemBlocks()) {
28436 printf("Leak of %d blocks found in xmlReaderForMemory",
28437 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028438 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028439 printf(" %d", n_buffer);
28440 printf(" %d", n_size);
28441 printf(" %d", n_URL);
28442 printf(" %d", n_encoding);
28443 printf(" %d", n_options);
28444 printf("\n");
28445 }
28446 }
28447 }
28448 }
28449 }
28450 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028451 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028452#endif
28453
Daniel Veillard42595322004-11-08 10:52:06 +000028454 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028455}
28456
28457
28458static int
28459test_xmlReaderNewDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028460 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028461
William M. Brack21e4ef22005-01-02 09:53:13 +000028462#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028463 int mem_base;
28464 int ret_val;
28465 xmlTextReaderPtr reader; /* an XML reader */
28466 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028467 xmlChar * cur; /* a pointer to a zero terminated string */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028468 int n_cur;
28469 const char * URL; /* the base URL to use for the document */
28470 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028471 char * encoding; /* the document encoding, or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028472 int n_encoding;
28473 int options; /* a combination of xmlParserOption */
28474 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028475
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028476 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28477 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
28478 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28479 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028480 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028481 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028482 reader = gen_xmlTextReaderPtr(n_reader, 0);
28483 cur = gen_const_xmlChar_ptr(n_cur, 1);
28484 URL = gen_filepath(n_URL, 2);
28485 encoding = gen_const_char_ptr(n_encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000028486 options = gen_parseroptions(n_options, 4);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028487
William M. Brackf13f77f2004-11-12 16:03:48 +000028488 ret_val = xmlReaderNewDoc(reader, (const xmlChar *)cur, URL, (const char *)encoding, options);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028489 desret_int(ret_val);
28490 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028491 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000028492 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000028493 des_filepath(n_URL, URL, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000028494 des_const_char_ptr(n_encoding, (const char *)encoding, 3);
Daniel Veillard6128c012004-11-08 17:16:15 +000028495 des_parseroptions(n_options, options, 4);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028496 xmlResetLastError();
28497 if (mem_base != xmlMemBlocks()) {
28498 printf("Leak of %d blocks found in xmlReaderNewDoc",
28499 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028500 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028501 printf(" %d", n_reader);
28502 printf(" %d", n_cur);
28503 printf(" %d", n_URL);
28504 printf(" %d", n_encoding);
28505 printf(" %d", n_options);
28506 printf("\n");
28507 }
28508 }
28509 }
28510 }
28511 }
28512 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028513 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028514#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000028515
Daniel Veillard42595322004-11-08 10:52:06 +000028516 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028517}
28518
28519
28520static int
28521test_xmlReaderNewFile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028522 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028523
William M. Brack21e4ef22005-01-02 09:53:13 +000028524#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028525 int mem_base;
28526 int ret_val;
28527 xmlTextReaderPtr reader; /* an XML reader */
28528 int n_reader;
28529 const char * filename; /* a file or URL */
28530 int n_filename;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028531 char * encoding; /* the document encoding, or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028532 int n_encoding;
28533 int options; /* a combination of xmlParserOption */
28534 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028535
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028536 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28537 for (n_filename = 0;n_filename < gen_nb_filepath;n_filename++) {
28538 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028539 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028540 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028541 reader = gen_xmlTextReaderPtr(n_reader, 0);
28542 filename = gen_filepath(n_filename, 1);
28543 encoding = gen_const_char_ptr(n_encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000028544 options = gen_parseroptions(n_options, 3);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028545
William M. Brackf13f77f2004-11-12 16:03:48 +000028546 ret_val = xmlReaderNewFile(reader, filename, (const char *)encoding, options);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028547 desret_int(ret_val);
28548 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028549 des_xmlTextReaderPtr(n_reader, reader, 0);
28550 des_filepath(n_filename, filename, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000028551 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
Daniel Veillard6128c012004-11-08 17:16:15 +000028552 des_parseroptions(n_options, options, 3);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028553 xmlResetLastError();
28554 if (mem_base != xmlMemBlocks()) {
28555 printf("Leak of %d blocks found in xmlReaderNewFile",
28556 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028557 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028558 printf(" %d", n_reader);
28559 printf(" %d", n_filename);
28560 printf(" %d", n_encoding);
28561 printf(" %d", n_options);
28562 printf("\n");
28563 }
28564 }
28565 }
28566 }
28567 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028568 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028569#endif
28570
Daniel Veillard42595322004-11-08 10:52:06 +000028571 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028572}
28573
28574
28575static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000028576test_xmlReaderNewMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028577 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028578
William M. Brack21e4ef22005-01-02 09:53:13 +000028579#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028580 int mem_base;
28581 int ret_val;
28582 xmlTextReaderPtr reader; /* an XML reader */
28583 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028584 char * buffer; /* a pointer to a char array */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028585 int n_buffer;
28586 int size; /* the size of the array */
28587 int n_size;
28588 const char * URL; /* the base URL to use for the document */
28589 int n_URL;
Daniel Veillardce682bc2004-11-05 17:22:25 +000028590 char * encoding; /* the document encoding, or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028591 int n_encoding;
28592 int options; /* a combination of xmlParserOption */
28593 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028594
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028595 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28596 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
28597 for (n_size = 0;n_size < gen_nb_int;n_size++) {
28598 for (n_URL = 0;n_URL < gen_nb_filepath;n_URL++) {
28599 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
Daniel Veillard6128c012004-11-08 17:16:15 +000028600 for (n_options = 0;n_options < gen_nb_parseroptions;n_options++) {
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028601 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028602 reader = gen_xmlTextReaderPtr(n_reader, 0);
28603 buffer = gen_const_char_ptr(n_buffer, 1);
28604 size = gen_int(n_size, 2);
28605 URL = gen_filepath(n_URL, 3);
28606 encoding = gen_const_char_ptr(n_encoding, 4);
Daniel Veillard6128c012004-11-08 17:16:15 +000028607 options = gen_parseroptions(n_options, 5);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028608
William M. Brackf13f77f2004-11-12 16:03:48 +000028609 ret_val = xmlReaderNewMemory(reader, (const char *)buffer, size, URL, (const char *)encoding, options);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028610 desret_int(ret_val);
28611 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028612 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000028613 des_const_char_ptr(n_buffer, (const char *)buffer, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000028614 des_int(n_size, size, 2);
28615 des_filepath(n_URL, URL, 3);
William M. Brackf13f77f2004-11-12 16:03:48 +000028616 des_const_char_ptr(n_encoding, (const char *)encoding, 4);
Daniel Veillard6128c012004-11-08 17:16:15 +000028617 des_parseroptions(n_options, options, 5);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028618 xmlResetLastError();
28619 if (mem_base != xmlMemBlocks()) {
28620 printf("Leak of %d blocks found in xmlReaderNewMemory",
28621 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028622 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028623 printf(" %d", n_reader);
28624 printf(" %d", n_buffer);
28625 printf(" %d", n_size);
28626 printf(" %d", n_URL);
28627 printf(" %d", n_encoding);
28628 printf(" %d", n_options);
28629 printf("\n");
28630 }
28631 }
28632 }
28633 }
28634 }
28635 }
28636 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028637 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028638#endif
28639
Daniel Veillard42595322004-11-08 10:52:06 +000028640 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028641}
28642
28643
28644static int
28645test_xmlReaderNewWalker(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028646 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028647
William M. Brack21e4ef22005-01-02 09:53:13 +000028648#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028649 int mem_base;
28650 int ret_val;
28651 xmlTextReaderPtr reader; /* an XML reader */
28652 int n_reader;
28653 xmlDocPtr doc; /* a preparsed document */
28654 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028655
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028656 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28657 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
28658 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028659 reader = gen_xmlTextReaderPtr(n_reader, 0);
28660 doc = gen_xmlDocPtr(n_doc, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028661
28662 ret_val = xmlReaderNewWalker(reader, doc);
28663 desret_int(ret_val);
28664 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028665 des_xmlTextReaderPtr(n_reader, reader, 0);
28666 des_xmlDocPtr(n_doc, doc, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028667 xmlResetLastError();
28668 if (mem_base != xmlMemBlocks()) {
28669 printf("Leak of %d blocks found in xmlReaderNewWalker",
28670 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028671 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028672 printf(" %d", n_reader);
28673 printf(" %d", n_doc);
28674 printf("\n");
28675 }
28676 }
28677 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028678 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028679#endif
28680
Daniel Veillard42595322004-11-08 10:52:06 +000028681 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028682}
28683
28684
28685static int
28686test_xmlReaderWalker(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028687 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028688
William M. Brack21e4ef22005-01-02 09:53:13 +000028689#if defined(LIBXML_READER_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028690 int mem_base;
28691 xmlTextReaderPtr ret_val;
28692 xmlDocPtr doc; /* a preparsed document */
28693 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028694
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028695 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
28696 mem_base = xmlMemBlocks();
28697 doc = gen_xmlDocPtr(n_doc, 0);
28698
28699 ret_val = xmlReaderWalker(doc);
28700 desret_xmlTextReaderPtr(ret_val);
28701 call_tests++;
28702 des_xmlDocPtr(n_doc, doc, 0);
28703 xmlResetLastError();
28704 if (mem_base != xmlMemBlocks()) {
28705 printf("Leak of %d blocks found in xmlReaderWalker",
28706 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028707 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028708 printf(" %d", n_doc);
28709 printf("\n");
28710 }
28711 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028712 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000028713#endif
28714
Daniel Veillard42595322004-11-08 10:52:06 +000028715 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028716}
28717
28718
28719static int
28720test_xmlTextReaderAttributeCount(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028721 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028722
William M. Brack21e4ef22005-01-02 09:53:13 +000028723#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028724 int mem_base;
28725 int ret_val;
28726 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28727 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028728
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028729 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28730 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028731 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028732
28733 ret_val = xmlTextReaderAttributeCount(reader);
28734 desret_int(ret_val);
28735 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028736 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028737 xmlResetLastError();
28738 if (mem_base != xmlMemBlocks()) {
28739 printf("Leak of %d blocks found in xmlTextReaderAttributeCount",
28740 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028741 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028742 printf(" %d", n_reader);
28743 printf("\n");
28744 }
28745 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028746 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028747#endif
28748
Daniel Veillard42595322004-11-08 10:52:06 +000028749 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028750}
28751
28752
28753static int
28754test_xmlTextReaderBaseUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028755 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028756
William M. Brack21e4ef22005-01-02 09:53:13 +000028757#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028758 int mem_base;
28759 xmlChar * ret_val;
28760 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28761 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028762
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028763 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28764 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028765 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028766
28767 ret_val = xmlTextReaderBaseUri(reader);
28768 desret_xmlChar_ptr(ret_val);
28769 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028770 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028771 xmlResetLastError();
28772 if (mem_base != xmlMemBlocks()) {
28773 printf("Leak of %d blocks found in xmlTextReaderBaseUri",
28774 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028775 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028776 printf(" %d", n_reader);
28777 printf("\n");
28778 }
28779 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028780 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028781#endif
28782
Daniel Veillard42595322004-11-08 10:52:06 +000028783 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028784}
28785
28786
28787static int
28788test_xmlTextReaderClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028789 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028790
William M. Brack21e4ef22005-01-02 09:53:13 +000028791#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028792 int mem_base;
28793 int ret_val;
28794 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28795 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028796
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028797 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28798 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028799 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028800
28801 ret_val = xmlTextReaderClose(reader);
28802 desret_int(ret_val);
28803 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028804 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028805 xmlResetLastError();
28806 if (mem_base != xmlMemBlocks()) {
28807 printf("Leak of %d blocks found in xmlTextReaderClose",
28808 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028809 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028810 printf(" %d", n_reader);
28811 printf("\n");
28812 }
28813 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028814 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000028815#endif
28816
Daniel Veillard42595322004-11-08 10:52:06 +000028817 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028818}
28819
28820
28821static int
28822test_xmlTextReaderConstBaseUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028823 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028824
William M. Brack21e4ef22005-01-02 09:53:13 +000028825#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028826 int mem_base;
28827 const xmlChar * ret_val;
28828 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28829 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028830
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028831 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28832 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028833 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028834
28835 ret_val = xmlTextReaderConstBaseUri(reader);
28836 desret_const_xmlChar_ptr(ret_val);
28837 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028838 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028839 xmlResetLastError();
28840 if (mem_base != xmlMemBlocks()) {
28841 printf("Leak of %d blocks found in xmlTextReaderConstBaseUri",
28842 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028843 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028844 printf(" %d", n_reader);
28845 printf("\n");
28846 }
28847 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028848 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028849#endif
28850
Daniel Veillard42595322004-11-08 10:52:06 +000028851 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028852}
28853
28854
28855static int
28856test_xmlTextReaderConstEncoding(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028857 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028858
William M. Brack21e4ef22005-01-02 09:53:13 +000028859#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028860 int mem_base;
28861 const xmlChar * ret_val;
28862 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28863 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028864
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028865 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28866 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028867 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028868
28869 ret_val = xmlTextReaderConstEncoding(reader);
28870 desret_const_xmlChar_ptr(ret_val);
28871 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028872 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028873 xmlResetLastError();
28874 if (mem_base != xmlMemBlocks()) {
28875 printf("Leak of %d blocks found in xmlTextReaderConstEncoding",
28876 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028877 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028878 printf(" %d", n_reader);
28879 printf("\n");
28880 }
28881 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028882 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028883#endif
28884
Daniel Veillard42595322004-11-08 10:52:06 +000028885 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028886}
28887
28888
28889static int
28890test_xmlTextReaderConstLocalName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028891 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028892
William M. Brack21e4ef22005-01-02 09:53:13 +000028893#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028894 int mem_base;
28895 const xmlChar * ret_val;
28896 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28897 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028898
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028899 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28900 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028901 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028902
28903 ret_val = xmlTextReaderConstLocalName(reader);
28904 desret_const_xmlChar_ptr(ret_val);
28905 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028906 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028907 xmlResetLastError();
28908 if (mem_base != xmlMemBlocks()) {
28909 printf("Leak of %d blocks found in xmlTextReaderConstLocalName",
28910 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028911 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028912 printf(" %d", n_reader);
28913 printf("\n");
28914 }
28915 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028916 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028917#endif
28918
Daniel Veillard42595322004-11-08 10:52:06 +000028919 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028920}
28921
28922
28923static int
28924test_xmlTextReaderConstName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028925 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028926
William M. Brack21e4ef22005-01-02 09:53:13 +000028927#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028928 int mem_base;
28929 const xmlChar * ret_val;
28930 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28931 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028932
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028933 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28934 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028935 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028936
28937 ret_val = xmlTextReaderConstName(reader);
28938 desret_const_xmlChar_ptr(ret_val);
28939 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028940 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028941 xmlResetLastError();
28942 if (mem_base != xmlMemBlocks()) {
28943 printf("Leak of %d blocks found in xmlTextReaderConstName",
28944 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028945 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028946 printf(" %d", n_reader);
28947 printf("\n");
28948 }
28949 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028950 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028951#endif
28952
Daniel Veillard42595322004-11-08 10:52:06 +000028953 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028954}
28955
28956
28957static int
28958test_xmlTextReaderConstNamespaceUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028959 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028960
William M. Brack21e4ef22005-01-02 09:53:13 +000028961#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028962 int mem_base;
28963 const xmlChar * ret_val;
28964 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28965 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028966
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028967 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
28968 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000028969 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028970
28971 ret_val = xmlTextReaderConstNamespaceUri(reader);
28972 desret_const_xmlChar_ptr(ret_val);
28973 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000028974 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028975 xmlResetLastError();
28976 if (mem_base != xmlMemBlocks()) {
28977 printf("Leak of %d blocks found in xmlTextReaderConstNamespaceUri",
28978 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000028979 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028980 printf(" %d", n_reader);
28981 printf("\n");
28982 }
28983 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000028984 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028985#endif
28986
Daniel Veillard42595322004-11-08 10:52:06 +000028987 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000028988}
28989
28990
28991static int
28992test_xmlTextReaderConstPrefix(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000028993 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000028994
William M. Brack21e4ef22005-01-02 09:53:13 +000028995#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000028996 int mem_base;
28997 const xmlChar * ret_val;
28998 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
28999 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029000
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029001 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29002 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029003 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029004
29005 ret_val = xmlTextReaderConstPrefix(reader);
29006 desret_const_xmlChar_ptr(ret_val);
29007 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029008 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029009 xmlResetLastError();
29010 if (mem_base != xmlMemBlocks()) {
29011 printf("Leak of %d blocks found in xmlTextReaderConstPrefix",
29012 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029013 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029014 printf(" %d", n_reader);
29015 printf("\n");
29016 }
29017 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029018 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029019#endif
29020
Daniel Veillard42595322004-11-08 10:52:06 +000029021 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029022}
29023
29024
29025static int
29026test_xmlTextReaderConstString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029027 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029028
William M. Brack21e4ef22005-01-02 09:53:13 +000029029#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029030 int mem_base;
29031 const xmlChar * ret_val;
29032 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29033 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029034 xmlChar * str; /* the string to intern. */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029035 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029036
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029037 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29038 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
29039 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029040 reader = gen_xmlTextReaderPtr(n_reader, 0);
29041 str = gen_const_xmlChar_ptr(n_str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029042
William M. Brackf13f77f2004-11-12 16:03:48 +000029043 ret_val = xmlTextReaderConstString(reader, (const xmlChar *)str);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029044 desret_const_xmlChar_ptr(ret_val);
29045 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029046 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000029047 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029048 xmlResetLastError();
29049 if (mem_base != xmlMemBlocks()) {
29050 printf("Leak of %d blocks found in xmlTextReaderConstString",
29051 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029052 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029053 printf(" %d", n_reader);
29054 printf(" %d", n_str);
29055 printf("\n");
29056 }
29057 }
29058 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029059 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029060#endif
29061
Daniel Veillard42595322004-11-08 10:52:06 +000029062 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029063}
29064
29065
29066static int
29067test_xmlTextReaderConstValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029068 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029069
William M. Brack21e4ef22005-01-02 09:53:13 +000029070#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029071 int mem_base;
29072 const xmlChar * ret_val;
29073 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29074 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029075
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029076 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29077 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029078 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029079
29080 ret_val = xmlTextReaderConstValue(reader);
29081 desret_const_xmlChar_ptr(ret_val);
29082 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029083 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029084 xmlResetLastError();
29085 if (mem_base != xmlMemBlocks()) {
29086 printf("Leak of %d blocks found in xmlTextReaderConstValue",
29087 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029088 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029089 printf(" %d", n_reader);
29090 printf("\n");
29091 }
29092 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029093 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029094#endif
29095
Daniel Veillard42595322004-11-08 10:52:06 +000029096 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029097}
29098
29099
29100static int
29101test_xmlTextReaderConstXmlLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029102 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029103
William M. Brack21e4ef22005-01-02 09:53:13 +000029104#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029105 int mem_base;
29106 const xmlChar * ret_val;
29107 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29108 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029109
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029110 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29111 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029112 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029113
29114 ret_val = xmlTextReaderConstXmlLang(reader);
29115 desret_const_xmlChar_ptr(ret_val);
29116 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029117 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029118 xmlResetLastError();
29119 if (mem_base != xmlMemBlocks()) {
29120 printf("Leak of %d blocks found in xmlTextReaderConstXmlLang",
29121 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029122 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029123 printf(" %d", n_reader);
29124 printf("\n");
29125 }
29126 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029127 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029128#endif
29129
Daniel Veillard42595322004-11-08 10:52:06 +000029130 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029131}
29132
29133
29134static int
29135test_xmlTextReaderConstXmlVersion(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029136 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029137
William M. Brack21e4ef22005-01-02 09:53:13 +000029138#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029139 int mem_base;
29140 const xmlChar * ret_val;
29141 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29142 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029143
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029144 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29145 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029146 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029147
29148 ret_val = xmlTextReaderConstXmlVersion(reader);
29149 desret_const_xmlChar_ptr(ret_val);
29150 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029151 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029152 xmlResetLastError();
29153 if (mem_base != xmlMemBlocks()) {
29154 printf("Leak of %d blocks found in xmlTextReaderConstXmlVersion",
29155 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029156 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029157 printf(" %d", n_reader);
29158 printf("\n");
29159 }
29160 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029161 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000029162#endif
29163
Daniel Veillard42595322004-11-08 10:52:06 +000029164 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029165}
29166
29167
29168static int
29169test_xmlTextReaderCurrentDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029170 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029171
William M. Brack21e4ef22005-01-02 09:53:13 +000029172#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029173 int mem_base;
29174 xmlDocPtr ret_val;
29175 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29176 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029177
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029178 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29179 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029180 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029181
29182 ret_val = xmlTextReaderCurrentDoc(reader);
29183 desret_xmlDocPtr(ret_val);
29184 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029185 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029186 xmlResetLastError();
29187 if (mem_base != xmlMemBlocks()) {
29188 printf("Leak of %d blocks found in xmlTextReaderCurrentDoc",
29189 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029190 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029191 printf(" %d", n_reader);
29192 printf("\n");
29193 }
29194 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029195 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029196#endif
29197
Daniel Veillard42595322004-11-08 10:52:06 +000029198 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029199}
29200
29201
29202static int
29203test_xmlTextReaderCurrentNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029204 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029205
William M. Brack21e4ef22005-01-02 09:53:13 +000029206#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029207 int mem_base;
29208 xmlNodePtr ret_val;
29209 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29210 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029211
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029212 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29213 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029214 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029215
29216 ret_val = xmlTextReaderCurrentNode(reader);
29217 desret_xmlNodePtr(ret_val);
29218 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029219 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029220 xmlResetLastError();
29221 if (mem_base != xmlMemBlocks()) {
29222 printf("Leak of %d blocks found in xmlTextReaderCurrentNode",
29223 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029224 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029225 printf(" %d", n_reader);
29226 printf("\n");
29227 }
29228 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029229 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029230#endif
29231
Daniel Veillard42595322004-11-08 10:52:06 +000029232 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029233}
29234
29235
29236static int
29237test_xmlTextReaderDepth(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029238 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029239
William M. Brack21e4ef22005-01-02 09:53:13 +000029240#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029241 int mem_base;
29242 int ret_val;
29243 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29244 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029245
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029246 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29247 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029248 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029249
29250 ret_val = xmlTextReaderDepth(reader);
29251 desret_int(ret_val);
29252 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029253 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029254 xmlResetLastError();
29255 if (mem_base != xmlMemBlocks()) {
29256 printf("Leak of %d blocks found in xmlTextReaderDepth",
29257 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029258 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029259 printf(" %d", n_reader);
29260 printf("\n");
29261 }
29262 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029263 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029264#endif
29265
Daniel Veillard42595322004-11-08 10:52:06 +000029266 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029267}
29268
29269
29270static int
29271test_xmlTextReaderExpand(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029272 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029273
William M. Brack21e4ef22005-01-02 09:53:13 +000029274#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029275 int mem_base;
29276 xmlNodePtr ret_val;
29277 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29278 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029279
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029280 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29281 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029282 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029283
29284 ret_val = xmlTextReaderExpand(reader);
29285 desret_xmlNodePtr(ret_val);
29286 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029287 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029288 xmlResetLastError();
29289 if (mem_base != xmlMemBlocks()) {
29290 printf("Leak of %d blocks found in xmlTextReaderExpand",
29291 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029292 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029293 printf(" %d", n_reader);
29294 printf("\n");
29295 }
29296 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029297 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029298#endif
29299
Daniel Veillard42595322004-11-08 10:52:06 +000029300 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029301}
29302
29303
29304static int
29305test_xmlTextReaderGetAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029306 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029307
William M. Brack21e4ef22005-01-02 09:53:13 +000029308#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029309 int mem_base;
29310 xmlChar * ret_val;
29311 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29312 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029313 xmlChar * name; /* the qualified name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029314 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029315
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029316 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29317 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
29318 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029319 reader = gen_xmlTextReaderPtr(n_reader, 0);
29320 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029321
William M. Brackf13f77f2004-11-12 16:03:48 +000029322 ret_val = xmlTextReaderGetAttribute(reader, (const xmlChar *)name);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029323 desret_xmlChar_ptr(ret_val);
29324 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029325 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000029326 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029327 xmlResetLastError();
29328 if (mem_base != xmlMemBlocks()) {
29329 printf("Leak of %d blocks found in xmlTextReaderGetAttribute",
29330 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029331 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029332 printf(" %d", n_reader);
29333 printf(" %d", n_name);
29334 printf("\n");
29335 }
29336 }
29337 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029338 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029339#endif
29340
Daniel Veillard42595322004-11-08 10:52:06 +000029341 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029342}
29343
29344
29345static int
29346test_xmlTextReaderGetAttributeNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029347 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029348
William M. Brack21e4ef22005-01-02 09:53:13 +000029349#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029350 int mem_base;
29351 xmlChar * ret_val;
29352 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29353 int n_reader;
29354 int no; /* the zero-based index of the attribute relative to the containing element */
29355 int n_no;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029356
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029357 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29358 for (n_no = 0;n_no < gen_nb_int;n_no++) {
29359 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029360 reader = gen_xmlTextReaderPtr(n_reader, 0);
29361 no = gen_int(n_no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029362
29363 ret_val = xmlTextReaderGetAttributeNo(reader, no);
29364 desret_xmlChar_ptr(ret_val);
29365 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029366 des_xmlTextReaderPtr(n_reader, reader, 0);
29367 des_int(n_no, no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029368 xmlResetLastError();
29369 if (mem_base != xmlMemBlocks()) {
29370 printf("Leak of %d blocks found in xmlTextReaderGetAttributeNo",
29371 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029372 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029373 printf(" %d", n_reader);
29374 printf(" %d", n_no);
29375 printf("\n");
29376 }
29377 }
29378 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029379 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029380#endif
29381
Daniel Veillard42595322004-11-08 10:52:06 +000029382 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029383}
29384
29385
29386static int
29387test_xmlTextReaderGetAttributeNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029388 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029389
William M. Brack21e4ef22005-01-02 09:53:13 +000029390#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029391 int mem_base;
29392 xmlChar * ret_val;
29393 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29394 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029395 xmlChar * localName; /* the local name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029396 int n_localName;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029397 xmlChar * namespaceURI; /* the namespace URI of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029398 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029399
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029400 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29401 for (n_localName = 0;n_localName < gen_nb_const_xmlChar_ptr;n_localName++) {
29402 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
29403 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029404 reader = gen_xmlTextReaderPtr(n_reader, 0);
29405 localName = gen_const_xmlChar_ptr(n_localName, 1);
29406 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029407
William M. Brackf13f77f2004-11-12 16:03:48 +000029408 ret_val = xmlTextReaderGetAttributeNs(reader, (const xmlChar *)localName, (const xmlChar *)namespaceURI);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029409 desret_xmlChar_ptr(ret_val);
29410 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029411 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000029412 des_const_xmlChar_ptr(n_localName, (const xmlChar *)localName, 1);
29413 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029414 xmlResetLastError();
29415 if (mem_base != xmlMemBlocks()) {
29416 printf("Leak of %d blocks found in xmlTextReaderGetAttributeNs",
29417 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029418 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029419 printf(" %d", n_reader);
29420 printf(" %d", n_localName);
29421 printf(" %d", n_namespaceURI);
29422 printf("\n");
29423 }
29424 }
29425 }
29426 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029427 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029428#endif
29429
Daniel Veillard42595322004-11-08 10:52:06 +000029430 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029431}
29432
Daniel Veillarda521d282004-11-09 14:59:59 +000029433#ifdef LIBXML_READER_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000029434
Daniel Veillardce682bc2004-11-05 17:22:25 +000029435#define gen_nb_xmlTextReaderErrorFunc_ptr 1
29436static xmlTextReaderErrorFunc * gen_xmlTextReaderErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
29437 return(NULL);
29438}
29439static void des_xmlTextReaderErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlTextReaderErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
29440}
Daniel Veillarda521d282004-11-09 14:59:59 +000029441#endif
29442
Daniel Veillardce682bc2004-11-05 17:22:25 +000029443
Daniel Veillardd93f6252004-11-02 15:53:51 +000029444static int
29445test_xmlTextReaderGetErrorHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029446 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029447
William M. Brack21e4ef22005-01-02 09:53:13 +000029448#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029449 int mem_base;
29450 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29451 int n_reader;
29452 xmlTextReaderErrorFunc * f; /* the callback function or NULL is no callback has been registered */
29453 int n_f;
29454 void ** arg; /* a user argument */
29455 int n_arg;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029456
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029457 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29458 for (n_f = 0;n_f < gen_nb_xmlTextReaderErrorFunc_ptr;n_f++) {
29459 for (n_arg = 0;n_arg < gen_nb_void_ptr_ptr;n_arg++) {
29460 mem_base = xmlMemBlocks();
29461 reader = gen_xmlTextReaderPtr(n_reader, 0);
29462 f = gen_xmlTextReaderErrorFunc_ptr(n_f, 1);
29463 arg = gen_void_ptr_ptr(n_arg, 2);
29464
29465 xmlTextReaderGetErrorHandler(reader, f, arg);
29466 call_tests++;
29467 des_xmlTextReaderPtr(n_reader, reader, 0);
29468 des_xmlTextReaderErrorFunc_ptr(n_f, f, 1);
29469 des_void_ptr_ptr(n_arg, arg, 2);
29470 xmlResetLastError();
29471 if (mem_base != xmlMemBlocks()) {
29472 printf("Leak of %d blocks found in xmlTextReaderGetErrorHandler",
29473 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029474 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029475 printf(" %d", n_reader);
29476 printf(" %d", n_f);
29477 printf(" %d", n_arg);
29478 printf("\n");
29479 }
29480 }
29481 }
29482 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029483 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029484#endif
29485
Daniel Veillard42595322004-11-08 10:52:06 +000029486 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029487}
29488
29489
29490static int
29491test_xmlTextReaderGetParserProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029492 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029493
William M. Brack21e4ef22005-01-02 09:53:13 +000029494#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029495 int mem_base;
29496 int ret_val;
29497 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29498 int n_reader;
29499 int prop; /* the xmlParserProperties to get */
29500 int n_prop;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029501
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029502 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29503 for (n_prop = 0;n_prop < gen_nb_int;n_prop++) {
29504 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029505 reader = gen_xmlTextReaderPtr(n_reader, 0);
29506 prop = gen_int(n_prop, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029507
29508 ret_val = xmlTextReaderGetParserProp(reader, prop);
29509 desret_int(ret_val);
29510 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029511 des_xmlTextReaderPtr(n_reader, reader, 0);
29512 des_int(n_prop, prop, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029513 xmlResetLastError();
29514 if (mem_base != xmlMemBlocks()) {
29515 printf("Leak of %d blocks found in xmlTextReaderGetParserProp",
29516 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029517 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029518 printf(" %d", n_reader);
29519 printf(" %d", n_prop);
29520 printf("\n");
29521 }
29522 }
29523 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029524 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029525#endif
29526
Daniel Veillard42595322004-11-08 10:52:06 +000029527 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029528}
29529
29530
29531static int
29532test_xmlTextReaderGetRemainder(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029533 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029534
William M. Brack21e4ef22005-01-02 09:53:13 +000029535#if defined(LIBXML_READER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029536 int mem_base;
29537 xmlParserInputBufferPtr ret_val;
29538 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29539 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029540
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029541 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29542 mem_base = xmlMemBlocks();
29543 reader = gen_xmlTextReaderPtr(n_reader, 0);
29544
29545 ret_val = xmlTextReaderGetRemainder(reader);
29546 desret_xmlParserInputBufferPtr(ret_val);
29547 call_tests++;
29548 des_xmlTextReaderPtr(n_reader, reader, 0);
29549 xmlResetLastError();
29550 if (mem_base != xmlMemBlocks()) {
29551 printf("Leak of %d blocks found in xmlTextReaderGetRemainder",
29552 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029553 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029554 printf(" %d", n_reader);
29555 printf("\n");
29556 }
29557 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029558 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000029559#endif
29560
Daniel Veillard42595322004-11-08 10:52:06 +000029561 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029562}
29563
29564
29565static int
29566test_xmlTextReaderHasAttributes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029567 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029568
William M. Brack21e4ef22005-01-02 09:53:13 +000029569#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029570 int mem_base;
29571 int ret_val;
29572 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29573 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029574
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029575 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29576 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029577 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029578
29579 ret_val = xmlTextReaderHasAttributes(reader);
29580 desret_int(ret_val);
29581 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029582 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029583 xmlResetLastError();
29584 if (mem_base != xmlMemBlocks()) {
29585 printf("Leak of %d blocks found in xmlTextReaderHasAttributes",
29586 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029587 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029588 printf(" %d", n_reader);
29589 printf("\n");
29590 }
29591 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029592 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029593#endif
29594
Daniel Veillard42595322004-11-08 10:52:06 +000029595 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029596}
29597
29598
29599static int
29600test_xmlTextReaderHasValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029601 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029602
William M. Brack21e4ef22005-01-02 09:53:13 +000029603#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029604 int mem_base;
29605 int ret_val;
29606 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29607 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029608
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029609 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29610 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029611 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029612
29613 ret_val = xmlTextReaderHasValue(reader);
29614 desret_int(ret_val);
29615 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029616 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029617 xmlResetLastError();
29618 if (mem_base != xmlMemBlocks()) {
29619 printf("Leak of %d blocks found in xmlTextReaderHasValue",
29620 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029621 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029622 printf(" %d", n_reader);
29623 printf("\n");
29624 }
29625 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029626 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029627#endif
29628
Daniel Veillard42595322004-11-08 10:52:06 +000029629 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029630}
29631
29632
29633static int
29634test_xmlTextReaderIsDefault(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029635 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029636
William M. Brack21e4ef22005-01-02 09:53:13 +000029637#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029638 int mem_base;
29639 int ret_val;
29640 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29641 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029642
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029643 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29644 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029645 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029646
29647 ret_val = xmlTextReaderIsDefault(reader);
29648 desret_int(ret_val);
29649 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029650 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029651 xmlResetLastError();
29652 if (mem_base != xmlMemBlocks()) {
29653 printf("Leak of %d blocks found in xmlTextReaderIsDefault",
29654 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029655 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029656 printf(" %d", n_reader);
29657 printf("\n");
29658 }
29659 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029660 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029661#endif
29662
Daniel Veillard42595322004-11-08 10:52:06 +000029663 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029664}
29665
29666
29667static int
29668test_xmlTextReaderIsEmptyElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029669 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029670
William M. Brack21e4ef22005-01-02 09:53:13 +000029671#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029672 int mem_base;
29673 int ret_val;
29674 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29675 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029676
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029677 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29678 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029679 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029680
29681 ret_val = xmlTextReaderIsEmptyElement(reader);
29682 desret_int(ret_val);
29683 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029684 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029685 xmlResetLastError();
29686 if (mem_base != xmlMemBlocks()) {
29687 printf("Leak of %d blocks found in xmlTextReaderIsEmptyElement",
29688 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029689 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029690 printf(" %d", n_reader);
29691 printf("\n");
29692 }
29693 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029694 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029695#endif
29696
Daniel Veillard42595322004-11-08 10:52:06 +000029697 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029698}
29699
29700
29701static int
29702test_xmlTextReaderIsNamespaceDecl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029703 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029704
William M. Brack21e4ef22005-01-02 09:53:13 +000029705#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029706 int mem_base;
29707 int ret_val;
29708 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29709 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029710
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029711 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29712 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029713 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029714
29715 ret_val = xmlTextReaderIsNamespaceDecl(reader);
29716 desret_int(ret_val);
29717 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029718 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029719 xmlResetLastError();
29720 if (mem_base != xmlMemBlocks()) {
29721 printf("Leak of %d blocks found in xmlTextReaderIsNamespaceDecl",
29722 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029723 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029724 printf(" %d", n_reader);
29725 printf("\n");
29726 }
29727 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029728 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029729#endif
29730
Daniel Veillard42595322004-11-08 10:52:06 +000029731 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029732}
29733
29734
29735static int
29736test_xmlTextReaderIsValid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029737 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029738
William M. Brack21e4ef22005-01-02 09:53:13 +000029739#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029740 int mem_base;
29741 int ret_val;
29742 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29743 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029744
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029745 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29746 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029747 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029748
29749 ret_val = xmlTextReaderIsValid(reader);
29750 desret_int(ret_val);
29751 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029752 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029753 xmlResetLastError();
29754 if (mem_base != xmlMemBlocks()) {
29755 printf("Leak of %d blocks found in xmlTextReaderIsValid",
29756 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029757 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029758 printf(" %d", n_reader);
29759 printf("\n");
29760 }
29761 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029762 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029763#endif
29764
Daniel Veillard42595322004-11-08 10:52:06 +000029765 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029766}
29767
29768
29769static int
29770test_xmlTextReaderLocalName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029771 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029772
William M. Brack21e4ef22005-01-02 09:53:13 +000029773#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029774 int mem_base;
29775 xmlChar * ret_val;
29776 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29777 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029778
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029779 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29780 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029781 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029782
29783 ret_val = xmlTextReaderLocalName(reader);
29784 desret_xmlChar_ptr(ret_val);
29785 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029786 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029787 xmlResetLastError();
29788 if (mem_base != xmlMemBlocks()) {
29789 printf("Leak of %d blocks found in xmlTextReaderLocalName",
29790 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029791 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029792 printf(" %d", n_reader);
29793 printf("\n");
29794 }
29795 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029796 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029797#endif
29798
Daniel Veillard42595322004-11-08 10:52:06 +000029799 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029800}
29801
Daniel Veillarda521d282004-11-09 14:59:59 +000029802#ifdef LIBXML_READER_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000029803
Daniel Veillardce682bc2004-11-05 17:22:25 +000029804#define gen_nb_xmlTextReaderLocatorPtr 1
29805static xmlTextReaderLocatorPtr gen_xmlTextReaderLocatorPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
29806 return(NULL);
29807}
29808static void des_xmlTextReaderLocatorPtr(int no ATTRIBUTE_UNUSED, xmlTextReaderLocatorPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
29809}
Daniel Veillarda521d282004-11-09 14:59:59 +000029810#endif
29811
Daniel Veillardce682bc2004-11-05 17:22:25 +000029812
Daniel Veillardd93f6252004-11-02 15:53:51 +000029813static int
29814test_xmlTextReaderLocatorBaseURI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029815 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029816
William M. Brack21e4ef22005-01-02 09:53:13 +000029817#if defined(LIBXML_READER_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000029818 int mem_base;
29819 xmlChar * ret_val;
29820 xmlTextReaderLocatorPtr locator; /* the xmlTextReaderLocatorPtr used */
29821 int n_locator;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029822
Daniel Veillardce682bc2004-11-05 17:22:25 +000029823 for (n_locator = 0;n_locator < gen_nb_xmlTextReaderLocatorPtr;n_locator++) {
29824 mem_base = xmlMemBlocks();
29825 locator = gen_xmlTextReaderLocatorPtr(n_locator, 0);
29826
29827 ret_val = xmlTextReaderLocatorBaseURI(locator);
29828 desret_xmlChar_ptr(ret_val);
29829 call_tests++;
29830 des_xmlTextReaderLocatorPtr(n_locator, locator, 0);
29831 xmlResetLastError();
29832 if (mem_base != xmlMemBlocks()) {
29833 printf("Leak of %d blocks found in xmlTextReaderLocatorBaseURI",
29834 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029835 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029836 printf(" %d", n_locator);
29837 printf("\n");
29838 }
29839 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029840 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029841#endif
29842
Daniel Veillard42595322004-11-08 10:52:06 +000029843 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029844}
29845
29846
29847static int
29848test_xmlTextReaderLocatorLineNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029849 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029850
William M. Brack21e4ef22005-01-02 09:53:13 +000029851#if defined(LIBXML_READER_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000029852 int mem_base;
29853 int ret_val;
29854 xmlTextReaderLocatorPtr locator; /* the xmlTextReaderLocatorPtr used */
29855 int n_locator;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029856
Daniel Veillardce682bc2004-11-05 17:22:25 +000029857 for (n_locator = 0;n_locator < gen_nb_xmlTextReaderLocatorPtr;n_locator++) {
29858 mem_base = xmlMemBlocks();
29859 locator = gen_xmlTextReaderLocatorPtr(n_locator, 0);
29860
29861 ret_val = xmlTextReaderLocatorLineNumber(locator);
29862 desret_int(ret_val);
29863 call_tests++;
29864 des_xmlTextReaderLocatorPtr(n_locator, locator, 0);
29865 xmlResetLastError();
29866 if (mem_base != xmlMemBlocks()) {
29867 printf("Leak of %d blocks found in xmlTextReaderLocatorLineNumber",
29868 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029869 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029870 printf(" %d", n_locator);
29871 printf("\n");
29872 }
29873 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029874 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029875#endif
29876
Daniel Veillard42595322004-11-08 10:52:06 +000029877 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029878}
29879
29880
29881static int
29882test_xmlTextReaderLookupNamespace(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029883 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029884
William M. Brack21e4ef22005-01-02 09:53:13 +000029885#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029886 int mem_base;
29887 xmlChar * ret_val;
29888 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29889 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029890 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 +000029891 int n_prefix;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029892
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029893 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29894 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
29895 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029896 reader = gen_xmlTextReaderPtr(n_reader, 0);
29897 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029898
William M. Brackf13f77f2004-11-12 16:03:48 +000029899 ret_val = xmlTextReaderLookupNamespace(reader, (const xmlChar *)prefix);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029900 desret_xmlChar_ptr(ret_val);
29901 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029902 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000029903 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029904 xmlResetLastError();
29905 if (mem_base != xmlMemBlocks()) {
29906 printf("Leak of %d blocks found in xmlTextReaderLookupNamespace",
29907 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029908 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029909 printf(" %d", n_reader);
29910 printf(" %d", n_prefix);
29911 printf("\n");
29912 }
29913 }
29914 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029915 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029916#endif
29917
Daniel Veillard42595322004-11-08 10:52:06 +000029918 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029919}
29920
29921
29922static int
29923test_xmlTextReaderMoveToAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029924 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029925
William M. Brack21e4ef22005-01-02 09:53:13 +000029926#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029927 int mem_base;
29928 int ret_val;
29929 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29930 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000029931 xmlChar * name; /* the qualified name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029932 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029933
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029934 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29935 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
29936 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029937 reader = gen_xmlTextReaderPtr(n_reader, 0);
29938 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029939
William M. Brackf13f77f2004-11-12 16:03:48 +000029940 ret_val = xmlTextReaderMoveToAttribute(reader, (const xmlChar *)name);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029941 desret_int(ret_val);
29942 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029943 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000029944 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029945 xmlResetLastError();
29946 if (mem_base != xmlMemBlocks()) {
29947 printf("Leak of %d blocks found in xmlTextReaderMoveToAttribute",
29948 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029949 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029950 printf(" %d", n_reader);
29951 printf(" %d", n_name);
29952 printf("\n");
29953 }
29954 }
29955 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029956 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029957#endif
29958
Daniel Veillard42595322004-11-08 10:52:06 +000029959 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000029960}
29961
29962
29963static int
29964test_xmlTextReaderMoveToAttributeNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000029965 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029966
William M. Brack21e4ef22005-01-02 09:53:13 +000029967#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029968 int mem_base;
29969 int ret_val;
29970 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
29971 int n_reader;
29972 int no; /* the zero-based index of the attribute relative to the containing element. */
29973 int n_no;
Daniel Veillardd93f6252004-11-02 15:53:51 +000029974
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029975 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
29976 for (n_no = 0;n_no < gen_nb_int;n_no++) {
29977 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000029978 reader = gen_xmlTextReaderPtr(n_reader, 0);
29979 no = gen_int(n_no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029980
29981 ret_val = xmlTextReaderMoveToAttributeNo(reader, no);
29982 desret_int(ret_val);
29983 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000029984 des_xmlTextReaderPtr(n_reader, reader, 0);
29985 des_int(n_no, no, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029986 xmlResetLastError();
29987 if (mem_base != xmlMemBlocks()) {
29988 printf("Leak of %d blocks found in xmlTextReaderMoveToAttributeNo",
29989 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000029990 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029991 printf(" %d", n_reader);
29992 printf(" %d", n_no);
29993 printf("\n");
29994 }
29995 }
29996 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000029997 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000029998#endif
29999
Daniel Veillard42595322004-11-08 10:52:06 +000030000 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030001}
30002
30003
30004static int
30005test_xmlTextReaderMoveToAttributeNs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030006 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030007
William M. Brack21e4ef22005-01-02 09:53:13 +000030008#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030009 int mem_base;
30010 int ret_val;
30011 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30012 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030013 xmlChar * localName; /* the local name of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030014 int n_localName;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030015 xmlChar * namespaceURI; /* the namespace URI of the attribute. */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030016 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030017
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030018 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30019 for (n_localName = 0;n_localName < gen_nb_const_xmlChar_ptr;n_localName++) {
30020 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
30021 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030022 reader = gen_xmlTextReaderPtr(n_reader, 0);
30023 localName = gen_const_xmlChar_ptr(n_localName, 1);
30024 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030025
William M. Brackf13f77f2004-11-12 16:03:48 +000030026 ret_val = xmlTextReaderMoveToAttributeNs(reader, (const xmlChar *)localName, (const xmlChar *)namespaceURI);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030027 desret_int(ret_val);
30028 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030029 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000030030 des_const_xmlChar_ptr(n_localName, (const xmlChar *)localName, 1);
30031 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030032 xmlResetLastError();
30033 if (mem_base != xmlMemBlocks()) {
30034 printf("Leak of %d blocks found in xmlTextReaderMoveToAttributeNs",
30035 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030036 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030037 printf(" %d", n_reader);
30038 printf(" %d", n_localName);
30039 printf(" %d", n_namespaceURI);
30040 printf("\n");
30041 }
30042 }
30043 }
30044 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030045 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030046#endif
30047
Daniel Veillard42595322004-11-08 10:52:06 +000030048 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030049}
30050
30051
30052static int
30053test_xmlTextReaderMoveToElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030054 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030055
William M. Brack21e4ef22005-01-02 09:53:13 +000030056#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030057 int mem_base;
30058 int ret_val;
30059 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30060 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030061
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030062 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30063 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030064 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030065
30066 ret_val = xmlTextReaderMoveToElement(reader);
30067 desret_int(ret_val);
30068 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030069 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030070 xmlResetLastError();
30071 if (mem_base != xmlMemBlocks()) {
30072 printf("Leak of %d blocks found in xmlTextReaderMoveToElement",
30073 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030074 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030075 printf(" %d", n_reader);
30076 printf("\n");
30077 }
30078 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030079 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030080#endif
30081
Daniel Veillard42595322004-11-08 10:52:06 +000030082 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030083}
30084
30085
30086static int
30087test_xmlTextReaderMoveToFirstAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030088 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030089
William M. Brack21e4ef22005-01-02 09:53:13 +000030090#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030091 int mem_base;
30092 int ret_val;
30093 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30094 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030095
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030096 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30097 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030098 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030099
30100 ret_val = xmlTextReaderMoveToFirstAttribute(reader);
30101 desret_int(ret_val);
30102 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030103 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030104 xmlResetLastError();
30105 if (mem_base != xmlMemBlocks()) {
30106 printf("Leak of %d blocks found in xmlTextReaderMoveToFirstAttribute",
30107 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030108 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030109 printf(" %d", n_reader);
30110 printf("\n");
30111 }
30112 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030113 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030114#endif
30115
Daniel Veillard42595322004-11-08 10:52:06 +000030116 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030117}
30118
30119
30120static int
30121test_xmlTextReaderMoveToNextAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030122 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030123
William M. Brack21e4ef22005-01-02 09:53:13 +000030124#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030125 int mem_base;
30126 int ret_val;
30127 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30128 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030129
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030130 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30131 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030132 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030133
30134 ret_val = xmlTextReaderMoveToNextAttribute(reader);
30135 desret_int(ret_val);
30136 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030137 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030138 xmlResetLastError();
30139 if (mem_base != xmlMemBlocks()) {
30140 printf("Leak of %d blocks found in xmlTextReaderMoveToNextAttribute",
30141 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030142 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030143 printf(" %d", n_reader);
30144 printf("\n");
30145 }
30146 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030147 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030148#endif
30149
Daniel Veillard42595322004-11-08 10:52:06 +000030150 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030151}
30152
30153
30154static int
30155test_xmlTextReaderName(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030156 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030157
William M. Brack21e4ef22005-01-02 09:53:13 +000030158#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030159 int mem_base;
30160 xmlChar * ret_val;
30161 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30162 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030163
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030164 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30165 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030166 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030167
30168 ret_val = xmlTextReaderName(reader);
30169 desret_xmlChar_ptr(ret_val);
30170 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030171 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030172 xmlResetLastError();
30173 if (mem_base != xmlMemBlocks()) {
30174 printf("Leak of %d blocks found in xmlTextReaderName",
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("\n");
30179 }
30180 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030181 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030182#endif
30183
Daniel Veillard42595322004-11-08 10:52:06 +000030184 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030185}
30186
30187
30188static int
30189test_xmlTextReaderNamespaceUri(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030190 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030191
William M. Brack21e4ef22005-01-02 09:53:13 +000030192#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030193 int mem_base;
30194 xmlChar * ret_val;
30195 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30196 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030197
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030198 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30199 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030200 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030201
30202 ret_val = xmlTextReaderNamespaceUri(reader);
30203 desret_xmlChar_ptr(ret_val);
30204 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030205 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030206 xmlResetLastError();
30207 if (mem_base != xmlMemBlocks()) {
30208 printf("Leak of %d blocks found in xmlTextReaderNamespaceUri",
30209 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030210 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030211 printf(" %d", n_reader);
30212 printf("\n");
30213 }
30214 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030215 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030216#endif
30217
Daniel Veillard42595322004-11-08 10:52:06 +000030218 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030219}
30220
30221
30222static int
30223test_xmlTextReaderNext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030224 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030225
William M. Brack21e4ef22005-01-02 09:53:13 +000030226#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030227 int mem_base;
30228 int ret_val;
30229 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30230 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030231
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030232 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30233 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030234 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030235
30236 ret_val = xmlTextReaderNext(reader);
30237 desret_int(ret_val);
30238 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030239 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030240 xmlResetLastError();
30241 if (mem_base != xmlMemBlocks()) {
30242 printf("Leak of %d blocks found in xmlTextReaderNext",
30243 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030244 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030245 printf(" %d", n_reader);
30246 printf("\n");
30247 }
30248 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030249 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030250#endif
30251
Daniel Veillard42595322004-11-08 10:52:06 +000030252 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030253}
30254
30255
30256static int
30257test_xmlTextReaderNextSibling(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030258 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030259
William M. Brack21e4ef22005-01-02 09:53:13 +000030260#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030261 int mem_base;
30262 int ret_val;
30263 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30264 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030265
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030266 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30267 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030268 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030269
30270 ret_val = xmlTextReaderNextSibling(reader);
30271 desret_int(ret_val);
30272 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030273 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030274 xmlResetLastError();
30275 if (mem_base != xmlMemBlocks()) {
30276 printf("Leak of %d blocks found in xmlTextReaderNextSibling",
30277 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030278 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030279 printf(" %d", n_reader);
30280 printf("\n");
30281 }
30282 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030283 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030284#endif
30285
Daniel Veillard42595322004-11-08 10:52:06 +000030286 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030287}
30288
30289
30290static int
30291test_xmlTextReaderNodeType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030292 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030293
William M. Brack21e4ef22005-01-02 09:53:13 +000030294#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030295 int mem_base;
30296 int ret_val;
30297 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30298 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030299
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030300 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30301 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030302 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030303
30304 ret_val = xmlTextReaderNodeType(reader);
30305 desret_int(ret_val);
30306 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030307 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030308 xmlResetLastError();
30309 if (mem_base != xmlMemBlocks()) {
30310 printf("Leak of %d blocks found in xmlTextReaderNodeType",
30311 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030312 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030313 printf(" %d", n_reader);
30314 printf("\n");
30315 }
30316 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030317 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030318#endif
30319
Daniel Veillard42595322004-11-08 10:52:06 +000030320 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030321}
30322
30323
30324static int
30325test_xmlTextReaderNormalization(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030326 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030327
William M. Brack21e4ef22005-01-02 09:53:13 +000030328#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030329 int mem_base;
30330 int ret_val;
30331 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30332 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030333
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030334 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30335 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030336 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030337
30338 ret_val = xmlTextReaderNormalization(reader);
30339 desret_int(ret_val);
30340 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030341 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030342 xmlResetLastError();
30343 if (mem_base != xmlMemBlocks()) {
30344 printf("Leak of %d blocks found in xmlTextReaderNormalization",
30345 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030346 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030347 printf(" %d", n_reader);
30348 printf("\n");
30349 }
30350 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030351 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030352#endif
30353
Daniel Veillard42595322004-11-08 10:52:06 +000030354 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030355}
30356
30357
30358static int
30359test_xmlTextReaderPrefix(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030360 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030361
William M. Brack21e4ef22005-01-02 09:53:13 +000030362#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030363 int mem_base;
30364 xmlChar * ret_val;
30365 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30366 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030367
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030368 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30369 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030370 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030371
30372 ret_val = xmlTextReaderPrefix(reader);
30373 desret_xmlChar_ptr(ret_val);
30374 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030375 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030376 xmlResetLastError();
30377 if (mem_base != xmlMemBlocks()) {
30378 printf("Leak of %d blocks found in xmlTextReaderPrefix",
30379 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030380 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030381 printf(" %d", n_reader);
30382 printf("\n");
30383 }
30384 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030385 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030386#endif
30387
Daniel Veillard42595322004-11-08 10:52:06 +000030388 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030389}
30390
30391
30392static int
30393test_xmlTextReaderPreserve(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030394 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030395
William M. Brack21e4ef22005-01-02 09:53:13 +000030396#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030397 int mem_base;
30398 xmlNodePtr ret_val;
30399 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30400 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030401
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030402 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30403 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030404 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030405
30406 ret_val = xmlTextReaderPreserve(reader);
30407 desret_xmlNodePtr(ret_val);
30408 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030409 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030410 xmlResetLastError();
30411 if (mem_base != xmlMemBlocks()) {
30412 printf("Leak of %d blocks found in xmlTextReaderPreserve",
30413 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030414 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030415 printf(" %d", n_reader);
30416 printf("\n");
30417 }
30418 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030419 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030420#endif
30421
Daniel Veillard42595322004-11-08 10:52:06 +000030422 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030423}
30424
30425
30426static int
30427test_xmlTextReaderPreservePattern(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030428 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030429
William M. Brack21e4ef22005-01-02 09:53:13 +000030430#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_PATTERN_ENABLED)
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030431#ifdef LIBXML_PATTERN_ENABLED
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030432 int mem_base;
30433 int ret_val;
30434 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30435 int n_reader;
30436 xmlChar * pattern; /* an XPath subset pattern */
30437 int n_pattern;
30438 xmlChar ** namespaces; /* the prefix definitions, array of [URI, prefix] or NULL */
30439 int n_namespaces;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030440
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030441 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30442 for (n_pattern = 0;n_pattern < gen_nb_const_xmlChar_ptr;n_pattern++) {
30443 for (n_namespaces = 0;n_namespaces < gen_nb_const_xmlChar_ptr_ptr;n_namespaces++) {
30444 mem_base = xmlMemBlocks();
30445 reader = gen_xmlTextReaderPtr(n_reader, 0);
30446 pattern = gen_const_xmlChar_ptr(n_pattern, 1);
30447 namespaces = gen_const_xmlChar_ptr_ptr(n_namespaces, 2);
30448
William M. Brackf13f77f2004-11-12 16:03:48 +000030449 ret_val = xmlTextReaderPreservePattern(reader, (const xmlChar *)pattern, (const xmlChar **)namespaces);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030450 desret_int(ret_val);
30451 call_tests++;
30452 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000030453 des_const_xmlChar_ptr(n_pattern, (const xmlChar *)pattern, 1);
30454 des_const_xmlChar_ptr_ptr(n_namespaces, (const xmlChar **)namespaces, 2);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030455 xmlResetLastError();
30456 if (mem_base != xmlMemBlocks()) {
30457 printf("Leak of %d blocks found in xmlTextReaderPreservePattern",
30458 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030459 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000030460 printf(" %d", n_reader);
30461 printf(" %d", n_pattern);
30462 printf(" %d", n_namespaces);
30463 printf("\n");
30464 }
30465 }
30466 }
30467 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030468 function_tests++;
30469#endif
Daniel Veillardd5cc0f72004-11-06 19:24:28 +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_xmlTextReaderQuoteChar(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 = xmlTextReaderQuoteChar(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 xmlTextReaderQuoteChar",
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_xmlTextReaderRead(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 = xmlTextReaderRead(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 xmlTextReaderRead",
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_xmlTextReaderReadAttributeValue(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 int 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 Veillardd93f6252004-11-02 15:53:51 +000030557
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030558 ret_val = xmlTextReaderReadAttributeValue(reader);
30559 desret_int(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 xmlTextReaderReadAttributeValue",
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
Daniel Veillardd93f6252004-11-02 15:53:51 +000030573
Daniel Veillard42595322004-11-08 10:52:06 +000030574 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030575}
30576
30577
30578static int
30579test_xmlTextReaderReadState(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 int 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 Veillardd93f6252004-11-02 15:53:51 +000030591
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030592 ret_val = xmlTextReaderReadState(reader);
30593 desret_int(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 xmlTextReaderReadState",
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
Daniel Veillardd93f6252004-11-02 15:53:51 +000030607
Daniel Veillard42595322004-11-08 10:52:06 +000030608 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030609}
30610
30611
30612static int
30613test_xmlTextReaderRelaxNGSetSchema(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_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000030617 int mem_base;
30618 int ret_val;
30619 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30620 int n_reader;
30621 xmlRelaxNGPtr schema; /* a precompiled RelaxNG schema */
30622 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030623
Daniel Veillardce682bc2004-11-05 17:22:25 +000030624 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30625 for (n_schema = 0;n_schema < gen_nb_xmlRelaxNGPtr;n_schema++) {
30626 mem_base = xmlMemBlocks();
30627 reader = gen_xmlTextReaderPtr(n_reader, 0);
30628 schema = gen_xmlRelaxNGPtr(n_schema, 1);
30629
30630 ret_val = xmlTextReaderRelaxNGSetSchema(reader, schema);
30631 desret_int(ret_val);
30632 call_tests++;
30633 des_xmlTextReaderPtr(n_reader, reader, 0);
30634 des_xmlRelaxNGPtr(n_schema, schema, 1);
30635 xmlResetLastError();
30636 if (mem_base != xmlMemBlocks()) {
30637 printf("Leak of %d blocks found in xmlTextReaderRelaxNGSetSchema",
30638 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030639 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030640 printf(" %d", n_reader);
30641 printf(" %d", n_schema);
30642 printf("\n");
30643 }
30644 }
30645 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030646 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030647#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000030648
Daniel Veillard42595322004-11-08 10:52:06 +000030649 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030650}
30651
30652
30653static int
30654test_xmlTextReaderRelaxNGValidate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030655 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030656
William M. Brack21e4ef22005-01-02 09:53:13 +000030657#if defined(LIBXML_READER_ENABLED) && defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030658 int mem_base;
30659 int ret_val;
30660 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30661 int n_reader;
Daniel Veillardce682bc2004-11-05 17:22:25 +000030662 char * rng; /* the path to a RelaxNG schema or NULL */
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030663 int n_rng;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030664
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030665 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30666 for (n_rng = 0;n_rng < gen_nb_const_char_ptr;n_rng++) {
30667 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030668 reader = gen_xmlTextReaderPtr(n_reader, 0);
30669 rng = gen_const_char_ptr(n_rng, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030670
William M. Brackf13f77f2004-11-12 16:03:48 +000030671 ret_val = xmlTextReaderRelaxNGValidate(reader, (const char *)rng);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030672 desret_int(ret_val);
30673 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030674 des_xmlTextReaderPtr(n_reader, reader, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000030675 des_const_char_ptr(n_rng, (const char *)rng, 1);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030676 xmlResetLastError();
30677 if (mem_base != xmlMemBlocks()) {
30678 printf("Leak of %d blocks found in xmlTextReaderRelaxNGValidate",
30679 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030680 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030681 printf(" %d", n_reader);
30682 printf(" %d", n_rng);
30683 printf("\n");
30684 }
30685 }
30686 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030687 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030688#endif
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030689
Daniel Veillard42595322004-11-08 10:52:06 +000030690 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030691}
30692
30693
30694static int
30695test_xmlTextReaderSetErrorHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030696 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030697
30698
30699 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000030700 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030701}
30702
30703
30704static int
30705test_xmlTextReaderSetParserProp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030706 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030707
William M. Brack21e4ef22005-01-02 09:53:13 +000030708#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030709 int mem_base;
30710 int ret_val;
30711 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30712 int n_reader;
30713 int prop; /* the xmlParserProperties to set */
30714 int n_prop;
30715 int value; /* usually 0 or 1 to (de)activate it */
30716 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030717
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030718 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30719 for (n_prop = 0;n_prop < gen_nb_int;n_prop++) {
30720 for (n_value = 0;n_value < gen_nb_int;n_value++) {
30721 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030722 reader = gen_xmlTextReaderPtr(n_reader, 0);
30723 prop = gen_int(n_prop, 1);
30724 value = gen_int(n_value, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030725
30726 ret_val = xmlTextReaderSetParserProp(reader, prop, value);
30727 desret_int(ret_val);
30728 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030729 des_xmlTextReaderPtr(n_reader, reader, 0);
30730 des_int(n_prop, prop, 1);
30731 des_int(n_value, value, 2);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030732 xmlResetLastError();
30733 if (mem_base != xmlMemBlocks()) {
30734 printf("Leak of %d blocks found in xmlTextReaderSetParserProp",
30735 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030736 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030737 printf(" %d", n_reader);
30738 printf(" %d", n_prop);
30739 printf(" %d", n_value);
30740 printf("\n");
30741 }
30742 }
30743 }
30744 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030745 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030746#endif
30747
Daniel Veillard42595322004-11-08 10:52:06 +000030748 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030749}
30750
30751
30752static int
30753test_xmlTextReaderSetStructuredErrorHandler(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030754 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030755
30756
30757 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000030758 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030759}
30760
30761
30762static int
30763test_xmlTextReaderStandalone(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030764 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030765
William M. Brack21e4ef22005-01-02 09:53:13 +000030766#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030767 int mem_base;
30768 int ret_val;
30769 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30770 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030771
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030772 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30773 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030774 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030775
30776 ret_val = xmlTextReaderStandalone(reader);
30777 desret_int(ret_val);
30778 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030779 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030780 xmlResetLastError();
30781 if (mem_base != xmlMemBlocks()) {
30782 printf("Leak of %d blocks found in xmlTextReaderStandalone",
30783 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030784 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030785 printf(" %d", n_reader);
30786 printf("\n");
30787 }
30788 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030789 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030790#endif
30791
Daniel Veillard42595322004-11-08 10:52:06 +000030792 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030793}
30794
30795
30796static int
30797test_xmlTextReaderValue(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030798 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030799
William M. Brack21e4ef22005-01-02 09:53:13 +000030800#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030801 int mem_base;
30802 xmlChar * ret_val;
30803 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30804 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030805
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030806 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30807 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030808 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030809
30810 ret_val = xmlTextReaderValue(reader);
30811 desret_xmlChar_ptr(ret_val);
30812 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030813 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030814 xmlResetLastError();
30815 if (mem_base != xmlMemBlocks()) {
30816 printf("Leak of %d blocks found in xmlTextReaderValue",
30817 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030818 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030819 printf(" %d", n_reader);
30820 printf("\n");
30821 }
30822 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030823 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030824#endif
30825
Daniel Veillard42595322004-11-08 10:52:06 +000030826 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030827}
30828
30829
30830static int
30831test_xmlTextReaderXmlLang(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030832 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030833
William M. Brack21e4ef22005-01-02 09:53:13 +000030834#if defined(LIBXML_READER_ENABLED)
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030835 int mem_base;
30836 xmlChar * ret_val;
30837 xmlTextReaderPtr reader; /* the xmlTextReaderPtr used */
30838 int n_reader;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030839
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030840 for (n_reader = 0;n_reader < gen_nb_xmlTextReaderPtr;n_reader++) {
30841 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000030842 reader = gen_xmlTextReaderPtr(n_reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030843
30844 ret_val = xmlTextReaderXmlLang(reader);
30845 desret_xmlChar_ptr(ret_val);
30846 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000030847 des_xmlTextReaderPtr(n_reader, reader, 0);
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030848 xmlResetLastError();
30849 if (mem_base != xmlMemBlocks()) {
30850 printf("Leak of %d blocks found in xmlTextReaderXmlLang",
30851 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000030852 test_ret++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030853 printf(" %d", n_reader);
30854 printf("\n");
30855 }
30856 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030857 function_tests++;
Daniel Veillarddd6d3002004-11-03 14:20:29 +000030858#endif
30859
Daniel Veillard42595322004-11-08 10:52:06 +000030860 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030861}
30862
30863static int
30864test_xmlreader(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000030865 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000030866
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030867 if (quiet == 0) printf("Testing xmlreader : 68 of 78 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000030868 test_ret += test_xmlNewTextReader();
30869 test_ret += test_xmlNewTextReaderFilename();
30870 test_ret += test_xmlReaderForDoc();
30871 test_ret += test_xmlReaderForFile();
30872 test_ret += test_xmlReaderForMemory();
30873 test_ret += test_xmlReaderNewDoc();
30874 test_ret += test_xmlReaderNewFile();
30875 test_ret += test_xmlReaderNewMemory();
30876 test_ret += test_xmlReaderNewWalker();
30877 test_ret += test_xmlReaderWalker();
30878 test_ret += test_xmlTextReaderAttributeCount();
30879 test_ret += test_xmlTextReaderBaseUri();
30880 test_ret += test_xmlTextReaderClose();
30881 test_ret += test_xmlTextReaderConstBaseUri();
30882 test_ret += test_xmlTextReaderConstEncoding();
30883 test_ret += test_xmlTextReaderConstLocalName();
30884 test_ret += test_xmlTextReaderConstName();
30885 test_ret += test_xmlTextReaderConstNamespaceUri();
30886 test_ret += test_xmlTextReaderConstPrefix();
30887 test_ret += test_xmlTextReaderConstString();
30888 test_ret += test_xmlTextReaderConstValue();
30889 test_ret += test_xmlTextReaderConstXmlLang();
30890 test_ret += test_xmlTextReaderConstXmlVersion();
30891 test_ret += test_xmlTextReaderCurrentDoc();
30892 test_ret += test_xmlTextReaderCurrentNode();
30893 test_ret += test_xmlTextReaderDepth();
30894 test_ret += test_xmlTextReaderExpand();
30895 test_ret += test_xmlTextReaderGetAttribute();
30896 test_ret += test_xmlTextReaderGetAttributeNo();
30897 test_ret += test_xmlTextReaderGetAttributeNs();
30898 test_ret += test_xmlTextReaderGetErrorHandler();
30899 test_ret += test_xmlTextReaderGetParserProp();
30900 test_ret += test_xmlTextReaderGetRemainder();
30901 test_ret += test_xmlTextReaderHasAttributes();
30902 test_ret += test_xmlTextReaderHasValue();
30903 test_ret += test_xmlTextReaderIsDefault();
30904 test_ret += test_xmlTextReaderIsEmptyElement();
30905 test_ret += test_xmlTextReaderIsNamespaceDecl();
30906 test_ret += test_xmlTextReaderIsValid();
30907 test_ret += test_xmlTextReaderLocalName();
30908 test_ret += test_xmlTextReaderLocatorBaseURI();
30909 test_ret += test_xmlTextReaderLocatorLineNumber();
30910 test_ret += test_xmlTextReaderLookupNamespace();
30911 test_ret += test_xmlTextReaderMoveToAttribute();
30912 test_ret += test_xmlTextReaderMoveToAttributeNo();
30913 test_ret += test_xmlTextReaderMoveToAttributeNs();
30914 test_ret += test_xmlTextReaderMoveToElement();
30915 test_ret += test_xmlTextReaderMoveToFirstAttribute();
30916 test_ret += test_xmlTextReaderMoveToNextAttribute();
30917 test_ret += test_xmlTextReaderName();
30918 test_ret += test_xmlTextReaderNamespaceUri();
30919 test_ret += test_xmlTextReaderNext();
30920 test_ret += test_xmlTextReaderNextSibling();
30921 test_ret += test_xmlTextReaderNodeType();
30922 test_ret += test_xmlTextReaderNormalization();
30923 test_ret += test_xmlTextReaderPrefix();
30924 test_ret += test_xmlTextReaderPreserve();
30925 test_ret += test_xmlTextReaderPreservePattern();
30926 test_ret += test_xmlTextReaderQuoteChar();
30927 test_ret += test_xmlTextReaderRead();
30928 test_ret += test_xmlTextReaderReadAttributeValue();
30929 test_ret += test_xmlTextReaderReadState();
30930 test_ret += test_xmlTextReaderRelaxNGSetSchema();
30931 test_ret += test_xmlTextReaderRelaxNGValidate();
30932 test_ret += test_xmlTextReaderSetErrorHandler();
30933 test_ret += test_xmlTextReaderSetParserProp();
30934 test_ret += test_xmlTextReaderSetStructuredErrorHandler();
30935 test_ret += test_xmlTextReaderStandalone();
30936 test_ret += test_xmlTextReaderValue();
30937 test_ret += test_xmlTextReaderXmlLang();
Daniel Veillardd93f6252004-11-02 15:53:51 +000030938
Daniel Veillard42595322004-11-08 10:52:06 +000030939 if (test_ret != 0)
30940 printf("Module xmlreader: %d errors\n", test_ret);
30941 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000030942}
Daniel Veillarda521d282004-11-09 14:59:59 +000030943#ifdef LIBXML_REGEXP_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000030944
Daniel Veillarda82b1822004-11-08 16:24:57 +000030945#define gen_nb_xmlRegExecCtxtPtr 1
30946static xmlRegExecCtxtPtr gen_xmlRegExecCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
30947 return(NULL);
30948}
30949static void des_xmlRegExecCtxtPtr(int no ATTRIBUTE_UNUSED, xmlRegExecCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
30950}
Daniel Veillarda521d282004-11-09 14:59:59 +000030951#endif
30952
Daniel Veillarda82b1822004-11-08 16:24:57 +000030953
30954static int
30955test_xmlRegExecPushString(void) {
30956 int test_ret = 0;
30957
William M. Brack21e4ef22005-01-02 09:53:13 +000030958#if defined(LIBXML_REGEXP_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000030959 int mem_base;
30960 int ret_val;
30961 xmlRegExecCtxtPtr exec; /* a regexp execution context or NULL to indicate the end */
30962 int n_exec;
30963 xmlChar * value; /* a string token input */
30964 int n_value;
30965 void * data; /* data associated to the token to reuse in callbacks */
30966 int n_data;
30967
30968 for (n_exec = 0;n_exec < gen_nb_xmlRegExecCtxtPtr;n_exec++) {
30969 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
30970 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
30971 mem_base = xmlMemBlocks();
30972 exec = gen_xmlRegExecCtxtPtr(n_exec, 0);
30973 value = gen_const_xmlChar_ptr(n_value, 1);
30974 data = gen_userdata(n_data, 2);
30975
William M. Brackf13f77f2004-11-12 16:03:48 +000030976 ret_val = xmlRegExecPushString(exec, (const xmlChar *)value, data);
Daniel Veillarda82b1822004-11-08 16:24:57 +000030977 desret_int(ret_val);
30978 call_tests++;
30979 des_xmlRegExecCtxtPtr(n_exec, exec, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000030980 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000030981 des_userdata(n_data, data, 2);
30982 xmlResetLastError();
30983 if (mem_base != xmlMemBlocks()) {
30984 printf("Leak of %d blocks found in xmlRegExecPushString",
30985 xmlMemBlocks() - mem_base);
30986 test_ret++;
30987 printf(" %d", n_exec);
30988 printf(" %d", n_value);
30989 printf(" %d", n_data);
30990 printf("\n");
30991 }
30992 }
30993 }
30994 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000030995 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000030996#endif
30997
Daniel Veillarda82b1822004-11-08 16:24:57 +000030998 return(test_ret);
30999}
31000
31001
31002static int
31003test_xmlRegExecPushString2(void) {
31004 int test_ret = 0;
31005
William M. Brack21e4ef22005-01-02 09:53:13 +000031006#if defined(LIBXML_REGEXP_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000031007 int mem_base;
31008 int ret_val;
31009 xmlRegExecCtxtPtr exec; /* a regexp execution context or NULL to indicate the end */
31010 int n_exec;
31011 xmlChar * value; /* the first string token input */
31012 int n_value;
31013 xmlChar * value2; /* the second string token input */
31014 int n_value2;
31015 void * data; /* data associated to the token to reuse in callbacks */
31016 int n_data;
31017
31018 for (n_exec = 0;n_exec < gen_nb_xmlRegExecCtxtPtr;n_exec++) {
31019 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
31020 for (n_value2 = 0;n_value2 < gen_nb_const_xmlChar_ptr;n_value2++) {
31021 for (n_data = 0;n_data < gen_nb_userdata;n_data++) {
31022 mem_base = xmlMemBlocks();
31023 exec = gen_xmlRegExecCtxtPtr(n_exec, 0);
31024 value = gen_const_xmlChar_ptr(n_value, 1);
31025 value2 = gen_const_xmlChar_ptr(n_value2, 2);
31026 data = gen_userdata(n_data, 3);
31027
William M. Brackf13f77f2004-11-12 16:03:48 +000031028 ret_val = xmlRegExecPushString2(exec, (const xmlChar *)value, (const xmlChar *)value2, data);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031029 desret_int(ret_val);
31030 call_tests++;
31031 des_xmlRegExecCtxtPtr(n_exec, exec, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000031032 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
31033 des_const_xmlChar_ptr(n_value2, (const xmlChar *)value2, 2);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031034 des_userdata(n_data, data, 3);
31035 xmlResetLastError();
31036 if (mem_base != xmlMemBlocks()) {
31037 printf("Leak of %d blocks found in xmlRegExecPushString2",
31038 xmlMemBlocks() - mem_base);
31039 test_ret++;
31040 printf(" %d", n_exec);
31041 printf(" %d", n_value);
31042 printf(" %d", n_value2);
31043 printf(" %d", n_data);
31044 printf("\n");
31045 }
31046 }
31047 }
31048 }
31049 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031050 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031051#endif
31052
Daniel Veillarda82b1822004-11-08 16:24:57 +000031053 return(test_ret);
31054}
31055
Daniel Veillarda521d282004-11-09 14:59:59 +000031056#ifdef LIBXML_REGEXP_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +000031057
31058#define gen_nb_xmlRegexpPtr 1
31059static xmlRegexpPtr gen_xmlRegexpPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31060 return(NULL);
31061}
31062static void des_xmlRegexpPtr(int no ATTRIBUTE_UNUSED, xmlRegexpPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31063}
Daniel Veillarda521d282004-11-09 14:59:59 +000031064#endif
31065
Daniel Veillarda82b1822004-11-08 16:24:57 +000031066
31067static int
31068test_xmlRegNewExecCtxt(void) {
31069 int test_ret = 0;
31070
31071
31072 /* missing type support */
31073 return(test_ret);
31074}
31075
31076
31077static int
31078test_xmlRegexpCompile(void) {
31079 int test_ret = 0;
31080
31081
31082 /* missing type support */
31083 return(test_ret);
31084}
31085
31086
31087static int
31088test_xmlRegexpExec(void) {
31089 int test_ret = 0;
31090
William M. Brack21e4ef22005-01-02 09:53:13 +000031091#if defined(LIBXML_REGEXP_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000031092 int mem_base;
31093 int ret_val;
31094 xmlRegexpPtr comp; /* the compiled regular expression */
31095 int n_comp;
31096 xmlChar * content; /* the value to check against the regular expression */
31097 int n_content;
31098
31099 for (n_comp = 0;n_comp < gen_nb_xmlRegexpPtr;n_comp++) {
31100 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
31101 mem_base = xmlMemBlocks();
31102 comp = gen_xmlRegexpPtr(n_comp, 0);
31103 content = gen_const_xmlChar_ptr(n_content, 1);
31104
William M. Brackf13f77f2004-11-12 16:03:48 +000031105 ret_val = xmlRegexpExec(comp, (const xmlChar *)content);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031106 desret_int(ret_val);
31107 call_tests++;
31108 des_xmlRegexpPtr(n_comp, comp, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000031109 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000031110 xmlResetLastError();
31111 if (mem_base != xmlMemBlocks()) {
31112 printf("Leak of %d blocks found in xmlRegexpExec",
31113 xmlMemBlocks() - mem_base);
31114 test_ret++;
31115 printf(" %d", n_comp);
31116 printf(" %d", n_content);
31117 printf("\n");
31118 }
31119 }
31120 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031121 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031122#endif
31123
Daniel Veillarda82b1822004-11-08 16:24:57 +000031124 return(test_ret);
31125}
31126
31127
31128static int
31129test_xmlRegexpIsDeterminist(void) {
31130 int test_ret = 0;
31131
William M. Brack21e4ef22005-01-02 09:53:13 +000031132#if defined(LIBXML_REGEXP_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000031133 int mem_base;
31134 int ret_val;
31135 xmlRegexpPtr comp; /* the compiled regular expression */
31136 int n_comp;
31137
31138 for (n_comp = 0;n_comp < gen_nb_xmlRegexpPtr;n_comp++) {
31139 mem_base = xmlMemBlocks();
31140 comp = gen_xmlRegexpPtr(n_comp, 0);
31141
31142 ret_val = xmlRegexpIsDeterminist(comp);
31143 desret_int(ret_val);
31144 call_tests++;
31145 des_xmlRegexpPtr(n_comp, comp, 0);
31146 xmlResetLastError();
31147 if (mem_base != xmlMemBlocks()) {
31148 printf("Leak of %d blocks found in xmlRegexpIsDeterminist",
31149 xmlMemBlocks() - mem_base);
31150 test_ret++;
31151 printf(" %d", n_comp);
31152 printf("\n");
31153 }
31154 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031155 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031156#endif
31157
Daniel Veillarda82b1822004-11-08 16:24:57 +000031158 return(test_ret);
31159}
31160
31161
31162static int
31163test_xmlRegexpPrint(void) {
31164 int test_ret = 0;
31165
William M. Brack21e4ef22005-01-02 09:53:13 +000031166#if defined(LIBXML_REGEXP_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000031167 int mem_base;
31168 FILE * output; /* the file for the output debug */
31169 int n_output;
31170 xmlRegexpPtr regexp; /* the compiled regexp */
31171 int n_regexp;
31172
31173 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
31174 for (n_regexp = 0;n_regexp < gen_nb_xmlRegexpPtr;n_regexp++) {
31175 mem_base = xmlMemBlocks();
31176 output = gen_FILE_ptr(n_output, 0);
31177 regexp = gen_xmlRegexpPtr(n_regexp, 1);
31178
31179 xmlRegexpPrint(output, regexp);
31180 call_tests++;
31181 des_FILE_ptr(n_output, output, 0);
31182 des_xmlRegexpPtr(n_regexp, regexp, 1);
31183 xmlResetLastError();
31184 if (mem_base != xmlMemBlocks()) {
31185 printf("Leak of %d blocks found in xmlRegexpPrint",
31186 xmlMemBlocks() - mem_base);
31187 test_ret++;
31188 printf(" %d", n_output);
31189 printf(" %d", n_regexp);
31190 printf("\n");
31191 }
31192 }
31193 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031194 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000031195#endif
31196
Daniel Veillarda82b1822004-11-08 16:24:57 +000031197 return(test_ret);
31198}
31199
31200static int
31201test_xmlregexp(void) {
31202 int test_ret = 0;
31203
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031204 if (quiet == 0) printf("Testing xmlregexp : 5 of 9 functions ...\n");
Daniel Veillarda82b1822004-11-08 16:24:57 +000031205 test_ret += test_xmlRegExecPushString();
31206 test_ret += test_xmlRegExecPushString2();
31207 test_ret += test_xmlRegNewExecCtxt();
31208 test_ret += test_xmlRegexpCompile();
31209 test_ret += test_xmlRegexpExec();
31210 test_ret += test_xmlRegexpIsDeterminist();
31211 test_ret += test_xmlRegexpPrint();
31212
31213 if (test_ret != 0)
31214 printf("Module xmlregexp: %d errors\n", test_ret);
31215 return(test_ret);
31216}
Daniel Veillarda521d282004-11-09 14:59:59 +000031217#ifdef LIBXML_OUTPUT_ENABLED
Daniel Veillarda82b1822004-11-08 16:24:57 +000031218
Daniel Veillardce682bc2004-11-05 17:22:25 +000031219#define gen_nb_xmlSaveCtxtPtr 1
31220static xmlSaveCtxtPtr gen_xmlSaveCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31221 return(NULL);
31222}
31223static void des_xmlSaveCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSaveCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31224}
Daniel Veillarda521d282004-11-09 14:59:59 +000031225#endif
31226
Daniel Veillardce682bc2004-11-05 17:22:25 +000031227
Daniel Veillardd93f6252004-11-02 15:53:51 +000031228static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000031229test_xmlSaveClose(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031230 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031231
William M. Brack21e4ef22005-01-02 09:53:13 +000031232#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000031233 int mem_base;
31234 int ret_val;
31235 xmlSaveCtxtPtr ctxt; /* a document saving context */
31236 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031237
Daniel Veillardce682bc2004-11-05 17:22:25 +000031238 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
31239 mem_base = xmlMemBlocks();
31240 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
31241
31242 ret_val = xmlSaveClose(ctxt);
31243 desret_int(ret_val);
31244 call_tests++;
31245 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
31246 xmlResetLastError();
31247 if (mem_base != xmlMemBlocks()) {
31248 printf("Leak of %d blocks found in xmlSaveClose",
31249 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031250 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031251 printf(" %d", n_ctxt);
31252 printf("\n");
31253 }
31254 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031255 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031256#endif
31257
Daniel Veillard42595322004-11-08 10:52:06 +000031258 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031259}
31260
31261
31262static int
31263test_xmlSaveDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031264 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031265
William M. Brack21e4ef22005-01-02 09:53:13 +000031266#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000031267 int mem_base;
31268 long ret_val;
31269 xmlSaveCtxtPtr ctxt; /* a document saving context */
31270 int n_ctxt;
31271 xmlDocPtr doc; /* a document */
31272 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031273
Daniel Veillardce682bc2004-11-05 17:22:25 +000031274 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
31275 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
31276 mem_base = xmlMemBlocks();
31277 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
31278 doc = gen_xmlDocPtr(n_doc, 1);
31279
31280 ret_val = xmlSaveDoc(ctxt, doc);
31281 desret_long(ret_val);
31282 call_tests++;
31283 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
31284 des_xmlDocPtr(n_doc, doc, 1);
31285 xmlResetLastError();
31286 if (mem_base != xmlMemBlocks()) {
31287 printf("Leak of %d blocks found in xmlSaveDoc",
31288 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031289 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031290 printf(" %d", n_ctxt);
31291 printf(" %d", n_doc);
31292 printf("\n");
31293 }
31294 }
31295 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031296 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031297#endif
31298
Daniel Veillard42595322004-11-08 10:52:06 +000031299 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031300}
31301
31302
31303static int
31304test_xmlSaveFlush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031305 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031306
William M. Brack21e4ef22005-01-02 09:53:13 +000031307#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000031308 int mem_base;
31309 int ret_val;
31310 xmlSaveCtxtPtr ctxt; /* a document saving context */
31311 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031312
Daniel Veillardce682bc2004-11-05 17:22:25 +000031313 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
31314 mem_base = xmlMemBlocks();
31315 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
31316
31317 ret_val = xmlSaveFlush(ctxt);
31318 desret_int(ret_val);
31319 call_tests++;
31320 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
31321 xmlResetLastError();
31322 if (mem_base != xmlMemBlocks()) {
31323 printf("Leak of %d blocks found in xmlSaveFlush",
31324 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031325 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031326 printf(" %d", n_ctxt);
31327 printf("\n");
31328 }
31329 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031330 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031331#endif
31332
Daniel Veillard42595322004-11-08 10:52:06 +000031333 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031334}
31335
31336
31337static int
31338test_xmlSaveSetAttrEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031339 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031340
31341
31342 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031343 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031344}
31345
31346
31347static int
31348test_xmlSaveSetEscape(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031349 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031350
31351
31352 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031353 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031354}
31355
31356
31357static int
31358test_xmlSaveToFd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031359 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031360
31361
31362 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031363 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031364}
31365
31366
31367static int
31368test_xmlSaveToFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031369 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031370
31371
31372 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031373 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031374}
31375
31376
31377static int
31378test_xmlSaveTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031379 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031380
William M. Brack21e4ef22005-01-02 09:53:13 +000031381#if defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000031382 int mem_base;
31383 long ret_val;
31384 xmlSaveCtxtPtr ctxt; /* a document saving context */
31385 int n_ctxt;
31386 xmlNodePtr node; /* a document */
31387 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031388
Daniel Veillardce682bc2004-11-05 17:22:25 +000031389 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSaveCtxtPtr;n_ctxt++) {
31390 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
31391 mem_base = xmlMemBlocks();
31392 ctxt = gen_xmlSaveCtxtPtr(n_ctxt, 0);
31393 node = gen_xmlNodePtr(n_node, 1);
31394
31395 ret_val = xmlSaveTree(ctxt, node);
31396 desret_long(ret_val);
31397 call_tests++;
31398 des_xmlSaveCtxtPtr(n_ctxt, ctxt, 0);
31399 des_xmlNodePtr(n_node, node, 1);
31400 xmlResetLastError();
31401 if (mem_base != xmlMemBlocks()) {
31402 printf("Leak of %d blocks found in xmlSaveTree",
31403 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031404 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031405 printf(" %d", n_ctxt);
31406 printf(" %d", n_node);
31407 printf("\n");
31408 }
31409 }
31410 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031411 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031412#endif
31413
Daniel Veillard42595322004-11-08 10:52:06 +000031414 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031415}
31416
31417static int
31418test_xmlsave(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031419 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031420
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031421 if (quiet == 0) printf("Testing xmlsave : 4 of 9 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000031422 test_ret += test_xmlSaveClose();
31423 test_ret += test_xmlSaveDoc();
31424 test_ret += test_xmlSaveFlush();
31425 test_ret += test_xmlSaveSetAttrEscape();
31426 test_ret += test_xmlSaveSetEscape();
31427 test_ret += test_xmlSaveToFd();
31428 test_ret += test_xmlSaveToFilename();
31429 test_ret += test_xmlSaveTree();
Daniel Veillardd93f6252004-11-02 15:53:51 +000031430
Daniel Veillard42595322004-11-08 10:52:06 +000031431 if (test_ret != 0)
31432 printf("Module xmlsave: %d errors\n", test_ret);
31433 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031434}
Daniel Veillarda521d282004-11-09 14:59:59 +000031435#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000031436
Daniel Veillardce682bc2004-11-05 17:22:25 +000031437#define gen_nb_xmlSchemaPtr 1
31438static xmlSchemaPtr gen_xmlSchemaPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31439 return(NULL);
31440}
31441static void des_xmlSchemaPtr(int no ATTRIBUTE_UNUSED, xmlSchemaPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31442}
Daniel Veillarda521d282004-11-09 14:59:59 +000031443#endif
31444
Daniel Veillardce682bc2004-11-05 17:22:25 +000031445
Daniel Veillardd93f6252004-11-02 15:53:51 +000031446static int
31447test_xmlSchemaDump(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031448 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031449
William M. Brack21e4ef22005-01-02 09:53:13 +000031450#if defined(LIBXML_SCHEMAS_ENABLED) && defined(LIBXML_OUTPUT_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000031451 int mem_base;
31452 FILE * output; /* the file output */
31453 int n_output;
31454 xmlSchemaPtr schema; /* a schema structure */
31455 int n_schema;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031456
Daniel Veillardce682bc2004-11-05 17:22:25 +000031457 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
31458 for (n_schema = 0;n_schema < gen_nb_xmlSchemaPtr;n_schema++) {
31459 mem_base = xmlMemBlocks();
31460 output = gen_FILE_ptr(n_output, 0);
31461 schema = gen_xmlSchemaPtr(n_schema, 1);
31462
31463 xmlSchemaDump(output, schema);
31464 call_tests++;
31465 des_FILE_ptr(n_output, output, 0);
31466 des_xmlSchemaPtr(n_schema, schema, 1);
31467 xmlResetLastError();
31468 if (mem_base != xmlMemBlocks()) {
31469 printf("Leak of %d blocks found in xmlSchemaDump",
31470 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031471 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031472 printf(" %d", n_output);
31473 printf(" %d", n_schema);
31474 printf("\n");
31475 }
31476 }
31477 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031478 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031479#endif
Daniel Veillardce682bc2004-11-05 17:22:25 +000031480
Daniel Veillard42595322004-11-08 10:52:06 +000031481 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031482}
31483
Daniel Veillarda521d282004-11-09 14:59:59 +000031484#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000031485
Daniel Veillardce682bc2004-11-05 17:22:25 +000031486#define gen_nb_xmlSchemaParserCtxtPtr 1
31487static xmlSchemaParserCtxtPtr gen_xmlSchemaParserCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31488 return(NULL);
31489}
31490static void des_xmlSchemaParserCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSchemaParserCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31491}
Daniel Veillarda521d282004-11-09 14:59:59 +000031492#endif
31493
31494#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000031495
31496#define gen_nb_xmlSchemaValidityErrorFunc_ptr 1
31497static xmlSchemaValidityErrorFunc * gen_xmlSchemaValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31498 return(NULL);
31499}
31500static void des_xmlSchemaValidityErrorFunc_ptr(int no ATTRIBUTE_UNUSED, xmlSchemaValidityErrorFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31501}
Daniel Veillarda521d282004-11-09 14:59:59 +000031502#endif
31503
31504#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000031505
31506#define gen_nb_xmlSchemaValidityWarningFunc_ptr 1
31507static xmlSchemaValidityWarningFunc * gen_xmlSchemaValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31508 return(NULL);
31509}
31510static void des_xmlSchemaValidityWarningFunc_ptr(int no ATTRIBUTE_UNUSED, xmlSchemaValidityWarningFunc * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31511}
Daniel Veillarda521d282004-11-09 14:59:59 +000031512#endif
31513
Daniel Veillardce682bc2004-11-05 17:22:25 +000031514
Daniel Veillardd93f6252004-11-02 15:53:51 +000031515static int
31516test_xmlSchemaGetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031517 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031518
William M. Brack21e4ef22005-01-02 09:53:13 +000031519#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031520 int mem_base;
31521 int ret_val;
31522 xmlSchemaParserCtxtPtr ctxt; /* a XMl-Schema parser context */
31523 int n_ctxt;
31524 xmlSchemaValidityErrorFunc * err; /* the error callback result */
31525 int n_err;
31526 xmlSchemaValidityWarningFunc * warn; /* the warning callback result */
31527 int n_warn;
31528 void ** ctx; /* contextual data for the callbacks result */
31529 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031530
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031531 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaParserCtxtPtr;n_ctxt++) {
31532 for (n_err = 0;n_err < gen_nb_xmlSchemaValidityErrorFunc_ptr;n_err++) {
31533 for (n_warn = 0;n_warn < gen_nb_xmlSchemaValidityWarningFunc_ptr;n_warn++) {
31534 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
31535 mem_base = xmlMemBlocks();
31536 ctxt = gen_xmlSchemaParserCtxtPtr(n_ctxt, 0);
31537 err = gen_xmlSchemaValidityErrorFunc_ptr(n_err, 1);
31538 warn = gen_xmlSchemaValidityWarningFunc_ptr(n_warn, 2);
31539 ctx = gen_void_ptr_ptr(n_ctx, 3);
31540
31541 ret_val = xmlSchemaGetParserErrors(ctxt, err, warn, ctx);
31542 desret_int(ret_val);
31543 call_tests++;
31544 des_xmlSchemaParserCtxtPtr(n_ctxt, ctxt, 0);
31545 des_xmlSchemaValidityErrorFunc_ptr(n_err, err, 1);
31546 des_xmlSchemaValidityWarningFunc_ptr(n_warn, warn, 2);
31547 des_void_ptr_ptr(n_ctx, ctx, 3);
31548 xmlResetLastError();
31549 if (mem_base != xmlMemBlocks()) {
31550 printf("Leak of %d blocks found in xmlSchemaGetParserErrors",
31551 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031552 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031553 printf(" %d", n_ctxt);
31554 printf(" %d", n_err);
31555 printf(" %d", n_warn);
31556 printf(" %d", n_ctx);
31557 printf("\n");
31558 }
31559 }
31560 }
31561 }
31562 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031563 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031564#endif
31565
Daniel Veillard42595322004-11-08 10:52:06 +000031566 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031567}
31568
Daniel Veillarda521d282004-11-09 14:59:59 +000031569#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000031570
Daniel Veillardce682bc2004-11-05 17:22:25 +000031571#define gen_nb_xmlSchemaValidCtxtPtr 1
31572static xmlSchemaValidCtxtPtr gen_xmlSchemaValidCtxtPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31573 return(NULL);
31574}
31575static void des_xmlSchemaValidCtxtPtr(int no ATTRIBUTE_UNUSED, xmlSchemaValidCtxtPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
31576}
Daniel Veillarda521d282004-11-09 14:59:59 +000031577#endif
31578
Daniel Veillardce682bc2004-11-05 17:22:25 +000031579
Daniel Veillardd93f6252004-11-02 15:53:51 +000031580static int
31581test_xmlSchemaGetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031582 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031583
William M. Brack21e4ef22005-01-02 09:53:13 +000031584#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031585 int mem_base;
31586 int ret_val;
31587 xmlSchemaValidCtxtPtr ctxt; /* a XML-Schema validation context */
31588 int n_ctxt;
31589 xmlSchemaValidityErrorFunc * err; /* the error function result */
31590 int n_err;
31591 xmlSchemaValidityWarningFunc * warn; /* the warning function result */
31592 int n_warn;
31593 void ** ctx; /* the functions context result */
31594 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031595
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031596 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
31597 for (n_err = 0;n_err < gen_nb_xmlSchemaValidityErrorFunc_ptr;n_err++) {
31598 for (n_warn = 0;n_warn < gen_nb_xmlSchemaValidityWarningFunc_ptr;n_warn++) {
31599 for (n_ctx = 0;n_ctx < gen_nb_void_ptr_ptr;n_ctx++) {
31600 mem_base = xmlMemBlocks();
31601 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
31602 err = gen_xmlSchemaValidityErrorFunc_ptr(n_err, 1);
31603 warn = gen_xmlSchemaValidityWarningFunc_ptr(n_warn, 2);
31604 ctx = gen_void_ptr_ptr(n_ctx, 3);
31605
31606 ret_val = xmlSchemaGetValidErrors(ctxt, err, warn, ctx);
31607 desret_int(ret_val);
31608 call_tests++;
31609 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
31610 des_xmlSchemaValidityErrorFunc_ptr(n_err, err, 1);
31611 des_xmlSchemaValidityWarningFunc_ptr(n_warn, warn, 2);
31612 des_void_ptr_ptr(n_ctx, ctx, 3);
31613 xmlResetLastError();
31614 if (mem_base != xmlMemBlocks()) {
31615 printf("Leak of %d blocks found in xmlSchemaGetValidErrors",
31616 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031617 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031618 printf(" %d", n_ctxt);
31619 printf(" %d", n_err);
31620 printf(" %d", n_warn);
31621 printf(" %d", n_ctx);
31622 printf("\n");
31623 }
31624 }
31625 }
31626 }
31627 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031628 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000031629#endif
31630
Daniel Veillard42595322004-11-08 10:52:06 +000031631 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031632}
31633
31634
31635static int
31636test_xmlSchemaNewDocParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031637 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031638
William M. Brack21e4ef22005-01-02 09:53:13 +000031639#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000031640 int mem_base;
31641 xmlSchemaParserCtxtPtr ret_val;
31642 xmlDocPtr doc; /* a preparsed document tree */
31643 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031644
Daniel Veillard42595322004-11-08 10:52:06 +000031645 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
31646 mem_base = xmlMemBlocks();
31647 doc = gen_xmlDocPtr(n_doc, 0);
31648
31649 ret_val = xmlSchemaNewDocParserCtxt(doc);
31650 desret_xmlSchemaParserCtxtPtr(ret_val);
31651 call_tests++;
31652 des_xmlDocPtr(n_doc, doc, 0);
31653 xmlResetLastError();
31654 if (mem_base != xmlMemBlocks()) {
31655 printf("Leak of %d blocks found in xmlSchemaNewDocParserCtxt",
31656 xmlMemBlocks() - mem_base);
31657 test_ret++;
31658 printf(" %d", n_doc);
31659 printf("\n");
31660 }
31661 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031662 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031663#endif
31664
Daniel Veillard42595322004-11-08 10:52:06 +000031665 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031666}
31667
31668
31669static int
31670test_xmlSchemaNewMemParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031671 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031672
William M. Brack21e4ef22005-01-02 09:53:13 +000031673#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000031674 int mem_base;
31675 xmlSchemaParserCtxtPtr ret_val;
31676 char * buffer; /* a pointer to a char array containing the schemas */
31677 int n_buffer;
31678 int size; /* the size of the array */
31679 int n_size;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031680
Daniel Veillard42595322004-11-08 10:52:06 +000031681 for (n_buffer = 0;n_buffer < gen_nb_const_char_ptr;n_buffer++) {
31682 for (n_size = 0;n_size < gen_nb_int;n_size++) {
31683 mem_base = xmlMemBlocks();
31684 buffer = gen_const_char_ptr(n_buffer, 0);
31685 size = gen_int(n_size, 1);
31686
William M. Brackf13f77f2004-11-12 16:03:48 +000031687 ret_val = xmlSchemaNewMemParserCtxt((const char *)buffer, size);
Daniel Veillard42595322004-11-08 10:52:06 +000031688 desret_xmlSchemaParserCtxtPtr(ret_val);
31689 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000031690 des_const_char_ptr(n_buffer, (const char *)buffer, 0);
Daniel Veillard42595322004-11-08 10:52:06 +000031691 des_int(n_size, size, 1);
31692 xmlResetLastError();
31693 if (mem_base != xmlMemBlocks()) {
31694 printf("Leak of %d blocks found in xmlSchemaNewMemParserCtxt",
31695 xmlMemBlocks() - mem_base);
31696 test_ret++;
31697 printf(" %d", n_buffer);
31698 printf(" %d", n_size);
31699 printf("\n");
31700 }
31701 }
31702 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031703 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031704#endif
31705
Daniel Veillard42595322004-11-08 10:52:06 +000031706 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031707}
31708
31709
31710static int
31711test_xmlSchemaNewParserCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031712 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031713
William M. Brack21e4ef22005-01-02 09:53:13 +000031714#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000031715 int mem_base;
31716 xmlSchemaParserCtxtPtr ret_val;
31717 char * URL; /* the location of the schema */
31718 int n_URL;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031719
Daniel Veillard42595322004-11-08 10:52:06 +000031720 for (n_URL = 0;n_URL < gen_nb_const_char_ptr;n_URL++) {
31721 mem_base = xmlMemBlocks();
31722 URL = gen_const_char_ptr(n_URL, 0);
31723
William M. Brackf13f77f2004-11-12 16:03:48 +000031724 ret_val = xmlSchemaNewParserCtxt((const char *)URL);
Daniel Veillard42595322004-11-08 10:52:06 +000031725 desret_xmlSchemaParserCtxtPtr(ret_val);
31726 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000031727 des_const_char_ptr(n_URL, (const char *)URL, 0);
Daniel Veillard42595322004-11-08 10:52:06 +000031728 xmlResetLastError();
31729 if (mem_base != xmlMemBlocks()) {
31730 printf("Leak of %d blocks found in xmlSchemaNewParserCtxt",
31731 xmlMemBlocks() - mem_base);
31732 test_ret++;
31733 printf(" %d", n_URL);
31734 printf("\n");
31735 }
31736 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031737 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000031738#endif
31739
Daniel Veillard42595322004-11-08 10:52:06 +000031740 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031741}
31742
31743
31744static int
31745test_xmlSchemaNewValidCtxt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031746 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031747
31748
31749 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031750 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031751}
31752
31753
31754static int
31755test_xmlSchemaParse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031756 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031757
31758
31759 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031760 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031761}
31762
31763
31764static int
31765test_xmlSchemaSetParserErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031766 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031767
31768
31769 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031770 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031771}
31772
31773
31774static int
31775test_xmlSchemaSetValidErrors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031776 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031777
31778
31779 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000031780 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031781}
31782
31783
31784static int
31785test_xmlSchemaSetValidOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031786 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031787
William M. Brack21e4ef22005-01-02 09:53:13 +000031788#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000031789 int mem_base;
31790 int ret_val;
31791 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
31792 int n_ctxt;
31793 int options; /* a combination of xmlSchemaValidOption */
31794 int n_options;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031795
Daniel Veillardce682bc2004-11-05 17:22:25 +000031796 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
31797 for (n_options = 0;n_options < gen_nb_int;n_options++) {
31798 mem_base = xmlMemBlocks();
31799 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
31800 options = gen_int(n_options, 1);
31801
31802 ret_val = xmlSchemaSetValidOptions(ctxt, options);
31803 desret_int(ret_val);
31804 call_tests++;
31805 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
31806 des_int(n_options, options, 1);
31807 xmlResetLastError();
31808 if (mem_base != xmlMemBlocks()) {
31809 printf("Leak of %d blocks found in xmlSchemaSetValidOptions",
31810 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031811 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031812 printf(" %d", n_ctxt);
31813 printf(" %d", n_options);
31814 printf("\n");
31815 }
31816 }
31817 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031818 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031819#endif
31820
Daniel Veillard42595322004-11-08 10:52:06 +000031821 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031822}
31823
31824
31825static int
31826test_xmlSchemaValidCtxtGetOptions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031827 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031828
William M. Brack21e4ef22005-01-02 09:53:13 +000031829#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000031830 int mem_base;
31831 int ret_val;
31832 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
31833 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031834
Daniel Veillardce682bc2004-11-05 17:22:25 +000031835 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
31836 mem_base = xmlMemBlocks();
31837 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
31838
31839 ret_val = xmlSchemaValidCtxtGetOptions(ctxt);
31840 desret_int(ret_val);
31841 call_tests++;
31842 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
31843 xmlResetLastError();
31844 if (mem_base != xmlMemBlocks()) {
31845 printf("Leak of %d blocks found in xmlSchemaValidCtxtGetOptions",
31846 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031847 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031848 printf(" %d", n_ctxt);
31849 printf("\n");
31850 }
31851 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031852 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031853#endif
31854
Daniel Veillard42595322004-11-08 10:52:06 +000031855 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031856}
31857
31858
31859static int
31860test_xmlSchemaValidateDoc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031861 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031862
William M. Brack21e4ef22005-01-02 09:53:13 +000031863#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000031864 int mem_base;
31865 int ret_val;
31866 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
31867 int n_ctxt;
31868 xmlDocPtr doc; /* a parsed document tree */
31869 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031870
Daniel Veillardce682bc2004-11-05 17:22:25 +000031871 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
31872 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
31873 mem_base = xmlMemBlocks();
31874 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
31875 doc = gen_xmlDocPtr(n_doc, 1);
31876
31877 ret_val = xmlSchemaValidateDoc(ctxt, doc);
31878 desret_int(ret_val);
31879 call_tests++;
31880 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
31881 des_xmlDocPtr(n_doc, doc, 1);
31882 xmlResetLastError();
31883 if (mem_base != xmlMemBlocks()) {
31884 printf("Leak of %d blocks found in xmlSchemaValidateDoc",
31885 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031886 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031887 printf(" %d", n_ctxt);
31888 printf(" %d", n_doc);
31889 printf("\n");
31890 }
31891 }
31892 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031893 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031894#endif
31895
Daniel Veillard42595322004-11-08 10:52:06 +000031896 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031897}
31898
31899
31900static int
31901test_xmlSchemaValidateOneElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031902 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031903
William M. Brack21e4ef22005-01-02 09:53:13 +000031904#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000031905 int mem_base;
31906 int ret_val;
31907 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
31908 int n_ctxt;
31909 xmlNodePtr elem; /* an element node */
31910 int n_elem;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031911
Daniel Veillardce682bc2004-11-05 17:22:25 +000031912 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
31913 for (n_elem = 0;n_elem < gen_nb_xmlNodePtr;n_elem++) {
31914 mem_base = xmlMemBlocks();
31915 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
31916 elem = gen_xmlNodePtr(n_elem, 1);
31917
31918 ret_val = xmlSchemaValidateOneElement(ctxt, elem);
31919 desret_int(ret_val);
31920 call_tests++;
31921 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
31922 des_xmlNodePtr(n_elem, elem, 1);
31923 xmlResetLastError();
31924 if (mem_base != xmlMemBlocks()) {
31925 printf("Leak of %d blocks found in xmlSchemaValidateOneElement",
31926 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031927 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031928 printf(" %d", n_ctxt);
31929 printf(" %d", n_elem);
31930 printf("\n");
31931 }
31932 }
31933 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031934 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031935#endif
31936
Daniel Veillard42595322004-11-08 10:52:06 +000031937 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000031938}
31939
31940
31941static int
31942test_xmlSchemaValidateStream(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000031943 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031944
William M. Brack21e4ef22005-01-02 09:53:13 +000031945#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000031946 int mem_base;
31947 int ret_val;
31948 xmlSchemaValidCtxtPtr ctxt; /* a schema validation context */
31949 int n_ctxt;
31950 xmlParserInputBufferPtr input; /* the input to use for reading the data */
31951 int n_input;
31952 xmlCharEncoding enc; /* an optional encoding information */
31953 int n_enc;
31954 xmlSAXHandlerPtr sax; /* a SAX handler for the resulting events */
31955 int n_sax;
31956 void * user_data; /* the context to provide to the SAX handler. */
31957 int n_user_data;
Daniel Veillardd93f6252004-11-02 15:53:51 +000031958
Daniel Veillardce682bc2004-11-05 17:22:25 +000031959 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaValidCtxtPtr;n_ctxt++) {
31960 for (n_input = 0;n_input < gen_nb_xmlParserInputBufferPtr;n_input++) {
31961 for (n_enc = 0;n_enc < gen_nb_xmlCharEncoding;n_enc++) {
31962 for (n_sax = 0;n_sax < gen_nb_xmlSAXHandlerPtr;n_sax++) {
31963 for (n_user_data = 0;n_user_data < gen_nb_userdata;n_user_data++) {
31964 mem_base = xmlMemBlocks();
31965 ctxt = gen_xmlSchemaValidCtxtPtr(n_ctxt, 0);
31966 input = gen_xmlParserInputBufferPtr(n_input, 1);
31967 enc = gen_xmlCharEncoding(n_enc, 2);
31968 sax = gen_xmlSAXHandlerPtr(n_sax, 3);
31969 user_data = gen_userdata(n_user_data, 4);
31970
31971 ret_val = xmlSchemaValidateStream(ctxt, input, enc, sax, user_data);
31972 desret_int(ret_val);
31973 call_tests++;
31974 des_xmlSchemaValidCtxtPtr(n_ctxt, ctxt, 0);
31975 des_xmlParserInputBufferPtr(n_input, input, 1);
31976 des_xmlCharEncoding(n_enc, enc, 2);
31977 des_xmlSAXHandlerPtr(n_sax, sax, 3);
31978 des_userdata(n_user_data, user_data, 4);
31979 xmlResetLastError();
31980 if (mem_base != xmlMemBlocks()) {
31981 printf("Leak of %d blocks found in xmlSchemaValidateStream",
31982 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000031983 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031984 printf(" %d", n_ctxt);
31985 printf(" %d", n_input);
31986 printf(" %d", n_enc);
31987 printf(" %d", n_sax);
31988 printf(" %d", n_user_data);
31989 printf("\n");
31990 }
31991 }
31992 }
31993 }
31994 }
31995 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000031996 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000031997#endif
31998
Daniel Veillard42595322004-11-08 10:52:06 +000031999 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032000}
32001
32002static int
32003test_xmlschemas(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032004 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032005
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032006 if (quiet == 0) printf("Testing xmlschemas : 11 of 18 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000032007 test_ret += test_xmlSchemaDump();
32008 test_ret += test_xmlSchemaGetParserErrors();
32009 test_ret += test_xmlSchemaGetValidErrors();
32010 test_ret += test_xmlSchemaNewDocParserCtxt();
32011 test_ret += test_xmlSchemaNewMemParserCtxt();
32012 test_ret += test_xmlSchemaNewParserCtxt();
32013 test_ret += test_xmlSchemaNewValidCtxt();
32014 test_ret += test_xmlSchemaParse();
32015 test_ret += test_xmlSchemaSetParserErrors();
32016 test_ret += test_xmlSchemaSetValidErrors();
32017 test_ret += test_xmlSchemaSetValidOptions();
32018 test_ret += test_xmlSchemaValidCtxtGetOptions();
32019 test_ret += test_xmlSchemaValidateDoc();
32020 test_ret += test_xmlSchemaValidateOneElement();
32021 test_ret += test_xmlSchemaValidateStream();
Daniel Veillardd93f6252004-11-02 15:53:51 +000032022
Daniel Veillard42595322004-11-08 10:52:06 +000032023 if (test_ret != 0)
32024 printf("Module xmlschemas: %d errors\n", test_ret);
32025 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032026}
Daniel Veillarda521d282004-11-09 14:59:59 +000032027#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000032028
Daniel Veillardce682bc2004-11-05 17:22:25 +000032029#define gen_nb_xmlSchemaFacetPtr 1
32030static xmlSchemaFacetPtr gen_xmlSchemaFacetPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32031 return(NULL);
32032}
32033static void des_xmlSchemaFacetPtr(int no ATTRIBUTE_UNUSED, xmlSchemaFacetPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32034}
Daniel Veillarda521d282004-11-09 14:59:59 +000032035#endif
32036
32037#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000032038
32039#define gen_nb_xmlSchemaTypePtr 1
32040static xmlSchemaTypePtr gen_xmlSchemaTypePtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32041 return(NULL);
32042}
32043static void des_xmlSchemaTypePtr(int no ATTRIBUTE_UNUSED, xmlSchemaTypePtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32044}
Daniel Veillarda521d282004-11-09 14:59:59 +000032045#endif
32046
Daniel Veillardce682bc2004-11-05 17:22:25 +000032047
Daniel Veillardd93f6252004-11-02 15:53:51 +000032048static int
32049test_xmlSchemaCheckFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032050 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032051
William M. Brack21e4ef22005-01-02 09:53:13 +000032052#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032053 int mem_base;
32054 int ret_val;
32055 xmlSchemaFacetPtr facet; /* the facet */
32056 int n_facet;
32057 xmlSchemaTypePtr typeDecl; /* the schema type definition */
32058 int n_typeDecl;
32059 xmlSchemaParserCtxtPtr ctxt; /* the schema parser context or NULL */
32060 int n_ctxt;
32061 xmlChar * name; /* name of the type */
32062 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032063
Daniel Veillardce682bc2004-11-05 17:22:25 +000032064 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
32065 for (n_typeDecl = 0;n_typeDecl < gen_nb_xmlSchemaTypePtr;n_typeDecl++) {
32066 for (n_ctxt = 0;n_ctxt < gen_nb_xmlSchemaParserCtxtPtr;n_ctxt++) {
32067 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
32068 mem_base = xmlMemBlocks();
32069 facet = gen_xmlSchemaFacetPtr(n_facet, 0);
32070 typeDecl = gen_xmlSchemaTypePtr(n_typeDecl, 1);
32071 ctxt = gen_xmlSchemaParserCtxtPtr(n_ctxt, 2);
32072 name = gen_const_xmlChar_ptr(n_name, 3);
32073
William M. Brackf13f77f2004-11-12 16:03:48 +000032074 ret_val = xmlSchemaCheckFacet(facet, typeDecl, ctxt, (const xmlChar *)name);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032075 desret_int(ret_val);
32076 call_tests++;
32077 des_xmlSchemaFacetPtr(n_facet, facet, 0);
32078 des_xmlSchemaTypePtr(n_typeDecl, typeDecl, 1);
32079 des_xmlSchemaParserCtxtPtr(n_ctxt, ctxt, 2);
William M. Brackf13f77f2004-11-12 16:03:48 +000032080 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 3);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032081 xmlResetLastError();
32082 if (mem_base != xmlMemBlocks()) {
32083 printf("Leak of %d blocks found in xmlSchemaCheckFacet",
32084 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032085 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032086 printf(" %d", n_facet);
32087 printf(" %d", n_typeDecl);
32088 printf(" %d", n_ctxt);
32089 printf(" %d", n_name);
32090 printf("\n");
32091 }
32092 }
32093 }
32094 }
32095 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032096 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032097#endif
32098
Daniel Veillard42595322004-11-08 10:52:06 +000032099 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032100}
32101
32102
32103static int
32104test_xmlSchemaCleanupTypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032105 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032106
William M. Brack21e4ef22005-01-02 09:53:13 +000032107#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000032108 int mem_base;
32109
32110 mem_base = xmlMemBlocks();
32111
32112 xmlSchemaCleanupTypes();
32113 call_tests++;
32114 xmlResetLastError();
32115 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000032116 printf("Leak of %d blocks found in xmlSchemaCleanupTypes",
Daniel Veillardd93f6252004-11-02 15:53:51 +000032117 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032118 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000032119 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000032120 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032121 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032122#endif
32123
Daniel Veillard42595322004-11-08 10:52:06 +000032124 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032125}
32126
32127
32128static int
32129test_xmlSchemaCollapseString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032130 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032131
William M. Brack21e4ef22005-01-02 09:53:13 +000032132#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032133 int mem_base;
32134 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032135 xmlChar * value; /* a value */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032136 int n_value;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032137
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032138 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32139 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000032140 value = gen_const_xmlChar_ptr(n_value, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032141
William M. Brackf13f77f2004-11-12 16:03:48 +000032142 ret_val = xmlSchemaCollapseString((const xmlChar *)value);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032143 desret_xmlChar_ptr(ret_val);
32144 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000032145 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032146 xmlResetLastError();
32147 if (mem_base != xmlMemBlocks()) {
32148 printf("Leak of %d blocks found in xmlSchemaCollapseString",
32149 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032150 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032151 printf(" %d", n_value);
32152 printf("\n");
32153 }
32154 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032155 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032156#endif
32157
Daniel Veillard42595322004-11-08 10:52:06 +000032158 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032159}
32160
Daniel Veillarda521d282004-11-09 14:59:59 +000032161#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000032162
Daniel Veillardce682bc2004-11-05 17:22:25 +000032163#define gen_nb_xmlSchemaValPtr 1
32164static xmlSchemaValPtr gen_xmlSchemaValPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32165 return(NULL);
32166}
32167static void des_xmlSchemaValPtr(int no ATTRIBUTE_UNUSED, xmlSchemaValPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32168}
Daniel Veillarda521d282004-11-09 14:59:59 +000032169#endif
32170
Daniel Veillardce682bc2004-11-05 17:22:25 +000032171
Daniel Veillardd93f6252004-11-02 15:53:51 +000032172static int
32173test_xmlSchemaCompareValues(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032174 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032175
William M. Brack21e4ef22005-01-02 09:53:13 +000032176#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032177 int mem_base;
32178 int ret_val;
32179 xmlSchemaValPtr x; /* a first value */
32180 int n_x;
32181 xmlSchemaValPtr y; /* a second value */
32182 int n_y;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032183
Daniel Veillardce682bc2004-11-05 17:22:25 +000032184 for (n_x = 0;n_x < gen_nb_xmlSchemaValPtr;n_x++) {
32185 for (n_y = 0;n_y < gen_nb_xmlSchemaValPtr;n_y++) {
32186 mem_base = xmlMemBlocks();
32187 x = gen_xmlSchemaValPtr(n_x, 0);
32188 y = gen_xmlSchemaValPtr(n_y, 1);
32189
32190 ret_val = xmlSchemaCompareValues(x, y);
32191 desret_int(ret_val);
32192 call_tests++;
32193 des_xmlSchemaValPtr(n_x, x, 0);
32194 des_xmlSchemaValPtr(n_y, y, 1);
32195 xmlResetLastError();
32196 if (mem_base != xmlMemBlocks()) {
32197 printf("Leak of %d blocks found in xmlSchemaCompareValues",
32198 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032199 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032200 printf(" %d", n_x);
32201 printf(" %d", n_y);
32202 printf("\n");
32203 }
32204 }
32205 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032206 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032207#endif
32208
Daniel Veillard42595322004-11-08 10:52:06 +000032209 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032210}
32211
32212
32213static int
32214test_xmlSchemaGetBuiltInListSimpleTypeItemType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032215 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032216
William M. Brack21e4ef22005-01-02 09:53:13 +000032217#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000032218 int mem_base;
32219 xmlSchemaTypePtr ret_val;
32220 xmlSchemaTypePtr type; /* the built-in simple type. */
32221 int n_type;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032222
Daniel Veillard42595322004-11-08 10:52:06 +000032223 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32224 mem_base = xmlMemBlocks();
32225 type = gen_xmlSchemaTypePtr(n_type, 0);
32226
32227 ret_val = xmlSchemaGetBuiltInListSimpleTypeItemType(type);
32228 desret_xmlSchemaTypePtr(ret_val);
32229 call_tests++;
32230 des_xmlSchemaTypePtr(n_type, type, 0);
32231 xmlResetLastError();
32232 if (mem_base != xmlMemBlocks()) {
32233 printf("Leak of %d blocks found in xmlSchemaGetBuiltInListSimpleTypeItemType",
32234 xmlMemBlocks() - mem_base);
32235 test_ret++;
32236 printf(" %d", n_type);
32237 printf("\n");
32238 }
32239 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032240 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032241#endif
32242
Daniel Veillard42595322004-11-08 10:52:06 +000032243 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032244}
32245
32246
32247static int
32248test_xmlSchemaGetBuiltInType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032249 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032250
William M. Brack21e4ef22005-01-02 09:53:13 +000032251#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000032252 xmlSchemaTypePtr ret_val;
32253 xmlSchemaValType type; /* the type of the built in type */
32254 int n_type;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032255
Daniel Veillard42595322004-11-08 10:52:06 +000032256 for (n_type = 0;n_type < gen_nb_xmlSchemaValType;n_type++) {
32257 type = gen_xmlSchemaValType(n_type, 0);
32258
32259 ret_val = xmlSchemaGetBuiltInType(type);
32260 desret_xmlSchemaTypePtr(ret_val);
32261 call_tests++;
32262 des_xmlSchemaValType(n_type, type, 0);
32263 xmlResetLastError();
32264 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032265 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032266#endif
32267
Daniel Veillard42595322004-11-08 10:52:06 +000032268 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032269}
32270
32271
32272static int
32273test_xmlSchemaGetFacetValueAsULong(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032274 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032275
William M. Brack21e4ef22005-01-02 09:53:13 +000032276#if defined(LIBXML_SCHEMAS_ENABLED)
William M. Brack094dd862004-11-14 14:28:34 +000032277 int mem_base;
32278 unsigned long ret_val;
32279 xmlSchemaFacetPtr facet; /* an schemas type facet */
32280 int n_facet;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032281
William M. Brack094dd862004-11-14 14:28:34 +000032282 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
32283 mem_base = xmlMemBlocks();
32284 facet = gen_xmlSchemaFacetPtr(n_facet, 0);
32285
32286 ret_val = xmlSchemaGetFacetValueAsULong(facet);
32287 desret_unsigned_long(ret_val);
32288 call_tests++;
32289 des_xmlSchemaFacetPtr(n_facet, facet, 0);
32290 xmlResetLastError();
32291 if (mem_base != xmlMemBlocks()) {
32292 printf("Leak of %d blocks found in xmlSchemaGetFacetValueAsULong",
32293 xmlMemBlocks() - mem_base);
32294 test_ret++;
32295 printf(" %d", n_facet);
32296 printf("\n");
32297 }
32298 }
32299 function_tests++;
32300#endif
32301
Daniel Veillard42595322004-11-08 10:52:06 +000032302 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032303}
32304
32305
32306static int
32307test_xmlSchemaGetPredefinedType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032308 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032309
William M. Brack21e4ef22005-01-02 09:53:13 +000032310#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard42595322004-11-08 10:52:06 +000032311 int mem_base;
32312 xmlSchemaTypePtr ret_val;
32313 xmlChar * name; /* the type name */
32314 int n_name;
32315 xmlChar * ns; /* the URI of the namespace usually "http://www.w3.org/2001/XMLSchema" */
32316 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032317
Daniel Veillard42595322004-11-08 10:52:06 +000032318 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
32319 for (n_ns = 0;n_ns < gen_nb_const_xmlChar_ptr;n_ns++) {
32320 mem_base = xmlMemBlocks();
32321 name = gen_const_xmlChar_ptr(n_name, 0);
32322 ns = gen_const_xmlChar_ptr(n_ns, 1);
32323
William M. Brackf13f77f2004-11-12 16:03:48 +000032324 ret_val = xmlSchemaGetPredefinedType((const xmlChar *)name, (const xmlChar *)ns);
Daniel Veillard42595322004-11-08 10:52:06 +000032325 desret_xmlSchemaTypePtr(ret_val);
32326 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000032327 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
32328 des_const_xmlChar_ptr(n_ns, (const xmlChar *)ns, 1);
Daniel Veillard42595322004-11-08 10:52:06 +000032329 xmlResetLastError();
32330 if (mem_base != xmlMemBlocks()) {
32331 printf("Leak of %d blocks found in xmlSchemaGetPredefinedType",
32332 xmlMemBlocks() - mem_base);
32333 test_ret++;
32334 printf(" %d", n_name);
32335 printf(" %d", n_ns);
32336 printf("\n");
32337 }
32338 }
32339 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032340 function_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000032341#endif
32342
Daniel Veillard42595322004-11-08 10:52:06 +000032343 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032344}
32345
32346
32347static int
32348test_xmlSchemaInitTypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032349 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032350
William M. Brack21e4ef22005-01-02 09:53:13 +000032351#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000032352
32353
32354 xmlSchemaInitTypes();
32355 call_tests++;
32356 xmlResetLastError();
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032357 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032358#endif
32359
Daniel Veillard42595322004-11-08 10:52:06 +000032360 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032361}
32362
32363
32364static int
32365test_xmlSchemaIsBuiltInTypeFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032366 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032367
William M. Brack21e4ef22005-01-02 09:53:13 +000032368#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032369 int mem_base;
32370 int ret_val;
32371 xmlSchemaTypePtr type; /* the built-in type */
32372 int n_type;
32373 int facetType; /* the facet type */
32374 int n_facetType;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032375
Daniel Veillardce682bc2004-11-05 17:22:25 +000032376 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32377 for (n_facetType = 0;n_facetType < gen_nb_int;n_facetType++) {
32378 mem_base = xmlMemBlocks();
32379 type = gen_xmlSchemaTypePtr(n_type, 0);
32380 facetType = gen_int(n_facetType, 1);
32381
32382 ret_val = xmlSchemaIsBuiltInTypeFacet(type, facetType);
32383 desret_int(ret_val);
32384 call_tests++;
32385 des_xmlSchemaTypePtr(n_type, type, 0);
32386 des_int(n_facetType, facetType, 1);
32387 xmlResetLastError();
32388 if (mem_base != xmlMemBlocks()) {
32389 printf("Leak of %d blocks found in xmlSchemaIsBuiltInTypeFacet",
32390 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032391 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032392 printf(" %d", n_type);
32393 printf(" %d", n_facetType);
32394 printf("\n");
32395 }
32396 }
32397 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032398 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032399#endif
32400
Daniel Veillard42595322004-11-08 10:52:06 +000032401 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032402}
32403
32404
32405static int
32406test_xmlSchemaNewFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032407 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032408
32409
32410 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000032411 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032412}
32413
Daniel Veillarda521d282004-11-09 14:59:59 +000032414#ifdef LIBXML_SCHEMAS_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000032415
Daniel Veillardce682bc2004-11-05 17:22:25 +000032416#define gen_nb_xmlSchemaValPtr_ptr 1
32417static xmlSchemaValPtr * gen_xmlSchemaValPtr_ptr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32418 return(NULL);
32419}
32420static void des_xmlSchemaValPtr_ptr(int no ATTRIBUTE_UNUSED, xmlSchemaValPtr * val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
32421}
Daniel Veillarda521d282004-11-09 14:59:59 +000032422#endif
32423
Daniel Veillardce682bc2004-11-05 17:22:25 +000032424
Daniel Veillardd93f6252004-11-02 15:53:51 +000032425static int
32426test_xmlSchemaValPredefTypeNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032427 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032428
William M. Brack21e4ef22005-01-02 09:53:13 +000032429#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032430 int mem_base;
32431 int ret_val;
32432 xmlSchemaTypePtr type; /* the predefined type */
32433 int n_type;
32434 xmlChar * value; /* the value to check */
32435 int n_value;
32436 xmlSchemaValPtr * val; /* the return computed value */
32437 int n_val;
32438 xmlNodePtr node; /* the node containing the value */
32439 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032440
Daniel Veillardce682bc2004-11-05 17:22:25 +000032441 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32442 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32443 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr_ptr;n_val++) {
32444 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
32445 mem_base = xmlMemBlocks();
32446 type = gen_xmlSchemaTypePtr(n_type, 0);
32447 value = gen_const_xmlChar_ptr(n_value, 1);
32448 val = gen_xmlSchemaValPtr_ptr(n_val, 2);
32449 node = gen_xmlNodePtr(n_node, 3);
32450
William M. Brackf13f77f2004-11-12 16:03:48 +000032451 ret_val = xmlSchemaValPredefTypeNode(type, (const xmlChar *)value, val, node);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032452 desret_int(ret_val);
32453 call_tests++;
32454 des_xmlSchemaTypePtr(n_type, type, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000032455 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032456 des_xmlSchemaValPtr_ptr(n_val, val, 2);
32457 des_xmlNodePtr(n_node, node, 3);
32458 xmlResetLastError();
32459 if (mem_base != xmlMemBlocks()) {
32460 printf("Leak of %d blocks found in xmlSchemaValPredefTypeNode",
32461 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032462 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032463 printf(" %d", n_type);
32464 printf(" %d", n_value);
32465 printf(" %d", n_val);
32466 printf(" %d", n_node);
32467 printf("\n");
32468 }
32469 }
32470 }
32471 }
32472 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032473 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032474#endif
32475
Daniel Veillard42595322004-11-08 10:52:06 +000032476 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032477}
32478
32479
32480static int
32481test_xmlSchemaValPredefTypeNodeNoNorm(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032482 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032483
William M. Brack21e4ef22005-01-02 09:53:13 +000032484#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032485 int mem_base;
32486 int ret_val;
32487 xmlSchemaTypePtr type; /* the predefined type */
32488 int n_type;
32489 xmlChar * value; /* the value to check */
32490 int n_value;
32491 xmlSchemaValPtr * val; /* the return computed value */
32492 int n_val;
32493 xmlNodePtr node; /* the node containing the value */
32494 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032495
Daniel Veillardce682bc2004-11-05 17:22:25 +000032496 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32497 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32498 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr_ptr;n_val++) {
32499 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
32500 mem_base = xmlMemBlocks();
32501 type = gen_xmlSchemaTypePtr(n_type, 0);
32502 value = gen_const_xmlChar_ptr(n_value, 1);
32503 val = gen_xmlSchemaValPtr_ptr(n_val, 2);
32504 node = gen_xmlNodePtr(n_node, 3);
32505
William M. Brackf13f77f2004-11-12 16:03:48 +000032506 ret_val = xmlSchemaValPredefTypeNodeNoNorm(type, (const xmlChar *)value, val, node);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032507 desret_int(ret_val);
32508 call_tests++;
32509 des_xmlSchemaTypePtr(n_type, type, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000032510 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032511 des_xmlSchemaValPtr_ptr(n_val, val, 2);
32512 des_xmlNodePtr(n_node, node, 3);
32513 xmlResetLastError();
32514 if (mem_base != xmlMemBlocks()) {
32515 printf("Leak of %d blocks found in xmlSchemaValPredefTypeNodeNoNorm",
32516 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032517 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032518 printf(" %d", n_type);
32519 printf(" %d", n_value);
32520 printf(" %d", n_val);
32521 printf(" %d", n_node);
32522 printf("\n");
32523 }
32524 }
32525 }
32526 }
32527 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032528 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +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_xmlSchemaValidateFacet(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 Veillardce682bc2004-11-05 17:22:25 +000032540 int mem_base;
32541 int ret_val;
32542 xmlSchemaTypePtr base; /* the base type */
32543 int n_base;
32544 xmlSchemaFacetPtr facet; /* the facet to check */
32545 int n_facet;
32546 xmlChar * value; /* the lexical repr of the value to validate */
32547 int n_value;
32548 xmlSchemaValPtr val; /* the precomputed value */
32549 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032550
Daniel Veillardce682bc2004-11-05 17:22:25 +000032551 for (n_base = 0;n_base < gen_nb_xmlSchemaTypePtr;n_base++) {
32552 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
32553 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32554 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) {
32555 mem_base = xmlMemBlocks();
32556 base = gen_xmlSchemaTypePtr(n_base, 0);
32557 facet = gen_xmlSchemaFacetPtr(n_facet, 1);
32558 value = gen_const_xmlChar_ptr(n_value, 2);
32559 val = gen_xmlSchemaValPtr(n_val, 3);
32560
William M. Brackf13f77f2004-11-12 16:03:48 +000032561 ret_val = xmlSchemaValidateFacet(base, facet, (const xmlChar *)value, val);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032562 desret_int(ret_val);
32563 call_tests++;
32564 des_xmlSchemaTypePtr(n_base, base, 0);
32565 des_xmlSchemaFacetPtr(n_facet, facet, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000032566 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032567 des_xmlSchemaValPtr(n_val, val, 3);
32568 xmlResetLastError();
32569 if (mem_base != xmlMemBlocks()) {
32570 printf("Leak of %d blocks found in xmlSchemaValidateFacet",
32571 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032572 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032573 printf(" %d", n_base);
32574 printf(" %d", n_facet);
32575 printf(" %d", n_value);
32576 printf(" %d", n_val);
32577 printf("\n");
32578 }
32579 }
32580 }
32581 }
32582 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032583 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032584#endif
32585
Daniel Veillard42595322004-11-08 10:52:06 +000032586 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032587}
32588
32589
32590static int
32591test_xmlSchemaValidateLengthFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032592 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032593
William M. Brack21e4ef22005-01-02 09:53:13 +000032594#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032595 int mem_base;
32596 int ret_val;
32597 xmlSchemaTypePtr type; /* the built-in type */
32598 int n_type;
32599 xmlSchemaFacetPtr facet; /* the facet to check */
32600 int n_facet;
32601 xmlChar * value; /* the lexical repr. of the value to be validated */
32602 int n_value;
32603 xmlSchemaValPtr val; /* the precomputed value */
32604 int n_val;
32605 unsigned long * length; /* the actual length of the value */
32606 int n_length;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032607
Daniel Veillardce682bc2004-11-05 17:22:25 +000032608 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32609 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
32610 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32611 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr;n_val++) {
32612 for (n_length = 0;n_length < gen_nb_unsigned_long_ptr;n_length++) {
32613 mem_base = xmlMemBlocks();
32614 type = gen_xmlSchemaTypePtr(n_type, 0);
32615 facet = gen_xmlSchemaFacetPtr(n_facet, 1);
32616 value = gen_const_xmlChar_ptr(n_value, 2);
32617 val = gen_xmlSchemaValPtr(n_val, 3);
32618 length = gen_unsigned_long_ptr(n_length, 4);
32619
William M. Brackf13f77f2004-11-12 16:03:48 +000032620 ret_val = xmlSchemaValidateLengthFacet(type, facet, (const xmlChar *)value, val, length);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032621 desret_int(ret_val);
32622 call_tests++;
32623 des_xmlSchemaTypePtr(n_type, type, 0);
32624 des_xmlSchemaFacetPtr(n_facet, facet, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000032625 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 2);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032626 des_xmlSchemaValPtr(n_val, val, 3);
32627 des_unsigned_long_ptr(n_length, length, 4);
32628 xmlResetLastError();
32629 if (mem_base != xmlMemBlocks()) {
32630 printf("Leak of %d blocks found in xmlSchemaValidateLengthFacet",
32631 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032632 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032633 printf(" %d", n_type);
32634 printf(" %d", n_facet);
32635 printf(" %d", n_value);
32636 printf(" %d", n_val);
32637 printf(" %d", n_length);
32638 printf("\n");
32639 }
32640 }
32641 }
32642 }
32643 }
32644 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032645 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032646#endif
32647
Daniel Veillard42595322004-11-08 10:52:06 +000032648 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032649}
32650
32651
32652static int
32653test_xmlSchemaValidateListSimpleTypeFacet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032654 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032655
William M. Brack21e4ef22005-01-02 09:53:13 +000032656#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032657 int mem_base;
32658 int ret_val;
32659 xmlSchemaFacetPtr facet; /* the facet to check */
32660 int n_facet;
32661 xmlChar * value; /* the lexical repr of the value to validate */
32662 int n_value;
32663 unsigned long actualLen; /* the number of list items */
32664 int n_actualLen;
32665 unsigned long * expectedLen; /* the resulting expected number of list items */
32666 int n_expectedLen;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032667
Daniel Veillardce682bc2004-11-05 17:22:25 +000032668 for (n_facet = 0;n_facet < gen_nb_xmlSchemaFacetPtr;n_facet++) {
32669 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32670 for (n_actualLen = 0;n_actualLen < gen_nb_unsigned_long;n_actualLen++) {
32671 for (n_expectedLen = 0;n_expectedLen < gen_nb_unsigned_long_ptr;n_expectedLen++) {
32672 mem_base = xmlMemBlocks();
32673 facet = gen_xmlSchemaFacetPtr(n_facet, 0);
32674 value = gen_const_xmlChar_ptr(n_value, 1);
32675 actualLen = gen_unsigned_long(n_actualLen, 2);
32676 expectedLen = gen_unsigned_long_ptr(n_expectedLen, 3);
32677
William M. Brackf13f77f2004-11-12 16:03:48 +000032678 ret_val = xmlSchemaValidateListSimpleTypeFacet(facet, (const xmlChar *)value, actualLen, expectedLen);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032679 desret_int(ret_val);
32680 call_tests++;
32681 des_xmlSchemaFacetPtr(n_facet, facet, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000032682 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032683 des_unsigned_long(n_actualLen, actualLen, 2);
32684 des_unsigned_long_ptr(n_expectedLen, expectedLen, 3);
32685 xmlResetLastError();
32686 if (mem_base != xmlMemBlocks()) {
32687 printf("Leak of %d blocks found in xmlSchemaValidateListSimpleTypeFacet",
32688 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032689 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032690 printf(" %d", n_facet);
32691 printf(" %d", n_value);
32692 printf(" %d", n_actualLen);
32693 printf(" %d", n_expectedLen);
32694 printf("\n");
32695 }
32696 }
32697 }
32698 }
32699 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032700 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032701#endif
32702
Daniel Veillard42595322004-11-08 10:52:06 +000032703 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032704}
32705
32706
32707static int
32708test_xmlSchemaValidatePredefinedType(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032709 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032710
William M. Brack21e4ef22005-01-02 09:53:13 +000032711#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000032712 int mem_base;
32713 int ret_val;
32714 xmlSchemaTypePtr type; /* the predefined type */
32715 int n_type;
32716 xmlChar * value; /* the value to check */
32717 int n_value;
32718 xmlSchemaValPtr * val; /* the return computed value */
32719 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032720
Daniel Veillardce682bc2004-11-05 17:22:25 +000032721 for (n_type = 0;n_type < gen_nb_xmlSchemaTypePtr;n_type++) {
32722 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32723 for (n_val = 0;n_val < gen_nb_xmlSchemaValPtr_ptr;n_val++) {
32724 mem_base = xmlMemBlocks();
32725 type = gen_xmlSchemaTypePtr(n_type, 0);
32726 value = gen_const_xmlChar_ptr(n_value, 1);
32727 val = gen_xmlSchemaValPtr_ptr(n_val, 2);
32728
William M. Brackf13f77f2004-11-12 16:03:48 +000032729 ret_val = xmlSchemaValidatePredefinedType(type, (const xmlChar *)value, val);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032730 desret_int(ret_val);
32731 call_tests++;
32732 des_xmlSchemaTypePtr(n_type, type, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000032733 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 1);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032734 des_xmlSchemaValPtr_ptr(n_val, val, 2);
32735 xmlResetLastError();
32736 if (mem_base != xmlMemBlocks()) {
32737 printf("Leak of %d blocks found in xmlSchemaValidatePredefinedType",
32738 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032739 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032740 printf(" %d", n_type);
32741 printf(" %d", n_value);
32742 printf(" %d", n_val);
32743 printf("\n");
32744 }
32745 }
32746 }
32747 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032748 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032749#endif
32750
Daniel Veillard42595322004-11-08 10:52:06 +000032751 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032752}
32753
Daniel Veillard91b955c2004-12-10 10:26:42 +000032754
32755static int
32756test_xmlSchemaWhiteSpaceReplace(void) {
32757 int test_ret = 0;
32758
William M. Brack21e4ef22005-01-02 09:53:13 +000032759#if defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard91b955c2004-12-10 10:26:42 +000032760 int mem_base;
32761 xmlChar * ret_val;
32762 xmlChar * value; /* a value */
32763 int n_value;
32764
32765 for (n_value = 0;n_value < gen_nb_const_xmlChar_ptr;n_value++) {
32766 mem_base = xmlMemBlocks();
32767 value = gen_const_xmlChar_ptr(n_value, 0);
32768
32769 ret_val = xmlSchemaWhiteSpaceReplace((const xmlChar *)value);
32770 desret_xmlChar_ptr(ret_val);
32771 call_tests++;
32772 des_const_xmlChar_ptr(n_value, (const xmlChar *)value, 0);
32773 xmlResetLastError();
32774 if (mem_base != xmlMemBlocks()) {
32775 printf("Leak of %d blocks found in xmlSchemaWhiteSpaceReplace",
32776 xmlMemBlocks() - mem_base);
32777 test_ret++;
32778 printf(" %d", n_value);
32779 printf("\n");
32780 }
32781 }
32782 function_tests++;
32783#endif
32784
32785 return(test_ret);
32786}
32787
Daniel Veillardd93f6252004-11-02 15:53:51 +000032788static int
32789test_xmlschemastypes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032790 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032791
Daniel Veillard91b955c2004-12-10 10:26:42 +000032792 if (quiet == 0) printf("Testing xmlschemastypes : 17 of 20 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000032793 test_ret += test_xmlSchemaCheckFacet();
32794 test_ret += test_xmlSchemaCleanupTypes();
32795 test_ret += test_xmlSchemaCollapseString();
32796 test_ret += test_xmlSchemaCompareValues();
32797 test_ret += test_xmlSchemaGetBuiltInListSimpleTypeItemType();
32798 test_ret += test_xmlSchemaGetBuiltInType();
32799 test_ret += test_xmlSchemaGetFacetValueAsULong();
32800 test_ret += test_xmlSchemaGetPredefinedType();
32801 test_ret += test_xmlSchemaInitTypes();
32802 test_ret += test_xmlSchemaIsBuiltInTypeFacet();
32803 test_ret += test_xmlSchemaNewFacet();
32804 test_ret += test_xmlSchemaValPredefTypeNode();
32805 test_ret += test_xmlSchemaValPredefTypeNodeNoNorm();
32806 test_ret += test_xmlSchemaValidateFacet();
32807 test_ret += test_xmlSchemaValidateLengthFacet();
32808 test_ret += test_xmlSchemaValidateListSimpleTypeFacet();
32809 test_ret += test_xmlSchemaValidatePredefinedType();
Daniel Veillard91b955c2004-12-10 10:26:42 +000032810 test_ret += test_xmlSchemaWhiteSpaceReplace();
Daniel Veillardd93f6252004-11-02 15:53:51 +000032811
Daniel Veillard42595322004-11-08 10:52:06 +000032812 if (test_ret != 0)
32813 printf("Module xmlschemastypes: %d errors\n", test_ret);
32814 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032815}
32816
32817static int
32818test_xmlCharStrdup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032819 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032820
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032821 int mem_base;
32822 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032823 char * cur; /* the input char * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032824 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032825
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032826 for (n_cur = 0;n_cur < gen_nb_const_char_ptr;n_cur++) {
32827 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000032828 cur = gen_const_char_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032829
William M. Brackf13f77f2004-11-12 16:03:48 +000032830 ret_val = xmlCharStrdup((const char *)cur);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032831 desret_xmlChar_ptr(ret_val);
32832 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000032833 des_const_char_ptr(n_cur, (const char *)cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032834 xmlResetLastError();
32835 if (mem_base != xmlMemBlocks()) {
32836 printf("Leak of %d blocks found in xmlCharStrdup",
32837 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032838 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032839 printf(" %d", n_cur);
32840 printf("\n");
32841 }
32842 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000032843 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032844
Daniel Veillard42595322004-11-08 10:52:06 +000032845 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032846}
32847
32848
32849static int
32850test_xmlCharStrndup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032851 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032852
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032853 int mem_base;
32854 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032855 char * cur; /* the input char * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032856 int n_cur;
32857 int len; /* the len of @cur */
32858 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032859
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032860 for (n_cur = 0;n_cur < gen_nb_const_char_ptr;n_cur++) {
32861 for (n_len = 0;n_len < gen_nb_int;n_len++) {
32862 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000032863 cur = gen_const_char_ptr(n_cur, 0);
32864 len = gen_int(n_len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032865
William M. Brackf13f77f2004-11-12 16:03:48 +000032866 ret_val = xmlCharStrndup((const char *)cur, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032867 desret_xmlChar_ptr(ret_val);
32868 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000032869 des_const_char_ptr(n_cur, (const char *)cur, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000032870 des_int(n_len, len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032871 xmlResetLastError();
32872 if (mem_base != xmlMemBlocks()) {
32873 printf("Leak of %d blocks found in xmlCharStrndup",
32874 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032875 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000032876 printf(" %d", n_cur);
32877 printf(" %d", n_len);
32878 printf("\n");
32879 }
32880 }
32881 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000032882 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032883
Daniel Veillard42595322004-11-08 10:52:06 +000032884 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032885}
32886
32887
32888static int
32889test_xmlCheckUTF8(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032890 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032891
Daniel Veillardce682bc2004-11-05 17:22:25 +000032892 int mem_base;
32893 int ret_val;
32894 unsigned char * utf; /* Pointer to putative UTF-8 encoded string. */
32895 int n_utf;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032896
Daniel Veillardce682bc2004-11-05 17:22:25 +000032897 for (n_utf = 0;n_utf < gen_nb_const_unsigned_char_ptr;n_utf++) {
32898 mem_base = xmlMemBlocks();
32899 utf = gen_const_unsigned_char_ptr(n_utf, 0);
32900
William M. Brackf13f77f2004-11-12 16:03:48 +000032901 ret_val = xmlCheckUTF8((const unsigned char *)utf);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032902 desret_int(ret_val);
32903 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000032904 des_const_unsigned_char_ptr(n_utf, (const unsigned char *)utf, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032905 xmlResetLastError();
32906 if (mem_base != xmlMemBlocks()) {
32907 printf("Leak of %d blocks found in xmlCheckUTF8",
32908 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032909 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032910 printf(" %d", n_utf);
32911 printf("\n");
32912 }
32913 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000032914 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032915
Daniel Veillard42595322004-11-08 10:52:06 +000032916 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032917}
32918
32919
32920static int
32921test_xmlGetUTF8Char(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032922 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032923
Daniel Veillardce682bc2004-11-05 17:22:25 +000032924 int mem_base;
32925 int ret_val;
32926 unsigned char * utf; /* a sequence of UTF-8 encoded bytes */
32927 int n_utf;
32928 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. */
32929 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032930
Daniel Veillardce682bc2004-11-05 17:22:25 +000032931 for (n_utf = 0;n_utf < gen_nb_const_unsigned_char_ptr;n_utf++) {
32932 for (n_len = 0;n_len < gen_nb_int_ptr;n_len++) {
32933 mem_base = xmlMemBlocks();
32934 utf = gen_const_unsigned_char_ptr(n_utf, 0);
32935 len = gen_int_ptr(n_len, 1);
32936
William M. Brackf13f77f2004-11-12 16:03:48 +000032937 ret_val = xmlGetUTF8Char((const unsigned char *)utf, len);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032938 desret_int(ret_val);
32939 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000032940 des_const_unsigned_char_ptr(n_utf, (const unsigned char *)utf, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000032941 des_int_ptr(n_len, len, 1);
32942 xmlResetLastError();
32943 if (mem_base != xmlMemBlocks()) {
32944 printf("Leak of %d blocks found in xmlGetUTF8Char",
32945 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032946 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032947 printf(" %d", n_utf);
32948 printf(" %d", n_len);
32949 printf("\n");
32950 }
32951 }
32952 }
Daniel Veillardce682bc2004-11-05 17:22:25 +000032953 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032954
Daniel Veillard42595322004-11-08 10:52:06 +000032955 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032956}
32957
32958
32959static int
32960test_xmlStrEqual(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000032961 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000032962
32963 int mem_base;
32964 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032965 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000032966 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000032967 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000032968 int n_str2;
32969
32970 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
32971 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
32972 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000032973 str1 = gen_const_xmlChar_ptr(n_str1, 0);
32974 str2 = gen_const_xmlChar_ptr(n_str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032975
William M. Brackf13f77f2004-11-12 16:03:48 +000032976 ret_val = xmlStrEqual((const xmlChar *)str1, (const xmlChar *)str2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032977 desret_int(ret_val);
32978 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000032979 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
32980 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032981 xmlResetLastError();
32982 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000032983 printf("Leak of %d blocks found in xmlStrEqual",
Daniel Veillardd93f6252004-11-02 15:53:51 +000032984 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000032985 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000032986 printf(" %d", n_str1);
32987 printf(" %d", n_str2);
32988 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000032989 }
32990 }
32991 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000032992 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000032993
Daniel Veillard42595322004-11-08 10:52:06 +000032994 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000032995}
32996
32997
32998static int
32999test_xmlStrPrintf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033000 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033001
33002
33003 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000033004 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033005}
33006
33007
33008static int
33009test_xmlStrQEqual(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033010 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033011
33012 int mem_base;
33013 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033014 xmlChar * pref; /* the prefix of the QName */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033015 int n_pref;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033016 xmlChar * name; /* the localname of the QName */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033017 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033018 xmlChar * str; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033019 int n_str;
33020
33021 for (n_pref = 0;n_pref < gen_nb_const_xmlChar_ptr;n_pref++) {
33022 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
33023 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33024 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033025 pref = gen_const_xmlChar_ptr(n_pref, 0);
33026 name = gen_const_xmlChar_ptr(n_name, 1);
33027 str = gen_const_xmlChar_ptr(n_str, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033028
William M. Brackf13f77f2004-11-12 16:03:48 +000033029 ret_val = xmlStrQEqual((const xmlChar *)pref, (const xmlChar *)name, (const xmlChar *)str);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033030 desret_int(ret_val);
33031 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033032 des_const_xmlChar_ptr(n_pref, (const xmlChar *)pref, 0);
33033 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
33034 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033035 xmlResetLastError();
33036 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033037 printf("Leak of %d blocks found in xmlStrQEqual",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033038 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033039 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033040 printf(" %d", n_pref);
33041 printf(" %d", n_name);
33042 printf(" %d", n_str);
33043 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033044 }
33045 }
33046 }
33047 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033048 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033049
Daniel Veillard42595322004-11-08 10:52:06 +000033050 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033051}
33052
33053
33054static int
33055test_xmlStrVPrintf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033056 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033057
33058
33059 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000033060 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033061}
33062
33063
33064static int
33065test_xmlStrcasecmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033066 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033067
33068 int mem_base;
33069 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033070 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033071 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033072 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033073 int n_str2;
33074
33075 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33076 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33077 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033078 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33079 str2 = gen_const_xmlChar_ptr(n_str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033080
William M. Brackf13f77f2004-11-12 16:03:48 +000033081 ret_val = xmlStrcasecmp((const xmlChar *)str1, (const xmlChar *)str2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033082 desret_int(ret_val);
33083 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033084 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
33085 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033086 xmlResetLastError();
33087 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033088 printf("Leak of %d blocks found in xmlStrcasecmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033089 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033090 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033091 printf(" %d", n_str1);
33092 printf(" %d", n_str2);
33093 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033094 }
33095 }
33096 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033097 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033098
Daniel Veillard42595322004-11-08 10:52:06 +000033099 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033100}
33101
33102
33103static int
33104test_xmlStrcasestr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033105 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033106
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033107 int mem_base;
33108 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033109 xmlChar * str; /* the xmlChar * array (haystack) */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033110 int n_str;
33111 xmlChar * val; /* the xmlChar to search (needle) */
33112 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033113
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033114 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33115 for (n_val = 0;n_val < gen_nb_xmlChar_ptr;n_val++) {
33116 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033117 str = gen_const_xmlChar_ptr(n_str, 0);
33118 val = gen_xmlChar_ptr(n_val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033119
William M. Brackf13f77f2004-11-12 16:03:48 +000033120 ret_val = xmlStrcasestr((const xmlChar *)str, val);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033121 desret_const_xmlChar_ptr(ret_val);
33122 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033123 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033124 des_xmlChar_ptr(n_val, val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033125 xmlResetLastError();
33126 if (mem_base != xmlMemBlocks()) {
33127 printf("Leak of %d blocks found in xmlStrcasestr",
33128 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033129 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033130 printf(" %d", n_str);
33131 printf(" %d", n_val);
33132 printf("\n");
33133 }
33134 }
33135 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033136 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033137
Daniel Veillard42595322004-11-08 10:52:06 +000033138 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033139}
33140
33141
33142static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000033143test_xmlStrchr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033144 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033145
Daniel Veillardf2a36f92004-11-08 17:55:01 +000033146 int mem_base;
33147 const xmlChar * ret_val;
33148 xmlChar * str; /* the xmlChar * array */
33149 int n_str;
33150 xmlChar val; /* the xmlChar to search */
33151 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033152
Daniel Veillardf2a36f92004-11-08 17:55:01 +000033153 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33154 for (n_val = 0;n_val < gen_nb_xmlChar;n_val++) {
33155 mem_base = xmlMemBlocks();
33156 str = gen_const_xmlChar_ptr(n_str, 0);
33157 val = gen_xmlChar(n_val, 1);
33158
William M. Brackf13f77f2004-11-12 16:03:48 +000033159 ret_val = xmlStrchr((const xmlChar *)str, val);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000033160 desret_const_xmlChar_ptr(ret_val);
33161 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033162 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardf2a36f92004-11-08 17:55:01 +000033163 des_xmlChar(n_val, val, 1);
33164 xmlResetLastError();
33165 if (mem_base != xmlMemBlocks()) {
33166 printf("Leak of %d blocks found in xmlStrchr",
33167 xmlMemBlocks() - mem_base);
33168 test_ret++;
33169 printf(" %d", n_str);
33170 printf(" %d", n_val);
33171 printf("\n");
33172 }
33173 }
33174 }
Daniel Veillardf2a36f92004-11-08 17:55:01 +000033175 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033176
Daniel Veillard42595322004-11-08 10:52:06 +000033177 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033178}
33179
33180
33181static int
33182test_xmlStrcmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033183 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033184
33185 int mem_base;
33186 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033187 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033188 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033189 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033190 int n_str2;
33191
33192 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33193 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33194 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033195 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33196 str2 = gen_const_xmlChar_ptr(n_str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033197
William M. Brackf13f77f2004-11-12 16:03:48 +000033198 ret_val = xmlStrcmp((const xmlChar *)str1, (const xmlChar *)str2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033199 desret_int(ret_val);
33200 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033201 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
33202 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033203 xmlResetLastError();
33204 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033205 printf("Leak of %d blocks found in xmlStrcmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033206 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033207 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033208 printf(" %d", n_str1);
33209 printf(" %d", n_str2);
33210 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033211 }
33212 }
33213 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033214 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033215
Daniel Veillard42595322004-11-08 10:52:06 +000033216 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033217}
33218
33219
33220static int
33221test_xmlStrdup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033222 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033223
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033224 int mem_base;
33225 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033226 xmlChar * cur; /* the input xmlChar * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033227 int n_cur;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033228
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033229 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
33230 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033231 cur = gen_const_xmlChar_ptr(n_cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033232
William M. Brackf13f77f2004-11-12 16:03:48 +000033233 ret_val = xmlStrdup((const xmlChar *)cur);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033234 desret_xmlChar_ptr(ret_val);
33235 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033236 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033237 xmlResetLastError();
33238 if (mem_base != xmlMemBlocks()) {
33239 printf("Leak of %d blocks found in xmlStrdup",
33240 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033241 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033242 printf(" %d", n_cur);
33243 printf("\n");
33244 }
33245 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033246 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033247
Daniel Veillard42595322004-11-08 10:52:06 +000033248 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033249}
33250
33251
33252static int
33253test_xmlStrlen(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 * str; /* the xmlChar * array */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033259 int n_str;
33260
33261 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33262 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033263 str = gen_const_xmlChar_ptr(n_str, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033264
William M. Brackf13f77f2004-11-12 16:03:48 +000033265 ret_val = xmlStrlen((const xmlChar *)str);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033266 desret_int(ret_val);
33267 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033268 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033269 xmlResetLastError();
33270 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033271 printf("Leak of %d blocks found in xmlStrlen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033272 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033273 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033274 printf(" %d", n_str);
33275 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033276 }
33277 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033278 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033279
Daniel Veillard42595322004-11-08 10:52:06 +000033280 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033281}
33282
33283
33284static int
33285test_xmlStrncasecmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033286 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033287
33288 int mem_base;
33289 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033290 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033291 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033292 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033293 int n_str2;
33294 int len; /* the max comparison length */
33295 int n_len;
33296
33297 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33298 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33299 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33300 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033301 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33302 str2 = gen_const_xmlChar_ptr(n_str2, 1);
33303 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033304
William M. Brackf13f77f2004-11-12 16:03:48 +000033305 ret_val = xmlStrncasecmp((const xmlChar *)str1, (const xmlChar *)str2, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033306 desret_int(ret_val);
33307 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033308 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
33309 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033310 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033311 xmlResetLastError();
33312 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033313 printf("Leak of %d blocks found in xmlStrncasecmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033314 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033315 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033316 printf(" %d", n_str1);
33317 printf(" %d", n_str2);
33318 printf(" %d", n_len);
33319 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033320 }
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_xmlStrncatNew(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033332 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033333
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033334 int mem_base;
33335 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033336 xmlChar * str1; /* first xmlChar string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033337 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033338 xmlChar * str2; /* second xmlChar string */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033339 int n_str2;
33340 int len; /* the len of @str2 */
33341 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033342
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033343 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33344 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33345 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33346 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033347 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33348 str2 = gen_const_xmlChar_ptr(n_str2, 1);
33349 len = gen_int(n_len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033350
William M. Brackf13f77f2004-11-12 16:03:48 +000033351 ret_val = xmlStrncatNew((const xmlChar *)str1, (const xmlChar *)str2, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033352 desret_xmlChar_ptr(ret_val);
33353 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033354 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
33355 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033356 des_int(n_len, len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033357 xmlResetLastError();
33358 if (mem_base != xmlMemBlocks()) {
33359 printf("Leak of %d blocks found in xmlStrncatNew",
33360 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033361 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033362 printf(" %d", n_str1);
33363 printf(" %d", n_str2);
33364 printf(" %d", n_len);
33365 printf("\n");
33366 }
33367 }
33368 }
33369 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033370 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033371
Daniel Veillard42595322004-11-08 10:52:06 +000033372 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033373}
33374
33375
33376static int
33377test_xmlStrncmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033378 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033379
33380 int mem_base;
33381 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033382 xmlChar * str1; /* the first xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033383 int n_str1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033384 xmlChar * str2; /* the second xmlChar * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033385 int n_str2;
33386 int len; /* the max comparison length */
33387 int n_len;
33388
33389 for (n_str1 = 0;n_str1 < gen_nb_const_xmlChar_ptr;n_str1++) {
33390 for (n_str2 = 0;n_str2 < gen_nb_const_xmlChar_ptr;n_str2++) {
33391 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33392 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033393 str1 = gen_const_xmlChar_ptr(n_str1, 0);
33394 str2 = gen_const_xmlChar_ptr(n_str2, 1);
33395 len = gen_int(n_len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033396
William M. Brackf13f77f2004-11-12 16:03:48 +000033397 ret_val = xmlStrncmp((const xmlChar *)str1, (const xmlChar *)str2, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033398 desret_int(ret_val);
33399 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033400 des_const_xmlChar_ptr(n_str1, (const xmlChar *)str1, 0);
33401 des_const_xmlChar_ptr(n_str2, (const xmlChar *)str2, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033402 des_int(n_len, len, 2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033403 xmlResetLastError();
33404 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033405 printf("Leak of %d blocks found in xmlStrncmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033406 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033407 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033408 printf(" %d", n_str1);
33409 printf(" %d", n_str2);
33410 printf(" %d", n_len);
33411 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033412 }
33413 }
33414 }
33415 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033416 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033417
Daniel Veillard42595322004-11-08 10:52:06 +000033418 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033419}
33420
33421
33422static int
33423test_xmlStrndup(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033424 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033425
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033426 int mem_base;
33427 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033428 xmlChar * cur; /* the input xmlChar * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033429 int n_cur;
33430 int len; /* the len of @cur */
33431 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033432
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033433 for (n_cur = 0;n_cur < gen_nb_const_xmlChar_ptr;n_cur++) {
33434 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33435 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033436 cur = gen_const_xmlChar_ptr(n_cur, 0);
33437 len = gen_int(n_len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033438
William M. Brackf13f77f2004-11-12 16:03:48 +000033439 ret_val = xmlStrndup((const xmlChar *)cur, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033440 desret_xmlChar_ptr(ret_val);
33441 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033442 des_const_xmlChar_ptr(n_cur, (const xmlChar *)cur, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033443 des_int(n_len, len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033444 xmlResetLastError();
33445 if (mem_base != xmlMemBlocks()) {
33446 printf("Leak of %d blocks found in xmlStrndup",
33447 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033448 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033449 printf(" %d", n_cur);
33450 printf(" %d", n_len);
33451 printf("\n");
33452 }
33453 }
33454 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033455 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033456
Daniel Veillard42595322004-11-08 10:52:06 +000033457 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033458}
33459
33460
33461static int
33462test_xmlStrstr(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033463 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033464
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033465 int mem_base;
33466 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033467 xmlChar * str; /* the xmlChar * array (haystack) */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033468 int n_str;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033469 xmlChar * val; /* the xmlChar to search (needle) */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033470 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033471
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033472 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33473 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
33474 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033475 str = gen_const_xmlChar_ptr(n_str, 0);
33476 val = gen_const_xmlChar_ptr(n_val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033477
William M. Brackf13f77f2004-11-12 16:03:48 +000033478 ret_val = xmlStrstr((const xmlChar *)str, (const xmlChar *)val);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033479 desret_const_xmlChar_ptr(ret_val);
33480 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033481 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
33482 des_const_xmlChar_ptr(n_val, (const xmlChar *)val, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033483 xmlResetLastError();
33484 if (mem_base != xmlMemBlocks()) {
33485 printf("Leak of %d blocks found in xmlStrstr",
33486 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033487 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033488 printf(" %d", n_str);
33489 printf(" %d", n_val);
33490 printf("\n");
33491 }
33492 }
33493 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033494 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033495
Daniel Veillard42595322004-11-08 10:52:06 +000033496 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033497}
33498
33499
33500static int
33501test_xmlStrsub(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033502 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033503
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033504 int mem_base;
33505 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033506 xmlChar * str; /* the xmlChar * array (haystack) */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033507 int n_str;
33508 int start; /* the index of the first char (zero based) */
33509 int n_start;
33510 int len; /* the length of the substring */
33511 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033512
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033513 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
33514 for (n_start = 0;n_start < gen_nb_int;n_start++) {
33515 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33516 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033517 str = gen_const_xmlChar_ptr(n_str, 0);
33518 start = gen_int(n_start, 1);
33519 len = gen_int(n_len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033520
William M. Brackf13f77f2004-11-12 16:03:48 +000033521 ret_val = xmlStrsub((const xmlChar *)str, start, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033522 desret_xmlChar_ptr(ret_val);
33523 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033524 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033525 des_int(n_start, start, 1);
33526 des_int(n_len, len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033527 xmlResetLastError();
33528 if (mem_base != xmlMemBlocks()) {
33529 printf("Leak of %d blocks found in xmlStrsub",
33530 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033531 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033532 printf(" %d", n_str);
33533 printf(" %d", n_start);
33534 printf(" %d", n_len);
33535 printf("\n");
33536 }
33537 }
33538 }
33539 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033540 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033541
Daniel Veillard42595322004-11-08 10:52:06 +000033542 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033543}
33544
33545
33546static int
33547test_xmlUTF8Charcmp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033548 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033549
33550 int mem_base;
33551 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033552 xmlChar * utf1; /* pointer to first UTF8 char */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033553 int n_utf1;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033554 xmlChar * utf2; /* pointer to second UTF8 char */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033555 int n_utf2;
33556
33557 for (n_utf1 = 0;n_utf1 < gen_nb_const_xmlChar_ptr;n_utf1++) {
33558 for (n_utf2 = 0;n_utf2 < gen_nb_const_xmlChar_ptr;n_utf2++) {
33559 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033560 utf1 = gen_const_xmlChar_ptr(n_utf1, 0);
33561 utf2 = gen_const_xmlChar_ptr(n_utf2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033562
William M. Brackf13f77f2004-11-12 16:03:48 +000033563 ret_val = xmlUTF8Charcmp((const xmlChar *)utf1, (const xmlChar *)utf2);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033564 desret_int(ret_val);
33565 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033566 des_const_xmlChar_ptr(n_utf1, (const xmlChar *)utf1, 0);
33567 des_const_xmlChar_ptr(n_utf2, (const xmlChar *)utf2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033568 xmlResetLastError();
33569 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033570 printf("Leak of %d blocks found in xmlUTF8Charcmp",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033571 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033572 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033573 printf(" %d", n_utf1);
33574 printf(" %d", n_utf2);
33575 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033576 }
33577 }
33578 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033579 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033580
Daniel Veillard42595322004-11-08 10:52:06 +000033581 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033582}
33583
33584
33585static int
33586test_xmlUTF8Size(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033587 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033588
33589 int mem_base;
33590 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033591 xmlChar * utf; /* pointer to the UTF8 character */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033592 int n_utf;
33593
33594 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33595 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033596 utf = gen_const_xmlChar_ptr(n_utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033597
William M. Brackf13f77f2004-11-12 16:03:48 +000033598 ret_val = xmlUTF8Size((const xmlChar *)utf);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033599 desret_int(ret_val);
33600 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033601 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033602 xmlResetLastError();
33603 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033604 printf("Leak of %d blocks found in xmlUTF8Size",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033605 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033606 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033607 printf(" %d", n_utf);
33608 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033609 }
33610 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033611 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033612
Daniel Veillard42595322004-11-08 10:52:06 +000033613 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033614}
33615
33616
33617static int
33618test_xmlUTF8Strlen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033619 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033620
33621 int mem_base;
33622 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033623 xmlChar * utf; /* a sequence of UTF-8 encoded bytes */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033624 int n_utf;
33625
33626 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33627 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033628 utf = gen_const_xmlChar_ptr(n_utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033629
William M. Brackf13f77f2004-11-12 16:03:48 +000033630 ret_val = xmlUTF8Strlen((const xmlChar *)utf);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033631 desret_int(ret_val);
33632 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033633 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033634 xmlResetLastError();
33635 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033636 printf("Leak of %d blocks found in xmlUTF8Strlen",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033637 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033638 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033639 printf(" %d", n_utf);
33640 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033641 }
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_xmlUTF8Strloc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033651 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033652
33653 int mem_base;
33654 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033655 xmlChar * utf; /* the input UTF8 * */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033656 int n_utf;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033657 xmlChar * utfchar; /* the UTF8 character to be found */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033658 int n_utfchar;
33659
33660 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33661 for (n_utfchar = 0;n_utfchar < gen_nb_const_xmlChar_ptr;n_utfchar++) {
33662 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033663 utf = gen_const_xmlChar_ptr(n_utf, 0);
33664 utfchar = gen_const_xmlChar_ptr(n_utfchar, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033665
William M. Brackf13f77f2004-11-12 16:03:48 +000033666 ret_val = xmlUTF8Strloc((const xmlChar *)utf, (const xmlChar *)utfchar);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033667 desret_int(ret_val);
33668 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033669 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
33670 des_const_xmlChar_ptr(n_utfchar, (const xmlChar *)utfchar, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033671 xmlResetLastError();
33672 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033673 printf("Leak of %d blocks found in xmlUTF8Strloc",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033674 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033675 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033676 printf(" %d", n_utf);
33677 printf(" %d", n_utfchar);
33678 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033679 }
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_xmlUTF8Strndup(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 * utf; /* the input UTF8 * */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033695 int n_utf;
33696 int len; /* the len of @utf (in chars) */
33697 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033698
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033699 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33700 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33701 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033702 utf = gen_const_xmlChar_ptr(n_utf, 0);
33703 len = gen_int(n_len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033704
William M. Brackf13f77f2004-11-12 16:03:48 +000033705 ret_val = xmlUTF8Strndup((const xmlChar *)utf, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033706 desret_xmlChar_ptr(ret_val);
33707 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033708 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033709 des_int(n_len, len, 1);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033710 xmlResetLastError();
33711 if (mem_base != xmlMemBlocks()) {
33712 printf("Leak of %d blocks found in xmlUTF8Strndup",
33713 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033714 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033715 printf(" %d", n_utf);
33716 printf(" %d", n_len);
33717 printf("\n");
33718 }
33719 }
33720 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033721 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033722
Daniel Veillard42595322004-11-08 10:52:06 +000033723 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033724}
33725
33726
33727static int
33728test_xmlUTF8Strpos(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033729 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033730
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033731 int mem_base;
33732 const xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033733 xmlChar * utf; /* the input UTF8 * */
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033734 int n_utf;
33735 int pos; /* the position of the desired UTF8 char (in chars) */
33736 int n_pos;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033737
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033738 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33739 for (n_pos = 0;n_pos < gen_nb_int;n_pos++) {
33740 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033741 utf = gen_const_xmlChar_ptr(n_utf, 0);
33742 pos = gen_int(n_pos, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033743
William M. Brackf13f77f2004-11-12 16:03:48 +000033744 ret_val = xmlUTF8Strpos((const xmlChar *)utf, pos);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033745 desret_const_xmlChar_ptr(ret_val);
33746 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033747 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033748 des_int(n_pos, pos, 1);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033749 xmlResetLastError();
33750 if (mem_base != xmlMemBlocks()) {
33751 printf("Leak of %d blocks found in xmlUTF8Strpos",
33752 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033753 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000033754 printf(" %d", n_utf);
33755 printf(" %d", n_pos);
33756 printf("\n");
33757 }
33758 }
33759 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033760 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033761
Daniel Veillard42595322004-11-08 10:52:06 +000033762 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033763}
33764
33765
33766static int
33767test_xmlUTF8Strsize(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033768 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033769
33770 int mem_base;
33771 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033772 xmlChar * utf; /* a sequence of UTF-8 encoded bytes */
Daniel Veillardd93f6252004-11-02 15:53:51 +000033773 int n_utf;
33774 int len; /* the number of characters in the array */
33775 int n_len;
33776
33777 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33778 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33779 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033780 utf = gen_const_xmlChar_ptr(n_utf, 0);
33781 len = gen_int(n_len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033782
William M. Brackf13f77f2004-11-12 16:03:48 +000033783 ret_val = xmlUTF8Strsize((const xmlChar *)utf, len);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033784 desret_int(ret_val);
33785 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033786 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033787 des_int(n_len, len, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033788 xmlResetLastError();
33789 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000033790 printf("Leak of %d blocks found in xmlUTF8Strsize",
Daniel Veillardd93f6252004-11-02 15:53:51 +000033791 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033792 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000033793 printf(" %d", n_utf);
33794 printf(" %d", n_len);
33795 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000033796 }
33797 }
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_xmlUTF8Strsub(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033807 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033808
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033809 int mem_base;
33810 xmlChar * ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000033811 xmlChar * utf; /* a sequence of UTF-8 encoded bytes */
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033812 int n_utf;
33813 int start; /* relative pos of first char */
33814 int n_start;
33815 int len; /* total number to copy */
33816 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033817
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033818 for (n_utf = 0;n_utf < gen_nb_const_xmlChar_ptr;n_utf++) {
33819 for (n_start = 0;n_start < gen_nb_int;n_start++) {
33820 for (n_len = 0;n_len < gen_nb_int;n_len++) {
33821 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000033822 utf = gen_const_xmlChar_ptr(n_utf, 0);
33823 start = gen_int(n_start, 1);
33824 len = gen_int(n_len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033825
William M. Brackf13f77f2004-11-12 16:03:48 +000033826 ret_val = xmlUTF8Strsub((const xmlChar *)utf, start, len);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033827 desret_xmlChar_ptr(ret_val);
33828 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000033829 des_const_xmlChar_ptr(n_utf, (const xmlChar *)utf, 0);
Daniel Veillard3d97e662004-11-04 10:49:00 +000033830 des_int(n_start, start, 1);
33831 des_int(n_len, len, 2);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033832 xmlResetLastError();
33833 if (mem_base != xmlMemBlocks()) {
33834 printf("Leak of %d blocks found in xmlUTF8Strsub",
33835 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033836 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000033837 printf(" %d", n_utf);
33838 printf(" %d", n_start);
33839 printf(" %d", n_len);
33840 printf("\n");
33841 }
33842 }
33843 }
33844 }
Daniel Veillard3d97e662004-11-04 10:49:00 +000033845 function_tests++;
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033846
Daniel Veillard42595322004-11-08 10:52:06 +000033847 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033848}
33849
33850static int
33851test_xmlstring(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033852 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000033853
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033854 if (quiet == 0) printf("Testing xmlstring : 26 of 30 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000033855 test_ret += test_xmlCharStrdup();
33856 test_ret += test_xmlCharStrndup();
33857 test_ret += test_xmlCheckUTF8();
33858 test_ret += test_xmlGetUTF8Char();
33859 test_ret += test_xmlStrEqual();
33860 test_ret += test_xmlStrPrintf();
33861 test_ret += test_xmlStrQEqual();
33862 test_ret += test_xmlStrVPrintf();
33863 test_ret += test_xmlStrcasecmp();
33864 test_ret += test_xmlStrcasestr();
33865 test_ret += test_xmlStrchr();
33866 test_ret += test_xmlStrcmp();
33867 test_ret += test_xmlStrdup();
33868 test_ret += test_xmlStrlen();
33869 test_ret += test_xmlStrncasecmp();
33870 test_ret += test_xmlStrncatNew();
33871 test_ret += test_xmlStrncmp();
33872 test_ret += test_xmlStrndup();
33873 test_ret += test_xmlStrstr();
33874 test_ret += test_xmlStrsub();
33875 test_ret += test_xmlUTF8Charcmp();
33876 test_ret += test_xmlUTF8Size();
33877 test_ret += test_xmlUTF8Strlen();
33878 test_ret += test_xmlUTF8Strloc();
33879 test_ret += test_xmlUTF8Strndup();
33880 test_ret += test_xmlUTF8Strpos();
33881 test_ret += test_xmlUTF8Strsize();
33882 test_ret += test_xmlUTF8Strsub();
Daniel Veillardd93f6252004-11-02 15:53:51 +000033883
Daniel Veillard42595322004-11-08 10:52:06 +000033884 if (test_ret != 0)
33885 printf("Module xmlstring: %d errors\n", test_ret);
33886 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000033887}
33888
33889static int
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033890test_xmlUCSIsAegeanNumbers(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033891 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033892
William M. Brack21e4ef22005-01-02 09:53:13 +000033893#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033894 int mem_base;
33895 int ret_val;
33896 int code; /* UCS code point */
33897 int n_code;
33898
33899 for (n_code = 0;n_code < gen_nb_int;n_code++) {
33900 mem_base = xmlMemBlocks();
33901 code = gen_int(n_code, 0);
33902
33903 ret_val = xmlUCSIsAegeanNumbers(code);
33904 desret_int(ret_val);
33905 call_tests++;
33906 des_int(n_code, code, 0);
33907 xmlResetLastError();
33908 if (mem_base != xmlMemBlocks()) {
33909 printf("Leak of %d blocks found in xmlUCSIsAegeanNumbers",
33910 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033911 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033912 printf(" %d", n_code);
33913 printf("\n");
33914 }
33915 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033916 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033917#endif
33918
Daniel Veillard42595322004-11-08 10:52:06 +000033919 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033920}
33921
33922
33923static int
33924test_xmlUCSIsAlphabeticPresentationForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033925 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033926
William M. Brack21e4ef22005-01-02 09:53:13 +000033927#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033928 int mem_base;
33929 int ret_val;
33930 int code; /* UCS code point */
33931 int n_code;
33932
33933 for (n_code = 0;n_code < gen_nb_int;n_code++) {
33934 mem_base = xmlMemBlocks();
33935 code = gen_int(n_code, 0);
33936
33937 ret_val = xmlUCSIsAlphabeticPresentationForms(code);
33938 desret_int(ret_val);
33939 call_tests++;
33940 des_int(n_code, code, 0);
33941 xmlResetLastError();
33942 if (mem_base != xmlMemBlocks()) {
33943 printf("Leak of %d blocks found in xmlUCSIsAlphabeticPresentationForms",
33944 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033945 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033946 printf(" %d", n_code);
33947 printf("\n");
33948 }
33949 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033950 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033951#endif
33952
Daniel Veillard42595322004-11-08 10:52:06 +000033953 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033954}
33955
33956
33957static int
33958test_xmlUCSIsArabic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033959 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033960
William M. Brack21e4ef22005-01-02 09:53:13 +000033961#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033962 int mem_base;
33963 int ret_val;
33964 int code; /* UCS code point */
33965 int n_code;
33966
33967 for (n_code = 0;n_code < gen_nb_int;n_code++) {
33968 mem_base = xmlMemBlocks();
33969 code = gen_int(n_code, 0);
33970
33971 ret_val = xmlUCSIsArabic(code);
33972 desret_int(ret_val);
33973 call_tests++;
33974 des_int(n_code, code, 0);
33975 xmlResetLastError();
33976 if (mem_base != xmlMemBlocks()) {
33977 printf("Leak of %d blocks found in xmlUCSIsArabic",
33978 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000033979 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033980 printf(" %d", n_code);
33981 printf("\n");
33982 }
33983 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000033984 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033985#endif
33986
Daniel Veillard42595322004-11-08 10:52:06 +000033987 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033988}
33989
33990
33991static int
33992test_xmlUCSIsArabicPresentationFormsA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000033993 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033994
William M. Brack21e4ef22005-01-02 09:53:13 +000033995#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000033996 int mem_base;
33997 int ret_val;
33998 int code; /* UCS code point */
33999 int n_code;
34000
34001 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34002 mem_base = xmlMemBlocks();
34003 code = gen_int(n_code, 0);
34004
34005 ret_val = xmlUCSIsArabicPresentationFormsA(code);
34006 desret_int(ret_val);
34007 call_tests++;
34008 des_int(n_code, code, 0);
34009 xmlResetLastError();
34010 if (mem_base != xmlMemBlocks()) {
34011 printf("Leak of %d blocks found in xmlUCSIsArabicPresentationFormsA",
34012 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034013 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034014 printf(" %d", n_code);
34015 printf("\n");
34016 }
34017 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034018 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034019#endif
34020
Daniel Veillard42595322004-11-08 10:52:06 +000034021 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034022}
34023
34024
34025static int
34026test_xmlUCSIsArabicPresentationFormsB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034027 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034028
William M. Brack21e4ef22005-01-02 09:53:13 +000034029#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034030 int mem_base;
34031 int ret_val;
34032 int code; /* UCS code point */
34033 int n_code;
34034
34035 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34036 mem_base = xmlMemBlocks();
34037 code = gen_int(n_code, 0);
34038
34039 ret_val = xmlUCSIsArabicPresentationFormsB(code);
34040 desret_int(ret_val);
34041 call_tests++;
34042 des_int(n_code, code, 0);
34043 xmlResetLastError();
34044 if (mem_base != xmlMemBlocks()) {
34045 printf("Leak of %d blocks found in xmlUCSIsArabicPresentationFormsB",
34046 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034047 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034048 printf(" %d", n_code);
34049 printf("\n");
34050 }
34051 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034052 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034053#endif
34054
Daniel Veillard42595322004-11-08 10:52:06 +000034055 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034056}
34057
34058
34059static int
34060test_xmlUCSIsArmenian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034061 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034062
William M. Brack21e4ef22005-01-02 09:53:13 +000034063#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034064 int mem_base;
34065 int ret_val;
34066 int code; /* UCS code point */
34067 int n_code;
34068
34069 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34070 mem_base = xmlMemBlocks();
34071 code = gen_int(n_code, 0);
34072
34073 ret_val = xmlUCSIsArmenian(code);
34074 desret_int(ret_val);
34075 call_tests++;
34076 des_int(n_code, code, 0);
34077 xmlResetLastError();
34078 if (mem_base != xmlMemBlocks()) {
34079 printf("Leak of %d blocks found in xmlUCSIsArmenian",
34080 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034081 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034082 printf(" %d", n_code);
34083 printf("\n");
34084 }
34085 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034086 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034087#endif
34088
Daniel Veillard42595322004-11-08 10:52:06 +000034089 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034090}
34091
34092
34093static int
34094test_xmlUCSIsArrows(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034095 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034096
William M. Brack21e4ef22005-01-02 09:53:13 +000034097#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034098 int mem_base;
34099 int ret_val;
34100 int code; /* UCS code point */
34101 int n_code;
34102
34103 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34104 mem_base = xmlMemBlocks();
34105 code = gen_int(n_code, 0);
34106
34107 ret_val = xmlUCSIsArrows(code);
34108 desret_int(ret_val);
34109 call_tests++;
34110 des_int(n_code, code, 0);
34111 xmlResetLastError();
34112 if (mem_base != xmlMemBlocks()) {
34113 printf("Leak of %d blocks found in xmlUCSIsArrows",
34114 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034115 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034116 printf(" %d", n_code);
34117 printf("\n");
34118 }
34119 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034120 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034121#endif
34122
Daniel Veillard42595322004-11-08 10:52:06 +000034123 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034124}
34125
34126
34127static int
34128test_xmlUCSIsBasicLatin(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034129 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034130
William M. Brack21e4ef22005-01-02 09:53:13 +000034131#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034132 int mem_base;
34133 int ret_val;
34134 int code; /* UCS code point */
34135 int n_code;
34136
34137 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34138 mem_base = xmlMemBlocks();
34139 code = gen_int(n_code, 0);
34140
34141 ret_val = xmlUCSIsBasicLatin(code);
34142 desret_int(ret_val);
34143 call_tests++;
34144 des_int(n_code, code, 0);
34145 xmlResetLastError();
34146 if (mem_base != xmlMemBlocks()) {
34147 printf("Leak of %d blocks found in xmlUCSIsBasicLatin",
34148 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034149 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034150 printf(" %d", n_code);
34151 printf("\n");
34152 }
34153 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034154 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034155#endif
34156
Daniel Veillard42595322004-11-08 10:52:06 +000034157 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034158}
34159
34160
34161static int
34162test_xmlUCSIsBengali(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034163 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034164
William M. Brack21e4ef22005-01-02 09:53:13 +000034165#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034166 int mem_base;
34167 int ret_val;
34168 int code; /* UCS code point */
34169 int n_code;
34170
34171 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34172 mem_base = xmlMemBlocks();
34173 code = gen_int(n_code, 0);
34174
34175 ret_val = xmlUCSIsBengali(code);
34176 desret_int(ret_val);
34177 call_tests++;
34178 des_int(n_code, code, 0);
34179 xmlResetLastError();
34180 if (mem_base != xmlMemBlocks()) {
34181 printf("Leak of %d blocks found in xmlUCSIsBengali",
34182 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034183 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034184 printf(" %d", n_code);
34185 printf("\n");
34186 }
34187 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034188 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034189#endif
34190
Daniel Veillard42595322004-11-08 10:52:06 +000034191 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034192}
34193
34194
34195static int
34196test_xmlUCSIsBlock(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034197 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034198
William M. Brack21e4ef22005-01-02 09:53:13 +000034199#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034200 int mem_base;
34201 int ret_val;
34202 int code; /* UCS code point */
34203 int n_code;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034204 char * block; /* UCS block name */
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034205 int n_block;
34206
34207 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34208 for (n_block = 0;n_block < gen_nb_const_char_ptr;n_block++) {
34209 mem_base = xmlMemBlocks();
34210 code = gen_int(n_code, 0);
34211 block = gen_const_char_ptr(n_block, 1);
34212
William M. Brackf13f77f2004-11-12 16:03:48 +000034213 ret_val = xmlUCSIsBlock(code, (const char *)block);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034214 desret_int(ret_val);
34215 call_tests++;
34216 des_int(n_code, code, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000034217 des_const_char_ptr(n_block, (const char *)block, 1);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034218 xmlResetLastError();
34219 if (mem_base != xmlMemBlocks()) {
34220 printf("Leak of %d blocks found in xmlUCSIsBlock",
34221 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034222 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034223 printf(" %d", n_code);
34224 printf(" %d", n_block);
34225 printf("\n");
34226 }
34227 }
34228 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034229 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034230#endif
34231
Daniel Veillard42595322004-11-08 10:52:06 +000034232 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034233}
34234
34235
34236static int
34237test_xmlUCSIsBlockElements(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034238 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034239
William M. Brack21e4ef22005-01-02 09:53:13 +000034240#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034241 int mem_base;
34242 int ret_val;
34243 int code; /* UCS code point */
34244 int n_code;
34245
34246 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34247 mem_base = xmlMemBlocks();
34248 code = gen_int(n_code, 0);
34249
34250 ret_val = xmlUCSIsBlockElements(code);
34251 desret_int(ret_val);
34252 call_tests++;
34253 des_int(n_code, code, 0);
34254 xmlResetLastError();
34255 if (mem_base != xmlMemBlocks()) {
34256 printf("Leak of %d blocks found in xmlUCSIsBlockElements",
34257 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034258 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034259 printf(" %d", n_code);
34260 printf("\n");
34261 }
34262 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034263 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034264#endif
34265
Daniel Veillard42595322004-11-08 10:52:06 +000034266 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034267}
34268
34269
34270static int
34271test_xmlUCSIsBopomofo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034272 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034273
William M. Brack21e4ef22005-01-02 09:53:13 +000034274#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034275 int mem_base;
34276 int ret_val;
34277 int code; /* UCS code point */
34278 int n_code;
34279
34280 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34281 mem_base = xmlMemBlocks();
34282 code = gen_int(n_code, 0);
34283
34284 ret_val = xmlUCSIsBopomofo(code);
34285 desret_int(ret_val);
34286 call_tests++;
34287 des_int(n_code, code, 0);
34288 xmlResetLastError();
34289 if (mem_base != xmlMemBlocks()) {
34290 printf("Leak of %d blocks found in xmlUCSIsBopomofo",
34291 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034292 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034293 printf(" %d", n_code);
34294 printf("\n");
34295 }
34296 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034297 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034298#endif
34299
Daniel Veillard42595322004-11-08 10:52:06 +000034300 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034301}
34302
34303
34304static int
34305test_xmlUCSIsBopomofoExtended(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034306 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034307
William M. Brack21e4ef22005-01-02 09:53:13 +000034308#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034309 int mem_base;
34310 int ret_val;
34311 int code; /* UCS code point */
34312 int n_code;
34313
34314 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34315 mem_base = xmlMemBlocks();
34316 code = gen_int(n_code, 0);
34317
34318 ret_val = xmlUCSIsBopomofoExtended(code);
34319 desret_int(ret_val);
34320 call_tests++;
34321 des_int(n_code, code, 0);
34322 xmlResetLastError();
34323 if (mem_base != xmlMemBlocks()) {
34324 printf("Leak of %d blocks found in xmlUCSIsBopomofoExtended",
34325 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034326 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034327 printf(" %d", n_code);
34328 printf("\n");
34329 }
34330 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034331 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034332#endif
34333
Daniel Veillard42595322004-11-08 10:52:06 +000034334 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034335}
34336
34337
34338static int
34339test_xmlUCSIsBoxDrawing(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034340 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034341
William M. Brack21e4ef22005-01-02 09:53:13 +000034342#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034343 int mem_base;
34344 int ret_val;
34345 int code; /* UCS code point */
34346 int n_code;
34347
34348 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34349 mem_base = xmlMemBlocks();
34350 code = gen_int(n_code, 0);
34351
34352 ret_val = xmlUCSIsBoxDrawing(code);
34353 desret_int(ret_val);
34354 call_tests++;
34355 des_int(n_code, code, 0);
34356 xmlResetLastError();
34357 if (mem_base != xmlMemBlocks()) {
34358 printf("Leak of %d blocks found in xmlUCSIsBoxDrawing",
34359 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034360 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034361 printf(" %d", n_code);
34362 printf("\n");
34363 }
34364 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034365 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034366#endif
34367
Daniel Veillard42595322004-11-08 10:52:06 +000034368 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034369}
34370
34371
34372static int
34373test_xmlUCSIsBraillePatterns(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034374 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034375
William M. Brack21e4ef22005-01-02 09:53:13 +000034376#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034377 int mem_base;
34378 int ret_val;
34379 int code; /* UCS code point */
34380 int n_code;
34381
34382 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34383 mem_base = xmlMemBlocks();
34384 code = gen_int(n_code, 0);
34385
34386 ret_val = xmlUCSIsBraillePatterns(code);
34387 desret_int(ret_val);
34388 call_tests++;
34389 des_int(n_code, code, 0);
34390 xmlResetLastError();
34391 if (mem_base != xmlMemBlocks()) {
34392 printf("Leak of %d blocks found in xmlUCSIsBraillePatterns",
34393 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034394 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034395 printf(" %d", n_code);
34396 printf("\n");
34397 }
34398 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034399 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034400#endif
34401
Daniel Veillard42595322004-11-08 10:52:06 +000034402 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034403}
34404
34405
34406static int
34407test_xmlUCSIsBuhid(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034408 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034409
William M. Brack21e4ef22005-01-02 09:53:13 +000034410#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034411 int mem_base;
34412 int ret_val;
34413 int code; /* UCS code point */
34414 int n_code;
34415
34416 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34417 mem_base = xmlMemBlocks();
34418 code = gen_int(n_code, 0);
34419
34420 ret_val = xmlUCSIsBuhid(code);
34421 desret_int(ret_val);
34422 call_tests++;
34423 des_int(n_code, code, 0);
34424 xmlResetLastError();
34425 if (mem_base != xmlMemBlocks()) {
34426 printf("Leak of %d blocks found in xmlUCSIsBuhid",
34427 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034428 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034429 printf(" %d", n_code);
34430 printf("\n");
34431 }
34432 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034433 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034434#endif
34435
Daniel Veillard42595322004-11-08 10:52:06 +000034436 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034437}
34438
34439
34440static int
34441test_xmlUCSIsByzantineMusicalSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034442 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034443
William M. Brack21e4ef22005-01-02 09:53:13 +000034444#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034445 int mem_base;
34446 int ret_val;
34447 int code; /* UCS code point */
34448 int n_code;
34449
34450 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34451 mem_base = xmlMemBlocks();
34452 code = gen_int(n_code, 0);
34453
34454 ret_val = xmlUCSIsByzantineMusicalSymbols(code);
34455 desret_int(ret_val);
34456 call_tests++;
34457 des_int(n_code, code, 0);
34458 xmlResetLastError();
34459 if (mem_base != xmlMemBlocks()) {
34460 printf("Leak of %d blocks found in xmlUCSIsByzantineMusicalSymbols",
34461 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034462 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034463 printf(" %d", n_code);
34464 printf("\n");
34465 }
34466 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034467 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034468#endif
34469
Daniel Veillard42595322004-11-08 10:52:06 +000034470 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034471}
34472
34473
34474static int
34475test_xmlUCSIsCJKCompatibility(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034476 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034477
William M. Brack21e4ef22005-01-02 09:53:13 +000034478#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034479 int mem_base;
34480 int ret_val;
34481 int code; /* UCS code point */
34482 int n_code;
34483
34484 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34485 mem_base = xmlMemBlocks();
34486 code = gen_int(n_code, 0);
34487
34488 ret_val = xmlUCSIsCJKCompatibility(code);
34489 desret_int(ret_val);
34490 call_tests++;
34491 des_int(n_code, code, 0);
34492 xmlResetLastError();
34493 if (mem_base != xmlMemBlocks()) {
34494 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibility",
34495 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034496 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034497 printf(" %d", n_code);
34498 printf("\n");
34499 }
34500 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034501 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034502#endif
34503
Daniel Veillard42595322004-11-08 10:52:06 +000034504 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034505}
34506
34507
34508static int
34509test_xmlUCSIsCJKCompatibilityForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034510 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034511
William M. Brack21e4ef22005-01-02 09:53:13 +000034512#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034513 int mem_base;
34514 int ret_val;
34515 int code; /* UCS code point */
34516 int n_code;
34517
34518 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34519 mem_base = xmlMemBlocks();
34520 code = gen_int(n_code, 0);
34521
34522 ret_val = xmlUCSIsCJKCompatibilityForms(code);
34523 desret_int(ret_val);
34524 call_tests++;
34525 des_int(n_code, code, 0);
34526 xmlResetLastError();
34527 if (mem_base != xmlMemBlocks()) {
34528 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibilityForms",
34529 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034530 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034531 printf(" %d", n_code);
34532 printf("\n");
34533 }
34534 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034535 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034536#endif
34537
Daniel Veillard42595322004-11-08 10:52:06 +000034538 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034539}
34540
34541
34542static int
34543test_xmlUCSIsCJKCompatibilityIdeographs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034544 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034545
William M. Brack21e4ef22005-01-02 09:53:13 +000034546#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034547 int mem_base;
34548 int ret_val;
34549 int code; /* UCS code point */
34550 int n_code;
34551
34552 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34553 mem_base = xmlMemBlocks();
34554 code = gen_int(n_code, 0);
34555
34556 ret_val = xmlUCSIsCJKCompatibilityIdeographs(code);
34557 desret_int(ret_val);
34558 call_tests++;
34559 des_int(n_code, code, 0);
34560 xmlResetLastError();
34561 if (mem_base != xmlMemBlocks()) {
34562 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibilityIdeographs",
34563 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034564 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034565 printf(" %d", n_code);
34566 printf("\n");
34567 }
34568 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034569 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034570#endif
34571
Daniel Veillard42595322004-11-08 10:52:06 +000034572 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034573}
34574
34575
34576static int
34577test_xmlUCSIsCJKCompatibilityIdeographsSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034578 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034579
William M. Brack21e4ef22005-01-02 09:53:13 +000034580#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034581 int mem_base;
34582 int ret_val;
34583 int code; /* UCS code point */
34584 int n_code;
34585
34586 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34587 mem_base = xmlMemBlocks();
34588 code = gen_int(n_code, 0);
34589
34590 ret_val = xmlUCSIsCJKCompatibilityIdeographsSupplement(code);
34591 desret_int(ret_val);
34592 call_tests++;
34593 des_int(n_code, code, 0);
34594 xmlResetLastError();
34595 if (mem_base != xmlMemBlocks()) {
34596 printf("Leak of %d blocks found in xmlUCSIsCJKCompatibilityIdeographsSupplement",
34597 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034598 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034599 printf(" %d", n_code);
34600 printf("\n");
34601 }
34602 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034603 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034604#endif
34605
Daniel Veillard42595322004-11-08 10:52:06 +000034606 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034607}
34608
34609
34610static int
34611test_xmlUCSIsCJKRadicalsSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034612 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034613
William M. Brack21e4ef22005-01-02 09:53:13 +000034614#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034615 int mem_base;
34616 int ret_val;
34617 int code; /* UCS code point */
34618 int n_code;
34619
34620 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34621 mem_base = xmlMemBlocks();
34622 code = gen_int(n_code, 0);
34623
34624 ret_val = xmlUCSIsCJKRadicalsSupplement(code);
34625 desret_int(ret_val);
34626 call_tests++;
34627 des_int(n_code, code, 0);
34628 xmlResetLastError();
34629 if (mem_base != xmlMemBlocks()) {
34630 printf("Leak of %d blocks found in xmlUCSIsCJKRadicalsSupplement",
34631 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034632 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034633 printf(" %d", n_code);
34634 printf("\n");
34635 }
34636 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034637 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034638#endif
34639
Daniel Veillard42595322004-11-08 10:52:06 +000034640 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034641}
34642
34643
34644static int
34645test_xmlUCSIsCJKSymbolsandPunctuation(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034646 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034647
William M. Brack21e4ef22005-01-02 09:53:13 +000034648#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034649 int mem_base;
34650 int ret_val;
34651 int code; /* UCS code point */
34652 int n_code;
34653
34654 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34655 mem_base = xmlMemBlocks();
34656 code = gen_int(n_code, 0);
34657
34658 ret_val = xmlUCSIsCJKSymbolsandPunctuation(code);
34659 desret_int(ret_val);
34660 call_tests++;
34661 des_int(n_code, code, 0);
34662 xmlResetLastError();
34663 if (mem_base != xmlMemBlocks()) {
34664 printf("Leak of %d blocks found in xmlUCSIsCJKSymbolsandPunctuation",
34665 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034666 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034667 printf(" %d", n_code);
34668 printf("\n");
34669 }
34670 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034671 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034672#endif
34673
Daniel Veillard42595322004-11-08 10:52:06 +000034674 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034675}
34676
34677
34678static int
34679test_xmlUCSIsCJKUnifiedIdeographs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034680 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034681
William M. Brack21e4ef22005-01-02 09:53:13 +000034682#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034683 int mem_base;
34684 int ret_val;
34685 int code; /* UCS code point */
34686 int n_code;
34687
34688 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34689 mem_base = xmlMemBlocks();
34690 code = gen_int(n_code, 0);
34691
34692 ret_val = xmlUCSIsCJKUnifiedIdeographs(code);
34693 desret_int(ret_val);
34694 call_tests++;
34695 des_int(n_code, code, 0);
34696 xmlResetLastError();
34697 if (mem_base != xmlMemBlocks()) {
34698 printf("Leak of %d blocks found in xmlUCSIsCJKUnifiedIdeographs",
34699 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034700 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034701 printf(" %d", n_code);
34702 printf("\n");
34703 }
34704 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034705 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034706#endif
34707
Daniel Veillard42595322004-11-08 10:52:06 +000034708 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034709}
34710
34711
34712static int
34713test_xmlUCSIsCJKUnifiedIdeographsExtensionA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034714 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034715
William M. Brack21e4ef22005-01-02 09:53:13 +000034716#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034717 int mem_base;
34718 int ret_val;
34719 int code; /* UCS code point */
34720 int n_code;
34721
34722 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34723 mem_base = xmlMemBlocks();
34724 code = gen_int(n_code, 0);
34725
34726 ret_val = xmlUCSIsCJKUnifiedIdeographsExtensionA(code);
34727 desret_int(ret_val);
34728 call_tests++;
34729 des_int(n_code, code, 0);
34730 xmlResetLastError();
34731 if (mem_base != xmlMemBlocks()) {
34732 printf("Leak of %d blocks found in xmlUCSIsCJKUnifiedIdeographsExtensionA",
34733 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034734 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034735 printf(" %d", n_code);
34736 printf("\n");
34737 }
34738 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034739 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034740#endif
34741
Daniel Veillard42595322004-11-08 10:52:06 +000034742 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034743}
34744
34745
34746static int
34747test_xmlUCSIsCJKUnifiedIdeographsExtensionB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034748 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034749
William M. Brack21e4ef22005-01-02 09:53:13 +000034750#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034751 int mem_base;
34752 int ret_val;
34753 int code; /* UCS code point */
34754 int n_code;
34755
34756 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34757 mem_base = xmlMemBlocks();
34758 code = gen_int(n_code, 0);
34759
34760 ret_val = xmlUCSIsCJKUnifiedIdeographsExtensionB(code);
34761 desret_int(ret_val);
34762 call_tests++;
34763 des_int(n_code, code, 0);
34764 xmlResetLastError();
34765 if (mem_base != xmlMemBlocks()) {
34766 printf("Leak of %d blocks found in xmlUCSIsCJKUnifiedIdeographsExtensionB",
34767 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034768 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034769 printf(" %d", n_code);
34770 printf("\n");
34771 }
34772 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034773 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034774#endif
34775
Daniel Veillard42595322004-11-08 10:52:06 +000034776 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034777}
34778
34779
34780static int
34781test_xmlUCSIsCat(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034782 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034783
William M. Brack21e4ef22005-01-02 09:53:13 +000034784#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034785 int mem_base;
34786 int ret_val;
34787 int code; /* UCS code point */
34788 int n_code;
Daniel Veillardce682bc2004-11-05 17:22:25 +000034789 char * cat; /* UCS Category name */
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034790 int n_cat;
34791
34792 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34793 for (n_cat = 0;n_cat < gen_nb_const_char_ptr;n_cat++) {
34794 mem_base = xmlMemBlocks();
34795 code = gen_int(n_code, 0);
34796 cat = gen_const_char_ptr(n_cat, 1);
34797
William M. Brackf13f77f2004-11-12 16:03:48 +000034798 ret_val = xmlUCSIsCat(code, (const char *)cat);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034799 desret_int(ret_val);
34800 call_tests++;
34801 des_int(n_code, code, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000034802 des_const_char_ptr(n_cat, (const char *)cat, 1);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034803 xmlResetLastError();
34804 if (mem_base != xmlMemBlocks()) {
34805 printf("Leak of %d blocks found in xmlUCSIsCat",
34806 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034807 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034808 printf(" %d", n_code);
34809 printf(" %d", n_cat);
34810 printf("\n");
34811 }
34812 }
34813 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034814 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034815#endif
34816
Daniel Veillard42595322004-11-08 10:52:06 +000034817 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034818}
34819
34820
34821static int
34822test_xmlUCSIsCatC(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034823 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034824
William M. Brack21e4ef22005-01-02 09:53:13 +000034825#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034826 int mem_base;
34827 int ret_val;
34828 int code; /* UCS code point */
34829 int n_code;
34830
34831 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34832 mem_base = xmlMemBlocks();
34833 code = gen_int(n_code, 0);
34834
34835 ret_val = xmlUCSIsCatC(code);
34836 desret_int(ret_val);
34837 call_tests++;
34838 des_int(n_code, code, 0);
34839 xmlResetLastError();
34840 if (mem_base != xmlMemBlocks()) {
34841 printf("Leak of %d blocks found in xmlUCSIsCatC",
34842 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034843 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034844 printf(" %d", n_code);
34845 printf("\n");
34846 }
34847 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034848 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034849#endif
34850
Daniel Veillard42595322004-11-08 10:52:06 +000034851 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034852}
34853
34854
34855static int
34856test_xmlUCSIsCatCc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034857 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034858
William M. Brack21e4ef22005-01-02 09:53:13 +000034859#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034860 int mem_base;
34861 int ret_val;
34862 int code; /* UCS code point */
34863 int n_code;
34864
34865 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34866 mem_base = xmlMemBlocks();
34867 code = gen_int(n_code, 0);
34868
34869 ret_val = xmlUCSIsCatCc(code);
34870 desret_int(ret_val);
34871 call_tests++;
34872 des_int(n_code, code, 0);
34873 xmlResetLastError();
34874 if (mem_base != xmlMemBlocks()) {
34875 printf("Leak of %d blocks found in xmlUCSIsCatCc",
34876 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034877 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034878 printf(" %d", n_code);
34879 printf("\n");
34880 }
34881 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034882 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034883#endif
34884
Daniel Veillard42595322004-11-08 10:52:06 +000034885 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034886}
34887
34888
34889static int
34890test_xmlUCSIsCatCf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034891 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034892
William M. Brack21e4ef22005-01-02 09:53:13 +000034893#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034894 int mem_base;
34895 int ret_val;
34896 int code; /* UCS code point */
34897 int n_code;
34898
34899 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34900 mem_base = xmlMemBlocks();
34901 code = gen_int(n_code, 0);
34902
34903 ret_val = xmlUCSIsCatCf(code);
34904 desret_int(ret_val);
34905 call_tests++;
34906 des_int(n_code, code, 0);
34907 xmlResetLastError();
34908 if (mem_base != xmlMemBlocks()) {
34909 printf("Leak of %d blocks found in xmlUCSIsCatCf",
34910 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034911 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034912 printf(" %d", n_code);
34913 printf("\n");
34914 }
34915 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034916 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034917#endif
34918
Daniel Veillard42595322004-11-08 10:52:06 +000034919 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034920}
34921
34922
34923static int
34924test_xmlUCSIsCatCo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034925 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034926
William M. Brack21e4ef22005-01-02 09:53:13 +000034927#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034928 int mem_base;
34929 int ret_val;
34930 int code; /* UCS code point */
34931 int n_code;
34932
34933 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34934 mem_base = xmlMemBlocks();
34935 code = gen_int(n_code, 0);
34936
34937 ret_val = xmlUCSIsCatCo(code);
34938 desret_int(ret_val);
34939 call_tests++;
34940 des_int(n_code, code, 0);
34941 xmlResetLastError();
34942 if (mem_base != xmlMemBlocks()) {
34943 printf("Leak of %d blocks found in xmlUCSIsCatCo",
34944 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034945 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034946 printf(" %d", n_code);
34947 printf("\n");
34948 }
34949 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034950 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034951#endif
34952
Daniel Veillard42595322004-11-08 10:52:06 +000034953 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034954}
34955
34956
34957static int
34958test_xmlUCSIsCatCs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034959 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034960
William M. Brack21e4ef22005-01-02 09:53:13 +000034961#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034962 int mem_base;
34963 int ret_val;
34964 int code; /* UCS code point */
34965 int n_code;
34966
34967 for (n_code = 0;n_code < gen_nb_int;n_code++) {
34968 mem_base = xmlMemBlocks();
34969 code = gen_int(n_code, 0);
34970
34971 ret_val = xmlUCSIsCatCs(code);
34972 desret_int(ret_val);
34973 call_tests++;
34974 des_int(n_code, code, 0);
34975 xmlResetLastError();
34976 if (mem_base != xmlMemBlocks()) {
34977 printf("Leak of %d blocks found in xmlUCSIsCatCs",
34978 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000034979 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034980 printf(" %d", n_code);
34981 printf("\n");
34982 }
34983 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000034984 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034985#endif
34986
Daniel Veillard42595322004-11-08 10:52:06 +000034987 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034988}
34989
34990
34991static int
34992test_xmlUCSIsCatL(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000034993 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034994
William M. Brack21e4ef22005-01-02 09:53:13 +000034995#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000034996 int mem_base;
34997 int ret_val;
34998 int code; /* UCS code point */
34999 int n_code;
35000
35001 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35002 mem_base = xmlMemBlocks();
35003 code = gen_int(n_code, 0);
35004
35005 ret_val = xmlUCSIsCatL(code);
35006 desret_int(ret_val);
35007 call_tests++;
35008 des_int(n_code, code, 0);
35009 xmlResetLastError();
35010 if (mem_base != xmlMemBlocks()) {
35011 printf("Leak of %d blocks found in xmlUCSIsCatL",
35012 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035013 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035014 printf(" %d", n_code);
35015 printf("\n");
35016 }
35017 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035018 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035019#endif
35020
Daniel Veillard42595322004-11-08 10:52:06 +000035021 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035022}
35023
35024
35025static int
35026test_xmlUCSIsCatLl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035027 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035028
William M. Brack21e4ef22005-01-02 09:53:13 +000035029#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035030 int mem_base;
35031 int ret_val;
35032 int code; /* UCS code point */
35033 int n_code;
35034
35035 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35036 mem_base = xmlMemBlocks();
35037 code = gen_int(n_code, 0);
35038
35039 ret_val = xmlUCSIsCatLl(code);
35040 desret_int(ret_val);
35041 call_tests++;
35042 des_int(n_code, code, 0);
35043 xmlResetLastError();
35044 if (mem_base != xmlMemBlocks()) {
35045 printf("Leak of %d blocks found in xmlUCSIsCatLl",
35046 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035047 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035048 printf(" %d", n_code);
35049 printf("\n");
35050 }
35051 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035052 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035053#endif
35054
Daniel Veillard42595322004-11-08 10:52:06 +000035055 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035056}
35057
35058
35059static int
35060test_xmlUCSIsCatLm(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035061 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035062
William M. Brack21e4ef22005-01-02 09:53:13 +000035063#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035064 int mem_base;
35065 int ret_val;
35066 int code; /* UCS code point */
35067 int n_code;
35068
35069 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35070 mem_base = xmlMemBlocks();
35071 code = gen_int(n_code, 0);
35072
35073 ret_val = xmlUCSIsCatLm(code);
35074 desret_int(ret_val);
35075 call_tests++;
35076 des_int(n_code, code, 0);
35077 xmlResetLastError();
35078 if (mem_base != xmlMemBlocks()) {
35079 printf("Leak of %d blocks found in xmlUCSIsCatLm",
35080 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035081 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035082 printf(" %d", n_code);
35083 printf("\n");
35084 }
35085 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035086 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035087#endif
35088
Daniel Veillard42595322004-11-08 10:52:06 +000035089 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035090}
35091
35092
35093static int
35094test_xmlUCSIsCatLo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035095 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035096
William M. Brack21e4ef22005-01-02 09:53:13 +000035097#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035098 int mem_base;
35099 int ret_val;
35100 int code; /* UCS code point */
35101 int n_code;
35102
35103 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35104 mem_base = xmlMemBlocks();
35105 code = gen_int(n_code, 0);
35106
35107 ret_val = xmlUCSIsCatLo(code);
35108 desret_int(ret_val);
35109 call_tests++;
35110 des_int(n_code, code, 0);
35111 xmlResetLastError();
35112 if (mem_base != xmlMemBlocks()) {
35113 printf("Leak of %d blocks found in xmlUCSIsCatLo",
35114 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035115 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035116 printf(" %d", n_code);
35117 printf("\n");
35118 }
35119 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035120 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035121#endif
35122
Daniel Veillard42595322004-11-08 10:52:06 +000035123 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035124}
35125
35126
35127static int
35128test_xmlUCSIsCatLt(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035129 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035130
William M. Brack21e4ef22005-01-02 09:53:13 +000035131#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035132 int mem_base;
35133 int ret_val;
35134 int code; /* UCS code point */
35135 int n_code;
35136
35137 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35138 mem_base = xmlMemBlocks();
35139 code = gen_int(n_code, 0);
35140
35141 ret_val = xmlUCSIsCatLt(code);
35142 desret_int(ret_val);
35143 call_tests++;
35144 des_int(n_code, code, 0);
35145 xmlResetLastError();
35146 if (mem_base != xmlMemBlocks()) {
35147 printf("Leak of %d blocks found in xmlUCSIsCatLt",
35148 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035149 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035150 printf(" %d", n_code);
35151 printf("\n");
35152 }
35153 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035154 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035155#endif
35156
Daniel Veillard42595322004-11-08 10:52:06 +000035157 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035158}
35159
35160
35161static int
35162test_xmlUCSIsCatLu(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035163 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035164
William M. Brack21e4ef22005-01-02 09:53:13 +000035165#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035166 int mem_base;
35167 int ret_val;
35168 int code; /* UCS code point */
35169 int n_code;
35170
35171 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35172 mem_base = xmlMemBlocks();
35173 code = gen_int(n_code, 0);
35174
35175 ret_val = xmlUCSIsCatLu(code);
35176 desret_int(ret_val);
35177 call_tests++;
35178 des_int(n_code, code, 0);
35179 xmlResetLastError();
35180 if (mem_base != xmlMemBlocks()) {
35181 printf("Leak of %d blocks found in xmlUCSIsCatLu",
35182 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035183 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035184 printf(" %d", n_code);
35185 printf("\n");
35186 }
35187 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035188 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035189#endif
35190
Daniel Veillard42595322004-11-08 10:52:06 +000035191 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035192}
35193
35194
35195static int
35196test_xmlUCSIsCatM(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035197 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035198
William M. Brack21e4ef22005-01-02 09:53:13 +000035199#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035200 int mem_base;
35201 int ret_val;
35202 int code; /* UCS code point */
35203 int n_code;
35204
35205 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35206 mem_base = xmlMemBlocks();
35207 code = gen_int(n_code, 0);
35208
35209 ret_val = xmlUCSIsCatM(code);
35210 desret_int(ret_val);
35211 call_tests++;
35212 des_int(n_code, code, 0);
35213 xmlResetLastError();
35214 if (mem_base != xmlMemBlocks()) {
35215 printf("Leak of %d blocks found in xmlUCSIsCatM",
35216 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035217 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035218 printf(" %d", n_code);
35219 printf("\n");
35220 }
35221 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035222 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035223#endif
35224
Daniel Veillard42595322004-11-08 10:52:06 +000035225 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035226}
35227
35228
35229static int
35230test_xmlUCSIsCatMc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035231 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035232
William M. Brack21e4ef22005-01-02 09:53:13 +000035233#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035234 int mem_base;
35235 int ret_val;
35236 int code; /* UCS code point */
35237 int n_code;
35238
35239 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35240 mem_base = xmlMemBlocks();
35241 code = gen_int(n_code, 0);
35242
35243 ret_val = xmlUCSIsCatMc(code);
35244 desret_int(ret_val);
35245 call_tests++;
35246 des_int(n_code, code, 0);
35247 xmlResetLastError();
35248 if (mem_base != xmlMemBlocks()) {
35249 printf("Leak of %d blocks found in xmlUCSIsCatMc",
35250 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035251 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035252 printf(" %d", n_code);
35253 printf("\n");
35254 }
35255 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035256 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035257#endif
35258
Daniel Veillard42595322004-11-08 10:52:06 +000035259 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035260}
35261
35262
35263static int
35264test_xmlUCSIsCatMe(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035265 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035266
William M. Brack21e4ef22005-01-02 09:53:13 +000035267#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035268 int mem_base;
35269 int ret_val;
35270 int code; /* UCS code point */
35271 int n_code;
35272
35273 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35274 mem_base = xmlMemBlocks();
35275 code = gen_int(n_code, 0);
35276
35277 ret_val = xmlUCSIsCatMe(code);
35278 desret_int(ret_val);
35279 call_tests++;
35280 des_int(n_code, code, 0);
35281 xmlResetLastError();
35282 if (mem_base != xmlMemBlocks()) {
35283 printf("Leak of %d blocks found in xmlUCSIsCatMe",
35284 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035285 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035286 printf(" %d", n_code);
35287 printf("\n");
35288 }
35289 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035290 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035291#endif
35292
Daniel Veillard42595322004-11-08 10:52:06 +000035293 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035294}
35295
35296
35297static int
35298test_xmlUCSIsCatMn(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035299 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035300
William M. Brack21e4ef22005-01-02 09:53:13 +000035301#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035302 int mem_base;
35303 int ret_val;
35304 int code; /* UCS code point */
35305 int n_code;
35306
35307 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35308 mem_base = xmlMemBlocks();
35309 code = gen_int(n_code, 0);
35310
35311 ret_val = xmlUCSIsCatMn(code);
35312 desret_int(ret_val);
35313 call_tests++;
35314 des_int(n_code, code, 0);
35315 xmlResetLastError();
35316 if (mem_base != xmlMemBlocks()) {
35317 printf("Leak of %d blocks found in xmlUCSIsCatMn",
35318 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035319 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035320 printf(" %d", n_code);
35321 printf("\n");
35322 }
35323 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035324 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035325#endif
35326
Daniel Veillard42595322004-11-08 10:52:06 +000035327 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035328}
35329
35330
35331static int
35332test_xmlUCSIsCatN(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035333 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035334
William M. Brack21e4ef22005-01-02 09:53:13 +000035335#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035336 int mem_base;
35337 int ret_val;
35338 int code; /* UCS code point */
35339 int n_code;
35340
35341 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35342 mem_base = xmlMemBlocks();
35343 code = gen_int(n_code, 0);
35344
35345 ret_val = xmlUCSIsCatN(code);
35346 desret_int(ret_val);
35347 call_tests++;
35348 des_int(n_code, code, 0);
35349 xmlResetLastError();
35350 if (mem_base != xmlMemBlocks()) {
35351 printf("Leak of %d blocks found in xmlUCSIsCatN",
35352 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035353 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035354 printf(" %d", n_code);
35355 printf("\n");
35356 }
35357 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035358 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035359#endif
35360
Daniel Veillard42595322004-11-08 10:52:06 +000035361 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035362}
35363
35364
35365static int
35366test_xmlUCSIsCatNd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035367 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035368
William M. Brack21e4ef22005-01-02 09:53:13 +000035369#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035370 int mem_base;
35371 int ret_val;
35372 int code; /* UCS code point */
35373 int n_code;
35374
35375 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35376 mem_base = xmlMemBlocks();
35377 code = gen_int(n_code, 0);
35378
35379 ret_val = xmlUCSIsCatNd(code);
35380 desret_int(ret_val);
35381 call_tests++;
35382 des_int(n_code, code, 0);
35383 xmlResetLastError();
35384 if (mem_base != xmlMemBlocks()) {
35385 printf("Leak of %d blocks found in xmlUCSIsCatNd",
35386 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035387 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035388 printf(" %d", n_code);
35389 printf("\n");
35390 }
35391 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035392 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035393#endif
35394
Daniel Veillard42595322004-11-08 10:52:06 +000035395 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035396}
35397
35398
35399static int
35400test_xmlUCSIsCatNl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035401 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035402
William M. Brack21e4ef22005-01-02 09:53:13 +000035403#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035404 int mem_base;
35405 int ret_val;
35406 int code; /* UCS code point */
35407 int n_code;
35408
35409 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35410 mem_base = xmlMemBlocks();
35411 code = gen_int(n_code, 0);
35412
35413 ret_val = xmlUCSIsCatNl(code);
35414 desret_int(ret_val);
35415 call_tests++;
35416 des_int(n_code, code, 0);
35417 xmlResetLastError();
35418 if (mem_base != xmlMemBlocks()) {
35419 printf("Leak of %d blocks found in xmlUCSIsCatNl",
35420 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035421 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035422 printf(" %d", n_code);
35423 printf("\n");
35424 }
35425 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035426 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035427#endif
35428
Daniel Veillard42595322004-11-08 10:52:06 +000035429 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035430}
35431
35432
35433static int
35434test_xmlUCSIsCatNo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035435 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035436
William M. Brack21e4ef22005-01-02 09:53:13 +000035437#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035438 int mem_base;
35439 int ret_val;
35440 int code; /* UCS code point */
35441 int n_code;
35442
35443 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35444 mem_base = xmlMemBlocks();
35445 code = gen_int(n_code, 0);
35446
35447 ret_val = xmlUCSIsCatNo(code);
35448 desret_int(ret_val);
35449 call_tests++;
35450 des_int(n_code, code, 0);
35451 xmlResetLastError();
35452 if (mem_base != xmlMemBlocks()) {
35453 printf("Leak of %d blocks found in xmlUCSIsCatNo",
35454 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035455 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035456 printf(" %d", n_code);
35457 printf("\n");
35458 }
35459 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035460 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035461#endif
35462
Daniel Veillard42595322004-11-08 10:52:06 +000035463 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035464}
35465
35466
35467static int
35468test_xmlUCSIsCatP(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035469 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035470
William M. Brack21e4ef22005-01-02 09:53:13 +000035471#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035472 int mem_base;
35473 int ret_val;
35474 int code; /* UCS code point */
35475 int n_code;
35476
35477 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35478 mem_base = xmlMemBlocks();
35479 code = gen_int(n_code, 0);
35480
35481 ret_val = xmlUCSIsCatP(code);
35482 desret_int(ret_val);
35483 call_tests++;
35484 des_int(n_code, code, 0);
35485 xmlResetLastError();
35486 if (mem_base != xmlMemBlocks()) {
35487 printf("Leak of %d blocks found in xmlUCSIsCatP",
35488 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035489 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035490 printf(" %d", n_code);
35491 printf("\n");
35492 }
35493 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035494 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035495#endif
35496
Daniel Veillard42595322004-11-08 10:52:06 +000035497 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035498}
35499
35500
35501static int
35502test_xmlUCSIsCatPc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035503 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035504
William M. Brack21e4ef22005-01-02 09:53:13 +000035505#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035506 int mem_base;
35507 int ret_val;
35508 int code; /* UCS code point */
35509 int n_code;
35510
35511 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35512 mem_base = xmlMemBlocks();
35513 code = gen_int(n_code, 0);
35514
35515 ret_val = xmlUCSIsCatPc(code);
35516 desret_int(ret_val);
35517 call_tests++;
35518 des_int(n_code, code, 0);
35519 xmlResetLastError();
35520 if (mem_base != xmlMemBlocks()) {
35521 printf("Leak of %d blocks found in xmlUCSIsCatPc",
35522 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035523 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035524 printf(" %d", n_code);
35525 printf("\n");
35526 }
35527 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035528 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035529#endif
35530
Daniel Veillard42595322004-11-08 10:52:06 +000035531 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035532}
35533
35534
35535static int
35536test_xmlUCSIsCatPd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035537 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035538
William M. Brack21e4ef22005-01-02 09:53:13 +000035539#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035540 int mem_base;
35541 int ret_val;
35542 int code; /* UCS code point */
35543 int n_code;
35544
35545 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35546 mem_base = xmlMemBlocks();
35547 code = gen_int(n_code, 0);
35548
35549 ret_val = xmlUCSIsCatPd(code);
35550 desret_int(ret_val);
35551 call_tests++;
35552 des_int(n_code, code, 0);
35553 xmlResetLastError();
35554 if (mem_base != xmlMemBlocks()) {
35555 printf("Leak of %d blocks found in xmlUCSIsCatPd",
35556 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035557 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035558 printf(" %d", n_code);
35559 printf("\n");
35560 }
35561 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035562 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035563#endif
35564
Daniel Veillard42595322004-11-08 10:52:06 +000035565 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035566}
35567
35568
35569static int
35570test_xmlUCSIsCatPe(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035571 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035572
William M. Brack21e4ef22005-01-02 09:53:13 +000035573#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035574 int mem_base;
35575 int ret_val;
35576 int code; /* UCS code point */
35577 int n_code;
35578
35579 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35580 mem_base = xmlMemBlocks();
35581 code = gen_int(n_code, 0);
35582
35583 ret_val = xmlUCSIsCatPe(code);
35584 desret_int(ret_val);
35585 call_tests++;
35586 des_int(n_code, code, 0);
35587 xmlResetLastError();
35588 if (mem_base != xmlMemBlocks()) {
35589 printf("Leak of %d blocks found in xmlUCSIsCatPe",
35590 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035591 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035592 printf(" %d", n_code);
35593 printf("\n");
35594 }
35595 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035596 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035597#endif
35598
Daniel Veillard42595322004-11-08 10:52:06 +000035599 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035600}
35601
35602
35603static int
35604test_xmlUCSIsCatPf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035605 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035606
William M. Brack21e4ef22005-01-02 09:53:13 +000035607#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035608 int mem_base;
35609 int ret_val;
35610 int code; /* UCS code point */
35611 int n_code;
35612
35613 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35614 mem_base = xmlMemBlocks();
35615 code = gen_int(n_code, 0);
35616
35617 ret_val = xmlUCSIsCatPf(code);
35618 desret_int(ret_val);
35619 call_tests++;
35620 des_int(n_code, code, 0);
35621 xmlResetLastError();
35622 if (mem_base != xmlMemBlocks()) {
35623 printf("Leak of %d blocks found in xmlUCSIsCatPf",
35624 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035625 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035626 printf(" %d", n_code);
35627 printf("\n");
35628 }
35629 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035630 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035631#endif
35632
Daniel Veillard42595322004-11-08 10:52:06 +000035633 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035634}
35635
35636
35637static int
35638test_xmlUCSIsCatPi(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035639 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035640
William M. Brack21e4ef22005-01-02 09:53:13 +000035641#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035642 int mem_base;
35643 int ret_val;
35644 int code; /* UCS code point */
35645 int n_code;
35646
35647 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35648 mem_base = xmlMemBlocks();
35649 code = gen_int(n_code, 0);
35650
35651 ret_val = xmlUCSIsCatPi(code);
35652 desret_int(ret_val);
35653 call_tests++;
35654 des_int(n_code, code, 0);
35655 xmlResetLastError();
35656 if (mem_base != xmlMemBlocks()) {
35657 printf("Leak of %d blocks found in xmlUCSIsCatPi",
35658 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035659 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035660 printf(" %d", n_code);
35661 printf("\n");
35662 }
35663 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035664 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035665#endif
35666
Daniel Veillard42595322004-11-08 10:52:06 +000035667 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035668}
35669
35670
35671static int
35672test_xmlUCSIsCatPo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035673 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035674
William M. Brack21e4ef22005-01-02 09:53:13 +000035675#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035676 int mem_base;
35677 int ret_val;
35678 int code; /* UCS code point */
35679 int n_code;
35680
35681 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35682 mem_base = xmlMemBlocks();
35683 code = gen_int(n_code, 0);
35684
35685 ret_val = xmlUCSIsCatPo(code);
35686 desret_int(ret_val);
35687 call_tests++;
35688 des_int(n_code, code, 0);
35689 xmlResetLastError();
35690 if (mem_base != xmlMemBlocks()) {
35691 printf("Leak of %d blocks found in xmlUCSIsCatPo",
35692 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035693 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035694 printf(" %d", n_code);
35695 printf("\n");
35696 }
35697 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035698 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035699#endif
35700
Daniel Veillard42595322004-11-08 10:52:06 +000035701 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035702}
35703
35704
35705static int
35706test_xmlUCSIsCatPs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035707 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035708
William M. Brack21e4ef22005-01-02 09:53:13 +000035709#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035710 int mem_base;
35711 int ret_val;
35712 int code; /* UCS code point */
35713 int n_code;
35714
35715 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35716 mem_base = xmlMemBlocks();
35717 code = gen_int(n_code, 0);
35718
35719 ret_val = xmlUCSIsCatPs(code);
35720 desret_int(ret_val);
35721 call_tests++;
35722 des_int(n_code, code, 0);
35723 xmlResetLastError();
35724 if (mem_base != xmlMemBlocks()) {
35725 printf("Leak of %d blocks found in xmlUCSIsCatPs",
35726 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035727 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035728 printf(" %d", n_code);
35729 printf("\n");
35730 }
35731 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035732 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035733#endif
35734
Daniel Veillard42595322004-11-08 10:52:06 +000035735 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035736}
35737
35738
35739static int
35740test_xmlUCSIsCatS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035741 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035742
William M. Brack21e4ef22005-01-02 09:53:13 +000035743#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035744 int mem_base;
35745 int ret_val;
35746 int code; /* UCS code point */
35747 int n_code;
35748
35749 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35750 mem_base = xmlMemBlocks();
35751 code = gen_int(n_code, 0);
35752
35753 ret_val = xmlUCSIsCatS(code);
35754 desret_int(ret_val);
35755 call_tests++;
35756 des_int(n_code, code, 0);
35757 xmlResetLastError();
35758 if (mem_base != xmlMemBlocks()) {
35759 printf("Leak of %d blocks found in xmlUCSIsCatS",
35760 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035761 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035762 printf(" %d", n_code);
35763 printf("\n");
35764 }
35765 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035766 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035767#endif
35768
Daniel Veillard42595322004-11-08 10:52:06 +000035769 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035770}
35771
35772
35773static int
35774test_xmlUCSIsCatSc(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035775 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035776
William M. Brack21e4ef22005-01-02 09:53:13 +000035777#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035778 int mem_base;
35779 int ret_val;
35780 int code; /* UCS code point */
35781 int n_code;
35782
35783 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35784 mem_base = xmlMemBlocks();
35785 code = gen_int(n_code, 0);
35786
35787 ret_val = xmlUCSIsCatSc(code);
35788 desret_int(ret_val);
35789 call_tests++;
35790 des_int(n_code, code, 0);
35791 xmlResetLastError();
35792 if (mem_base != xmlMemBlocks()) {
35793 printf("Leak of %d blocks found in xmlUCSIsCatSc",
35794 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035795 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035796 printf(" %d", n_code);
35797 printf("\n");
35798 }
35799 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035800 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035801#endif
35802
Daniel Veillard42595322004-11-08 10:52:06 +000035803 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035804}
35805
35806
35807static int
35808test_xmlUCSIsCatSk(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035809 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035810
William M. Brack21e4ef22005-01-02 09:53:13 +000035811#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035812 int mem_base;
35813 int ret_val;
35814 int code; /* UCS code point */
35815 int n_code;
35816
35817 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35818 mem_base = xmlMemBlocks();
35819 code = gen_int(n_code, 0);
35820
35821 ret_val = xmlUCSIsCatSk(code);
35822 desret_int(ret_val);
35823 call_tests++;
35824 des_int(n_code, code, 0);
35825 xmlResetLastError();
35826 if (mem_base != xmlMemBlocks()) {
35827 printf("Leak of %d blocks found in xmlUCSIsCatSk",
35828 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035829 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035830 printf(" %d", n_code);
35831 printf("\n");
35832 }
35833 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035834 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035835#endif
35836
Daniel Veillard42595322004-11-08 10:52:06 +000035837 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035838}
35839
35840
35841static int
35842test_xmlUCSIsCatSm(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035843 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035844
William M. Brack21e4ef22005-01-02 09:53:13 +000035845#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035846 int mem_base;
35847 int ret_val;
35848 int code; /* UCS code point */
35849 int n_code;
35850
35851 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35852 mem_base = xmlMemBlocks();
35853 code = gen_int(n_code, 0);
35854
35855 ret_val = xmlUCSIsCatSm(code);
35856 desret_int(ret_val);
35857 call_tests++;
35858 des_int(n_code, code, 0);
35859 xmlResetLastError();
35860 if (mem_base != xmlMemBlocks()) {
35861 printf("Leak of %d blocks found in xmlUCSIsCatSm",
35862 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035863 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035864 printf(" %d", n_code);
35865 printf("\n");
35866 }
35867 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035868 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035869#endif
35870
Daniel Veillard42595322004-11-08 10:52:06 +000035871 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035872}
35873
35874
35875static int
35876test_xmlUCSIsCatSo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035877 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035878
William M. Brack21e4ef22005-01-02 09:53:13 +000035879#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035880 int mem_base;
35881 int ret_val;
35882 int code; /* UCS code point */
35883 int n_code;
35884
35885 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35886 mem_base = xmlMemBlocks();
35887 code = gen_int(n_code, 0);
35888
35889 ret_val = xmlUCSIsCatSo(code);
35890 desret_int(ret_val);
35891 call_tests++;
35892 des_int(n_code, code, 0);
35893 xmlResetLastError();
35894 if (mem_base != xmlMemBlocks()) {
35895 printf("Leak of %d blocks found in xmlUCSIsCatSo",
35896 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035897 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035898 printf(" %d", n_code);
35899 printf("\n");
35900 }
35901 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035902 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035903#endif
35904
Daniel Veillard42595322004-11-08 10:52:06 +000035905 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035906}
35907
35908
35909static int
35910test_xmlUCSIsCatZ(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035911 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035912
William M. Brack21e4ef22005-01-02 09:53:13 +000035913#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035914 int mem_base;
35915 int ret_val;
35916 int code; /* UCS code point */
35917 int n_code;
35918
35919 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35920 mem_base = xmlMemBlocks();
35921 code = gen_int(n_code, 0);
35922
35923 ret_val = xmlUCSIsCatZ(code);
35924 desret_int(ret_val);
35925 call_tests++;
35926 des_int(n_code, code, 0);
35927 xmlResetLastError();
35928 if (mem_base != xmlMemBlocks()) {
35929 printf("Leak of %d blocks found in xmlUCSIsCatZ",
35930 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035931 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035932 printf(" %d", n_code);
35933 printf("\n");
35934 }
35935 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035936 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035937#endif
35938
Daniel Veillard42595322004-11-08 10:52:06 +000035939 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035940}
35941
35942
35943static int
35944test_xmlUCSIsCatZl(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035945 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035946
William M. Brack21e4ef22005-01-02 09:53:13 +000035947#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035948 int mem_base;
35949 int ret_val;
35950 int code; /* UCS code point */
35951 int n_code;
35952
35953 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35954 mem_base = xmlMemBlocks();
35955 code = gen_int(n_code, 0);
35956
35957 ret_val = xmlUCSIsCatZl(code);
35958 desret_int(ret_val);
35959 call_tests++;
35960 des_int(n_code, code, 0);
35961 xmlResetLastError();
35962 if (mem_base != xmlMemBlocks()) {
35963 printf("Leak of %d blocks found in xmlUCSIsCatZl",
35964 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035965 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035966 printf(" %d", n_code);
35967 printf("\n");
35968 }
35969 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000035970 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035971#endif
35972
Daniel Veillard42595322004-11-08 10:52:06 +000035973 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035974}
35975
35976
35977static int
35978test_xmlUCSIsCatZp(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000035979 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035980
William M. Brack21e4ef22005-01-02 09:53:13 +000035981#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000035982 int mem_base;
35983 int ret_val;
35984 int code; /* UCS code point */
35985 int n_code;
35986
35987 for (n_code = 0;n_code < gen_nb_int;n_code++) {
35988 mem_base = xmlMemBlocks();
35989 code = gen_int(n_code, 0);
35990
35991 ret_val = xmlUCSIsCatZp(code);
35992 desret_int(ret_val);
35993 call_tests++;
35994 des_int(n_code, code, 0);
35995 xmlResetLastError();
35996 if (mem_base != xmlMemBlocks()) {
35997 printf("Leak of %d blocks found in xmlUCSIsCatZp",
35998 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000035999 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036000 printf(" %d", n_code);
36001 printf("\n");
36002 }
36003 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036004 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036005#endif
36006
Daniel Veillard42595322004-11-08 10:52:06 +000036007 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036008}
36009
36010
36011static int
36012test_xmlUCSIsCatZs(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036013 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036014
William M. Brack21e4ef22005-01-02 09:53:13 +000036015#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036016 int mem_base;
36017 int ret_val;
36018 int code; /* UCS code point */
36019 int n_code;
36020
36021 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36022 mem_base = xmlMemBlocks();
36023 code = gen_int(n_code, 0);
36024
36025 ret_val = xmlUCSIsCatZs(code);
36026 desret_int(ret_val);
36027 call_tests++;
36028 des_int(n_code, code, 0);
36029 xmlResetLastError();
36030 if (mem_base != xmlMemBlocks()) {
36031 printf("Leak of %d blocks found in xmlUCSIsCatZs",
36032 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036033 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036034 printf(" %d", n_code);
36035 printf("\n");
36036 }
36037 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036038 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036039#endif
36040
Daniel Veillard42595322004-11-08 10:52:06 +000036041 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036042}
36043
36044
36045static int
36046test_xmlUCSIsCherokee(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036047 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036048
William M. Brack21e4ef22005-01-02 09:53:13 +000036049#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036050 int mem_base;
36051 int ret_val;
36052 int code; /* UCS code point */
36053 int n_code;
36054
36055 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36056 mem_base = xmlMemBlocks();
36057 code = gen_int(n_code, 0);
36058
36059 ret_val = xmlUCSIsCherokee(code);
36060 desret_int(ret_val);
36061 call_tests++;
36062 des_int(n_code, code, 0);
36063 xmlResetLastError();
36064 if (mem_base != xmlMemBlocks()) {
36065 printf("Leak of %d blocks found in xmlUCSIsCherokee",
36066 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036067 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036068 printf(" %d", n_code);
36069 printf("\n");
36070 }
36071 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036072 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036073#endif
36074
Daniel Veillard42595322004-11-08 10:52:06 +000036075 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036076}
36077
36078
36079static int
36080test_xmlUCSIsCombiningDiacriticalMarks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036081 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036082
William M. Brack21e4ef22005-01-02 09:53:13 +000036083#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036084 int mem_base;
36085 int ret_val;
36086 int code; /* UCS code point */
36087 int n_code;
36088
36089 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36090 mem_base = xmlMemBlocks();
36091 code = gen_int(n_code, 0);
36092
36093 ret_val = xmlUCSIsCombiningDiacriticalMarks(code);
36094 desret_int(ret_val);
36095 call_tests++;
36096 des_int(n_code, code, 0);
36097 xmlResetLastError();
36098 if (mem_base != xmlMemBlocks()) {
36099 printf("Leak of %d blocks found in xmlUCSIsCombiningDiacriticalMarks",
36100 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036101 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036102 printf(" %d", n_code);
36103 printf("\n");
36104 }
36105 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036106 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036107#endif
36108
Daniel Veillard42595322004-11-08 10:52:06 +000036109 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036110}
36111
36112
36113static int
36114test_xmlUCSIsCombiningDiacriticalMarksforSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036115 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036116
William M. Brack21e4ef22005-01-02 09:53:13 +000036117#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036118 int mem_base;
36119 int ret_val;
36120 int code; /* UCS code point */
36121 int n_code;
36122
36123 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36124 mem_base = xmlMemBlocks();
36125 code = gen_int(n_code, 0);
36126
36127 ret_val = xmlUCSIsCombiningDiacriticalMarksforSymbols(code);
36128 desret_int(ret_val);
36129 call_tests++;
36130 des_int(n_code, code, 0);
36131 xmlResetLastError();
36132 if (mem_base != xmlMemBlocks()) {
36133 printf("Leak of %d blocks found in xmlUCSIsCombiningDiacriticalMarksforSymbols",
36134 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036135 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036136 printf(" %d", n_code);
36137 printf("\n");
36138 }
36139 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036140 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036141#endif
36142
Daniel Veillard42595322004-11-08 10:52:06 +000036143 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036144}
36145
36146
36147static int
36148test_xmlUCSIsCombiningHalfMarks(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036149 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036150
William M. Brack21e4ef22005-01-02 09:53:13 +000036151#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036152 int mem_base;
36153 int ret_val;
36154 int code; /* UCS code point */
36155 int n_code;
36156
36157 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36158 mem_base = xmlMemBlocks();
36159 code = gen_int(n_code, 0);
36160
36161 ret_val = xmlUCSIsCombiningHalfMarks(code);
36162 desret_int(ret_val);
36163 call_tests++;
36164 des_int(n_code, code, 0);
36165 xmlResetLastError();
36166 if (mem_base != xmlMemBlocks()) {
36167 printf("Leak of %d blocks found in xmlUCSIsCombiningHalfMarks",
36168 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036169 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036170 printf(" %d", n_code);
36171 printf("\n");
36172 }
36173 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036174 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036175#endif
36176
Daniel Veillard42595322004-11-08 10:52:06 +000036177 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036178}
36179
36180
36181static int
36182test_xmlUCSIsCombiningMarksforSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036183 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036184
William M. Brack21e4ef22005-01-02 09:53:13 +000036185#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036186 int mem_base;
36187 int ret_val;
36188 int code; /* UCS code point */
36189 int n_code;
36190
36191 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36192 mem_base = xmlMemBlocks();
36193 code = gen_int(n_code, 0);
36194
36195 ret_val = xmlUCSIsCombiningMarksforSymbols(code);
36196 desret_int(ret_val);
36197 call_tests++;
36198 des_int(n_code, code, 0);
36199 xmlResetLastError();
36200 if (mem_base != xmlMemBlocks()) {
36201 printf("Leak of %d blocks found in xmlUCSIsCombiningMarksforSymbols",
36202 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036203 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036204 printf(" %d", n_code);
36205 printf("\n");
36206 }
36207 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036208 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036209#endif
36210
Daniel Veillard42595322004-11-08 10:52:06 +000036211 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036212}
36213
36214
36215static int
36216test_xmlUCSIsControlPictures(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036217 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036218
William M. Brack21e4ef22005-01-02 09:53:13 +000036219#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036220 int mem_base;
36221 int ret_val;
36222 int code; /* UCS code point */
36223 int n_code;
36224
36225 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36226 mem_base = xmlMemBlocks();
36227 code = gen_int(n_code, 0);
36228
36229 ret_val = xmlUCSIsControlPictures(code);
36230 desret_int(ret_val);
36231 call_tests++;
36232 des_int(n_code, code, 0);
36233 xmlResetLastError();
36234 if (mem_base != xmlMemBlocks()) {
36235 printf("Leak of %d blocks found in xmlUCSIsControlPictures",
36236 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036237 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036238 printf(" %d", n_code);
36239 printf("\n");
36240 }
36241 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036242 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036243#endif
36244
Daniel Veillard42595322004-11-08 10:52:06 +000036245 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036246}
36247
36248
36249static int
36250test_xmlUCSIsCurrencySymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036251 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036252
William M. Brack21e4ef22005-01-02 09:53:13 +000036253#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036254 int mem_base;
36255 int ret_val;
36256 int code; /* UCS code point */
36257 int n_code;
36258
36259 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36260 mem_base = xmlMemBlocks();
36261 code = gen_int(n_code, 0);
36262
36263 ret_val = xmlUCSIsCurrencySymbols(code);
36264 desret_int(ret_val);
36265 call_tests++;
36266 des_int(n_code, code, 0);
36267 xmlResetLastError();
36268 if (mem_base != xmlMemBlocks()) {
36269 printf("Leak of %d blocks found in xmlUCSIsCurrencySymbols",
36270 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036271 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036272 printf(" %d", n_code);
36273 printf("\n");
36274 }
36275 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036276 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036277#endif
36278
Daniel Veillard42595322004-11-08 10:52:06 +000036279 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036280}
36281
36282
36283static int
36284test_xmlUCSIsCypriotSyllabary(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036285 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036286
William M. Brack21e4ef22005-01-02 09:53:13 +000036287#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036288 int mem_base;
36289 int ret_val;
36290 int code; /* UCS code point */
36291 int n_code;
36292
36293 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36294 mem_base = xmlMemBlocks();
36295 code = gen_int(n_code, 0);
36296
36297 ret_val = xmlUCSIsCypriotSyllabary(code);
36298 desret_int(ret_val);
36299 call_tests++;
36300 des_int(n_code, code, 0);
36301 xmlResetLastError();
36302 if (mem_base != xmlMemBlocks()) {
36303 printf("Leak of %d blocks found in xmlUCSIsCypriotSyllabary",
36304 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036305 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036306 printf(" %d", n_code);
36307 printf("\n");
36308 }
36309 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036310 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036311#endif
36312
Daniel Veillard42595322004-11-08 10:52:06 +000036313 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036314}
36315
36316
36317static int
36318test_xmlUCSIsCyrillic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036319 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036320
William M. Brack21e4ef22005-01-02 09:53:13 +000036321#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036322 int mem_base;
36323 int ret_val;
36324 int code; /* UCS code point */
36325 int n_code;
36326
36327 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36328 mem_base = xmlMemBlocks();
36329 code = gen_int(n_code, 0);
36330
36331 ret_val = xmlUCSIsCyrillic(code);
36332 desret_int(ret_val);
36333 call_tests++;
36334 des_int(n_code, code, 0);
36335 xmlResetLastError();
36336 if (mem_base != xmlMemBlocks()) {
36337 printf("Leak of %d blocks found in xmlUCSIsCyrillic",
36338 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036339 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036340 printf(" %d", n_code);
36341 printf("\n");
36342 }
36343 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036344 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036345#endif
36346
Daniel Veillard42595322004-11-08 10:52:06 +000036347 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036348}
36349
36350
36351static int
36352test_xmlUCSIsCyrillicSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036353 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036354
William M. Brack21e4ef22005-01-02 09:53:13 +000036355#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036356 int mem_base;
36357 int ret_val;
36358 int code; /* UCS code point */
36359 int n_code;
36360
36361 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36362 mem_base = xmlMemBlocks();
36363 code = gen_int(n_code, 0);
36364
36365 ret_val = xmlUCSIsCyrillicSupplement(code);
36366 desret_int(ret_val);
36367 call_tests++;
36368 des_int(n_code, code, 0);
36369 xmlResetLastError();
36370 if (mem_base != xmlMemBlocks()) {
36371 printf("Leak of %d blocks found in xmlUCSIsCyrillicSupplement",
36372 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036373 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036374 printf(" %d", n_code);
36375 printf("\n");
36376 }
36377 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036378 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036379#endif
36380
Daniel Veillard42595322004-11-08 10:52:06 +000036381 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036382}
36383
36384
36385static int
36386test_xmlUCSIsDeseret(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036387 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036388
William M. Brack21e4ef22005-01-02 09:53:13 +000036389#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036390 int mem_base;
36391 int ret_val;
36392 int code; /* UCS code point */
36393 int n_code;
36394
36395 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36396 mem_base = xmlMemBlocks();
36397 code = gen_int(n_code, 0);
36398
36399 ret_val = xmlUCSIsDeseret(code);
36400 desret_int(ret_val);
36401 call_tests++;
36402 des_int(n_code, code, 0);
36403 xmlResetLastError();
36404 if (mem_base != xmlMemBlocks()) {
36405 printf("Leak of %d blocks found in xmlUCSIsDeseret",
36406 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036407 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036408 printf(" %d", n_code);
36409 printf("\n");
36410 }
36411 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036412 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036413#endif
36414
Daniel Veillard42595322004-11-08 10:52:06 +000036415 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036416}
36417
36418
36419static int
36420test_xmlUCSIsDevanagari(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036421 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036422
William M. Brack21e4ef22005-01-02 09:53:13 +000036423#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036424 int mem_base;
36425 int ret_val;
36426 int code; /* UCS code point */
36427 int n_code;
36428
36429 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36430 mem_base = xmlMemBlocks();
36431 code = gen_int(n_code, 0);
36432
36433 ret_val = xmlUCSIsDevanagari(code);
36434 desret_int(ret_val);
36435 call_tests++;
36436 des_int(n_code, code, 0);
36437 xmlResetLastError();
36438 if (mem_base != xmlMemBlocks()) {
36439 printf("Leak of %d blocks found in xmlUCSIsDevanagari",
36440 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036441 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036442 printf(" %d", n_code);
36443 printf("\n");
36444 }
36445 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036446 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036447#endif
36448
Daniel Veillard42595322004-11-08 10:52:06 +000036449 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036450}
36451
36452
36453static int
36454test_xmlUCSIsDingbats(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036455 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036456
William M. Brack21e4ef22005-01-02 09:53:13 +000036457#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036458 int mem_base;
36459 int ret_val;
36460 int code; /* UCS code point */
36461 int n_code;
36462
36463 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36464 mem_base = xmlMemBlocks();
36465 code = gen_int(n_code, 0);
36466
36467 ret_val = xmlUCSIsDingbats(code);
36468 desret_int(ret_val);
36469 call_tests++;
36470 des_int(n_code, code, 0);
36471 xmlResetLastError();
36472 if (mem_base != xmlMemBlocks()) {
36473 printf("Leak of %d blocks found in xmlUCSIsDingbats",
36474 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036475 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036476 printf(" %d", n_code);
36477 printf("\n");
36478 }
36479 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036480 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036481#endif
36482
Daniel Veillard42595322004-11-08 10:52:06 +000036483 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036484}
36485
36486
36487static int
36488test_xmlUCSIsEnclosedAlphanumerics(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036489 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036490
William M. Brack21e4ef22005-01-02 09:53:13 +000036491#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036492 int mem_base;
36493 int ret_val;
36494 int code; /* UCS code point */
36495 int n_code;
36496
36497 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36498 mem_base = xmlMemBlocks();
36499 code = gen_int(n_code, 0);
36500
36501 ret_val = xmlUCSIsEnclosedAlphanumerics(code);
36502 desret_int(ret_val);
36503 call_tests++;
36504 des_int(n_code, code, 0);
36505 xmlResetLastError();
36506 if (mem_base != xmlMemBlocks()) {
36507 printf("Leak of %d blocks found in xmlUCSIsEnclosedAlphanumerics",
36508 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036509 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036510 printf(" %d", n_code);
36511 printf("\n");
36512 }
36513 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036514 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036515#endif
36516
Daniel Veillard42595322004-11-08 10:52:06 +000036517 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036518}
36519
36520
36521static int
36522test_xmlUCSIsEnclosedCJKLettersandMonths(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036523 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036524
William M. Brack21e4ef22005-01-02 09:53:13 +000036525#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036526 int mem_base;
36527 int ret_val;
36528 int code; /* UCS code point */
36529 int n_code;
36530
36531 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36532 mem_base = xmlMemBlocks();
36533 code = gen_int(n_code, 0);
36534
36535 ret_val = xmlUCSIsEnclosedCJKLettersandMonths(code);
36536 desret_int(ret_val);
36537 call_tests++;
36538 des_int(n_code, code, 0);
36539 xmlResetLastError();
36540 if (mem_base != xmlMemBlocks()) {
36541 printf("Leak of %d blocks found in xmlUCSIsEnclosedCJKLettersandMonths",
36542 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036543 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036544 printf(" %d", n_code);
36545 printf("\n");
36546 }
36547 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036548 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036549#endif
36550
Daniel Veillard42595322004-11-08 10:52:06 +000036551 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036552}
36553
36554
36555static int
36556test_xmlUCSIsEthiopic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036557 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036558
William M. Brack21e4ef22005-01-02 09:53:13 +000036559#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036560 int mem_base;
36561 int ret_val;
36562 int code; /* UCS code point */
36563 int n_code;
36564
36565 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36566 mem_base = xmlMemBlocks();
36567 code = gen_int(n_code, 0);
36568
36569 ret_val = xmlUCSIsEthiopic(code);
36570 desret_int(ret_val);
36571 call_tests++;
36572 des_int(n_code, code, 0);
36573 xmlResetLastError();
36574 if (mem_base != xmlMemBlocks()) {
36575 printf("Leak of %d blocks found in xmlUCSIsEthiopic",
36576 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036577 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036578 printf(" %d", n_code);
36579 printf("\n");
36580 }
36581 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036582 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036583#endif
36584
Daniel Veillard42595322004-11-08 10:52:06 +000036585 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036586}
36587
36588
36589static int
36590test_xmlUCSIsGeneralPunctuation(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036591 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036592
William M. Brack21e4ef22005-01-02 09:53:13 +000036593#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036594 int mem_base;
36595 int ret_val;
36596 int code; /* UCS code point */
36597 int n_code;
36598
36599 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36600 mem_base = xmlMemBlocks();
36601 code = gen_int(n_code, 0);
36602
36603 ret_val = xmlUCSIsGeneralPunctuation(code);
36604 desret_int(ret_val);
36605 call_tests++;
36606 des_int(n_code, code, 0);
36607 xmlResetLastError();
36608 if (mem_base != xmlMemBlocks()) {
36609 printf("Leak of %d blocks found in xmlUCSIsGeneralPunctuation",
36610 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036611 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036612 printf(" %d", n_code);
36613 printf("\n");
36614 }
36615 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036616 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036617#endif
36618
Daniel Veillard42595322004-11-08 10:52:06 +000036619 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036620}
36621
36622
36623static int
36624test_xmlUCSIsGeometricShapes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036625 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036626
William M. Brack21e4ef22005-01-02 09:53:13 +000036627#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036628 int mem_base;
36629 int ret_val;
36630 int code; /* UCS code point */
36631 int n_code;
36632
36633 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36634 mem_base = xmlMemBlocks();
36635 code = gen_int(n_code, 0);
36636
36637 ret_val = xmlUCSIsGeometricShapes(code);
36638 desret_int(ret_val);
36639 call_tests++;
36640 des_int(n_code, code, 0);
36641 xmlResetLastError();
36642 if (mem_base != xmlMemBlocks()) {
36643 printf("Leak of %d blocks found in xmlUCSIsGeometricShapes",
36644 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036645 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036646 printf(" %d", n_code);
36647 printf("\n");
36648 }
36649 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036650 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036651#endif
36652
Daniel Veillard42595322004-11-08 10:52:06 +000036653 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036654}
36655
36656
36657static int
36658test_xmlUCSIsGeorgian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036659 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036660
William M. Brack21e4ef22005-01-02 09:53:13 +000036661#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036662 int mem_base;
36663 int ret_val;
36664 int code; /* UCS code point */
36665 int n_code;
36666
36667 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36668 mem_base = xmlMemBlocks();
36669 code = gen_int(n_code, 0);
36670
36671 ret_val = xmlUCSIsGeorgian(code);
36672 desret_int(ret_val);
36673 call_tests++;
36674 des_int(n_code, code, 0);
36675 xmlResetLastError();
36676 if (mem_base != xmlMemBlocks()) {
36677 printf("Leak of %d blocks found in xmlUCSIsGeorgian",
36678 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036679 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036680 printf(" %d", n_code);
36681 printf("\n");
36682 }
36683 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036684 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036685#endif
36686
Daniel Veillard42595322004-11-08 10:52:06 +000036687 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036688}
36689
36690
36691static int
36692test_xmlUCSIsGothic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036693 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036694
William M. Brack21e4ef22005-01-02 09:53:13 +000036695#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036696 int mem_base;
36697 int ret_val;
36698 int code; /* UCS code point */
36699 int n_code;
36700
36701 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36702 mem_base = xmlMemBlocks();
36703 code = gen_int(n_code, 0);
36704
36705 ret_val = xmlUCSIsGothic(code);
36706 desret_int(ret_val);
36707 call_tests++;
36708 des_int(n_code, code, 0);
36709 xmlResetLastError();
36710 if (mem_base != xmlMemBlocks()) {
36711 printf("Leak of %d blocks found in xmlUCSIsGothic",
36712 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036713 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036714 printf(" %d", n_code);
36715 printf("\n");
36716 }
36717 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036718 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036719#endif
36720
Daniel Veillard42595322004-11-08 10:52:06 +000036721 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036722}
36723
36724
36725static int
36726test_xmlUCSIsGreek(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036727 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036728
William M. Brack21e4ef22005-01-02 09:53:13 +000036729#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036730 int mem_base;
36731 int ret_val;
36732 int code; /* UCS code point */
36733 int n_code;
36734
36735 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36736 mem_base = xmlMemBlocks();
36737 code = gen_int(n_code, 0);
36738
36739 ret_val = xmlUCSIsGreek(code);
36740 desret_int(ret_val);
36741 call_tests++;
36742 des_int(n_code, code, 0);
36743 xmlResetLastError();
36744 if (mem_base != xmlMemBlocks()) {
36745 printf("Leak of %d blocks found in xmlUCSIsGreek",
36746 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036747 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036748 printf(" %d", n_code);
36749 printf("\n");
36750 }
36751 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036752 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036753#endif
36754
Daniel Veillard42595322004-11-08 10:52:06 +000036755 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036756}
36757
36758
36759static int
36760test_xmlUCSIsGreekExtended(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036761 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036762
William M. Brack21e4ef22005-01-02 09:53:13 +000036763#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036764 int mem_base;
36765 int ret_val;
36766 int code; /* UCS code point */
36767 int n_code;
36768
36769 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36770 mem_base = xmlMemBlocks();
36771 code = gen_int(n_code, 0);
36772
36773 ret_val = xmlUCSIsGreekExtended(code);
36774 desret_int(ret_val);
36775 call_tests++;
36776 des_int(n_code, code, 0);
36777 xmlResetLastError();
36778 if (mem_base != xmlMemBlocks()) {
36779 printf("Leak of %d blocks found in xmlUCSIsGreekExtended",
36780 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036781 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036782 printf(" %d", n_code);
36783 printf("\n");
36784 }
36785 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036786 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036787#endif
36788
Daniel Veillard42595322004-11-08 10:52:06 +000036789 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036790}
36791
36792
36793static int
36794test_xmlUCSIsGreekandCoptic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036795 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036796
William M. Brack21e4ef22005-01-02 09:53:13 +000036797#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036798 int mem_base;
36799 int ret_val;
36800 int code; /* UCS code point */
36801 int n_code;
36802
36803 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36804 mem_base = xmlMemBlocks();
36805 code = gen_int(n_code, 0);
36806
36807 ret_val = xmlUCSIsGreekandCoptic(code);
36808 desret_int(ret_val);
36809 call_tests++;
36810 des_int(n_code, code, 0);
36811 xmlResetLastError();
36812 if (mem_base != xmlMemBlocks()) {
36813 printf("Leak of %d blocks found in xmlUCSIsGreekandCoptic",
36814 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036815 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036816 printf(" %d", n_code);
36817 printf("\n");
36818 }
36819 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036820 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036821#endif
36822
Daniel Veillard42595322004-11-08 10:52:06 +000036823 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036824}
36825
36826
36827static int
36828test_xmlUCSIsGujarati(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036829 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036830
William M. Brack21e4ef22005-01-02 09:53:13 +000036831#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036832 int mem_base;
36833 int ret_val;
36834 int code; /* UCS code point */
36835 int n_code;
36836
36837 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36838 mem_base = xmlMemBlocks();
36839 code = gen_int(n_code, 0);
36840
36841 ret_val = xmlUCSIsGujarati(code);
36842 desret_int(ret_val);
36843 call_tests++;
36844 des_int(n_code, code, 0);
36845 xmlResetLastError();
36846 if (mem_base != xmlMemBlocks()) {
36847 printf("Leak of %d blocks found in xmlUCSIsGujarati",
36848 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036849 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036850 printf(" %d", n_code);
36851 printf("\n");
36852 }
36853 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036854 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036855#endif
36856
Daniel Veillard42595322004-11-08 10:52:06 +000036857 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036858}
36859
36860
36861static int
36862test_xmlUCSIsGurmukhi(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036863 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036864
William M. Brack21e4ef22005-01-02 09:53:13 +000036865#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036866 int mem_base;
36867 int ret_val;
36868 int code; /* UCS code point */
36869 int n_code;
36870
36871 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36872 mem_base = xmlMemBlocks();
36873 code = gen_int(n_code, 0);
36874
36875 ret_val = xmlUCSIsGurmukhi(code);
36876 desret_int(ret_val);
36877 call_tests++;
36878 des_int(n_code, code, 0);
36879 xmlResetLastError();
36880 if (mem_base != xmlMemBlocks()) {
36881 printf("Leak of %d blocks found in xmlUCSIsGurmukhi",
36882 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036883 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036884 printf(" %d", n_code);
36885 printf("\n");
36886 }
36887 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036888 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036889#endif
36890
Daniel Veillard42595322004-11-08 10:52:06 +000036891 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036892}
36893
36894
36895static int
36896test_xmlUCSIsHalfwidthandFullwidthForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036897 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036898
William M. Brack21e4ef22005-01-02 09:53:13 +000036899#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036900 int mem_base;
36901 int ret_val;
36902 int code; /* UCS code point */
36903 int n_code;
36904
36905 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36906 mem_base = xmlMemBlocks();
36907 code = gen_int(n_code, 0);
36908
36909 ret_val = xmlUCSIsHalfwidthandFullwidthForms(code);
36910 desret_int(ret_val);
36911 call_tests++;
36912 des_int(n_code, code, 0);
36913 xmlResetLastError();
36914 if (mem_base != xmlMemBlocks()) {
36915 printf("Leak of %d blocks found in xmlUCSIsHalfwidthandFullwidthForms",
36916 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036917 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036918 printf(" %d", n_code);
36919 printf("\n");
36920 }
36921 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036922 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036923#endif
36924
Daniel Veillard42595322004-11-08 10:52:06 +000036925 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036926}
36927
36928
36929static int
36930test_xmlUCSIsHangulCompatibilityJamo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036931 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036932
William M. Brack21e4ef22005-01-02 09:53:13 +000036933#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036934 int mem_base;
36935 int ret_val;
36936 int code; /* UCS code point */
36937 int n_code;
36938
36939 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36940 mem_base = xmlMemBlocks();
36941 code = gen_int(n_code, 0);
36942
36943 ret_val = xmlUCSIsHangulCompatibilityJamo(code);
36944 desret_int(ret_val);
36945 call_tests++;
36946 des_int(n_code, code, 0);
36947 xmlResetLastError();
36948 if (mem_base != xmlMemBlocks()) {
36949 printf("Leak of %d blocks found in xmlUCSIsHangulCompatibilityJamo",
36950 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036951 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036952 printf(" %d", n_code);
36953 printf("\n");
36954 }
36955 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036956 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036957#endif
36958
Daniel Veillard42595322004-11-08 10:52:06 +000036959 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036960}
36961
36962
36963static int
36964test_xmlUCSIsHangulJamo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036965 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036966
William M. Brack21e4ef22005-01-02 09:53:13 +000036967#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036968 int mem_base;
36969 int ret_val;
36970 int code; /* UCS code point */
36971 int n_code;
36972
36973 for (n_code = 0;n_code < gen_nb_int;n_code++) {
36974 mem_base = xmlMemBlocks();
36975 code = gen_int(n_code, 0);
36976
36977 ret_val = xmlUCSIsHangulJamo(code);
36978 desret_int(ret_val);
36979 call_tests++;
36980 des_int(n_code, code, 0);
36981 xmlResetLastError();
36982 if (mem_base != xmlMemBlocks()) {
36983 printf("Leak of %d blocks found in xmlUCSIsHangulJamo",
36984 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000036985 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036986 printf(" %d", n_code);
36987 printf("\n");
36988 }
36989 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000036990 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036991#endif
36992
Daniel Veillard42595322004-11-08 10:52:06 +000036993 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000036994}
36995
36996
36997static int
36998test_xmlUCSIsHangulSyllables(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000036999 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037000
William M. Brack21e4ef22005-01-02 09:53:13 +000037001#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037002 int mem_base;
37003 int ret_val;
37004 int code; /* UCS code point */
37005 int n_code;
37006
37007 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37008 mem_base = xmlMemBlocks();
37009 code = gen_int(n_code, 0);
37010
37011 ret_val = xmlUCSIsHangulSyllables(code);
37012 desret_int(ret_val);
37013 call_tests++;
37014 des_int(n_code, code, 0);
37015 xmlResetLastError();
37016 if (mem_base != xmlMemBlocks()) {
37017 printf("Leak of %d blocks found in xmlUCSIsHangulSyllables",
37018 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037019 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037020 printf(" %d", n_code);
37021 printf("\n");
37022 }
37023 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037024 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037025#endif
37026
Daniel Veillard42595322004-11-08 10:52:06 +000037027 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037028}
37029
37030
37031static int
37032test_xmlUCSIsHanunoo(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037033 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037034
William M. Brack21e4ef22005-01-02 09:53:13 +000037035#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037036 int mem_base;
37037 int ret_val;
37038 int code; /* UCS code point */
37039 int n_code;
37040
37041 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37042 mem_base = xmlMemBlocks();
37043 code = gen_int(n_code, 0);
37044
37045 ret_val = xmlUCSIsHanunoo(code);
37046 desret_int(ret_val);
37047 call_tests++;
37048 des_int(n_code, code, 0);
37049 xmlResetLastError();
37050 if (mem_base != xmlMemBlocks()) {
37051 printf("Leak of %d blocks found in xmlUCSIsHanunoo",
37052 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037053 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037054 printf(" %d", n_code);
37055 printf("\n");
37056 }
37057 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037058 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037059#endif
37060
Daniel Veillard42595322004-11-08 10:52:06 +000037061 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037062}
37063
37064
37065static int
37066test_xmlUCSIsHebrew(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037067 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037068
William M. Brack21e4ef22005-01-02 09:53:13 +000037069#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037070 int mem_base;
37071 int ret_val;
37072 int code; /* UCS code point */
37073 int n_code;
37074
37075 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37076 mem_base = xmlMemBlocks();
37077 code = gen_int(n_code, 0);
37078
37079 ret_val = xmlUCSIsHebrew(code);
37080 desret_int(ret_val);
37081 call_tests++;
37082 des_int(n_code, code, 0);
37083 xmlResetLastError();
37084 if (mem_base != xmlMemBlocks()) {
37085 printf("Leak of %d blocks found in xmlUCSIsHebrew",
37086 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037087 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037088 printf(" %d", n_code);
37089 printf("\n");
37090 }
37091 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037092 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037093#endif
37094
Daniel Veillard42595322004-11-08 10:52:06 +000037095 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037096}
37097
37098
37099static int
37100test_xmlUCSIsHighPrivateUseSurrogates(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037101 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037102
William M. Brack21e4ef22005-01-02 09:53:13 +000037103#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037104 int mem_base;
37105 int ret_val;
37106 int code; /* UCS code point */
37107 int n_code;
37108
37109 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37110 mem_base = xmlMemBlocks();
37111 code = gen_int(n_code, 0);
37112
37113 ret_val = xmlUCSIsHighPrivateUseSurrogates(code);
37114 desret_int(ret_val);
37115 call_tests++;
37116 des_int(n_code, code, 0);
37117 xmlResetLastError();
37118 if (mem_base != xmlMemBlocks()) {
37119 printf("Leak of %d blocks found in xmlUCSIsHighPrivateUseSurrogates",
37120 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037121 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037122 printf(" %d", n_code);
37123 printf("\n");
37124 }
37125 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037126 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037127#endif
37128
Daniel Veillard42595322004-11-08 10:52:06 +000037129 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037130}
37131
37132
37133static int
37134test_xmlUCSIsHighSurrogates(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037135 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037136
William M. Brack21e4ef22005-01-02 09:53:13 +000037137#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037138 int mem_base;
37139 int ret_val;
37140 int code; /* UCS code point */
37141 int n_code;
37142
37143 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37144 mem_base = xmlMemBlocks();
37145 code = gen_int(n_code, 0);
37146
37147 ret_val = xmlUCSIsHighSurrogates(code);
37148 desret_int(ret_val);
37149 call_tests++;
37150 des_int(n_code, code, 0);
37151 xmlResetLastError();
37152 if (mem_base != xmlMemBlocks()) {
37153 printf("Leak of %d blocks found in xmlUCSIsHighSurrogates",
37154 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037155 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037156 printf(" %d", n_code);
37157 printf("\n");
37158 }
37159 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037160 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037161#endif
37162
Daniel Veillard42595322004-11-08 10:52:06 +000037163 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037164}
37165
37166
37167static int
37168test_xmlUCSIsHiragana(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037169 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037170
William M. Brack21e4ef22005-01-02 09:53:13 +000037171#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037172 int mem_base;
37173 int ret_val;
37174 int code; /* UCS code point */
37175 int n_code;
37176
37177 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37178 mem_base = xmlMemBlocks();
37179 code = gen_int(n_code, 0);
37180
37181 ret_val = xmlUCSIsHiragana(code);
37182 desret_int(ret_val);
37183 call_tests++;
37184 des_int(n_code, code, 0);
37185 xmlResetLastError();
37186 if (mem_base != xmlMemBlocks()) {
37187 printf("Leak of %d blocks found in xmlUCSIsHiragana",
37188 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037189 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037190 printf(" %d", n_code);
37191 printf("\n");
37192 }
37193 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037194 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037195#endif
37196
Daniel Veillard42595322004-11-08 10:52:06 +000037197 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037198}
37199
37200
37201static int
37202test_xmlUCSIsIPAExtensions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037203 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037204
William M. Brack21e4ef22005-01-02 09:53:13 +000037205#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037206 int mem_base;
37207 int ret_val;
37208 int code; /* UCS code point */
37209 int n_code;
37210
37211 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37212 mem_base = xmlMemBlocks();
37213 code = gen_int(n_code, 0);
37214
37215 ret_val = xmlUCSIsIPAExtensions(code);
37216 desret_int(ret_val);
37217 call_tests++;
37218 des_int(n_code, code, 0);
37219 xmlResetLastError();
37220 if (mem_base != xmlMemBlocks()) {
37221 printf("Leak of %d blocks found in xmlUCSIsIPAExtensions",
37222 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037223 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037224 printf(" %d", n_code);
37225 printf("\n");
37226 }
37227 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037228 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037229#endif
37230
Daniel Veillard42595322004-11-08 10:52:06 +000037231 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037232}
37233
37234
37235static int
37236test_xmlUCSIsIdeographicDescriptionCharacters(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037237 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037238
William M. Brack21e4ef22005-01-02 09:53:13 +000037239#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037240 int mem_base;
37241 int ret_val;
37242 int code; /* UCS code point */
37243 int n_code;
37244
37245 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37246 mem_base = xmlMemBlocks();
37247 code = gen_int(n_code, 0);
37248
37249 ret_val = xmlUCSIsIdeographicDescriptionCharacters(code);
37250 desret_int(ret_val);
37251 call_tests++;
37252 des_int(n_code, code, 0);
37253 xmlResetLastError();
37254 if (mem_base != xmlMemBlocks()) {
37255 printf("Leak of %d blocks found in xmlUCSIsIdeographicDescriptionCharacters",
37256 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037257 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037258 printf(" %d", n_code);
37259 printf("\n");
37260 }
37261 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037262 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037263#endif
37264
Daniel Veillard42595322004-11-08 10:52:06 +000037265 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037266}
37267
37268
37269static int
37270test_xmlUCSIsKanbun(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037271 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037272
William M. Brack21e4ef22005-01-02 09:53:13 +000037273#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037274 int mem_base;
37275 int ret_val;
37276 int code; /* UCS code point */
37277 int n_code;
37278
37279 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37280 mem_base = xmlMemBlocks();
37281 code = gen_int(n_code, 0);
37282
37283 ret_val = xmlUCSIsKanbun(code);
37284 desret_int(ret_val);
37285 call_tests++;
37286 des_int(n_code, code, 0);
37287 xmlResetLastError();
37288 if (mem_base != xmlMemBlocks()) {
37289 printf("Leak of %d blocks found in xmlUCSIsKanbun",
37290 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037291 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037292 printf(" %d", n_code);
37293 printf("\n");
37294 }
37295 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037296 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037297#endif
37298
Daniel Veillard42595322004-11-08 10:52:06 +000037299 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037300}
37301
37302
37303static int
37304test_xmlUCSIsKangxiRadicals(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037305 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037306
William M. Brack21e4ef22005-01-02 09:53:13 +000037307#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037308 int mem_base;
37309 int ret_val;
37310 int code; /* UCS code point */
37311 int n_code;
37312
37313 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37314 mem_base = xmlMemBlocks();
37315 code = gen_int(n_code, 0);
37316
37317 ret_val = xmlUCSIsKangxiRadicals(code);
37318 desret_int(ret_val);
37319 call_tests++;
37320 des_int(n_code, code, 0);
37321 xmlResetLastError();
37322 if (mem_base != xmlMemBlocks()) {
37323 printf("Leak of %d blocks found in xmlUCSIsKangxiRadicals",
37324 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037325 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037326 printf(" %d", n_code);
37327 printf("\n");
37328 }
37329 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037330 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037331#endif
37332
Daniel Veillard42595322004-11-08 10:52:06 +000037333 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037334}
37335
37336
37337static int
37338test_xmlUCSIsKannada(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037339 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037340
William M. Brack21e4ef22005-01-02 09:53:13 +000037341#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037342 int mem_base;
37343 int ret_val;
37344 int code; /* UCS code point */
37345 int n_code;
37346
37347 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37348 mem_base = xmlMemBlocks();
37349 code = gen_int(n_code, 0);
37350
37351 ret_val = xmlUCSIsKannada(code);
37352 desret_int(ret_val);
37353 call_tests++;
37354 des_int(n_code, code, 0);
37355 xmlResetLastError();
37356 if (mem_base != xmlMemBlocks()) {
37357 printf("Leak of %d blocks found in xmlUCSIsKannada",
37358 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037359 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037360 printf(" %d", n_code);
37361 printf("\n");
37362 }
37363 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037364 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037365#endif
37366
Daniel Veillard42595322004-11-08 10:52:06 +000037367 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037368}
37369
37370
37371static int
37372test_xmlUCSIsKatakana(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037373 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037374
William M. Brack21e4ef22005-01-02 09:53:13 +000037375#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037376 int mem_base;
37377 int ret_val;
37378 int code; /* UCS code point */
37379 int n_code;
37380
37381 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37382 mem_base = xmlMemBlocks();
37383 code = gen_int(n_code, 0);
37384
37385 ret_val = xmlUCSIsKatakana(code);
37386 desret_int(ret_val);
37387 call_tests++;
37388 des_int(n_code, code, 0);
37389 xmlResetLastError();
37390 if (mem_base != xmlMemBlocks()) {
37391 printf("Leak of %d blocks found in xmlUCSIsKatakana",
37392 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037393 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037394 printf(" %d", n_code);
37395 printf("\n");
37396 }
37397 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037398 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037399#endif
37400
Daniel Veillard42595322004-11-08 10:52:06 +000037401 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037402}
37403
37404
37405static int
37406test_xmlUCSIsKatakanaPhoneticExtensions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037407 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037408
William M. Brack21e4ef22005-01-02 09:53:13 +000037409#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037410 int mem_base;
37411 int ret_val;
37412 int code; /* UCS code point */
37413 int n_code;
37414
37415 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37416 mem_base = xmlMemBlocks();
37417 code = gen_int(n_code, 0);
37418
37419 ret_val = xmlUCSIsKatakanaPhoneticExtensions(code);
37420 desret_int(ret_val);
37421 call_tests++;
37422 des_int(n_code, code, 0);
37423 xmlResetLastError();
37424 if (mem_base != xmlMemBlocks()) {
37425 printf("Leak of %d blocks found in xmlUCSIsKatakanaPhoneticExtensions",
37426 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037427 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037428 printf(" %d", n_code);
37429 printf("\n");
37430 }
37431 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037432 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037433#endif
37434
Daniel Veillard42595322004-11-08 10:52:06 +000037435 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037436}
37437
37438
37439static int
37440test_xmlUCSIsKhmer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037441 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037442
William M. Brack21e4ef22005-01-02 09:53:13 +000037443#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037444 int mem_base;
37445 int ret_val;
37446 int code; /* UCS code point */
37447 int n_code;
37448
37449 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37450 mem_base = xmlMemBlocks();
37451 code = gen_int(n_code, 0);
37452
37453 ret_val = xmlUCSIsKhmer(code);
37454 desret_int(ret_val);
37455 call_tests++;
37456 des_int(n_code, code, 0);
37457 xmlResetLastError();
37458 if (mem_base != xmlMemBlocks()) {
37459 printf("Leak of %d blocks found in xmlUCSIsKhmer",
37460 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037461 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037462 printf(" %d", n_code);
37463 printf("\n");
37464 }
37465 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037466 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037467#endif
37468
Daniel Veillard42595322004-11-08 10:52:06 +000037469 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037470}
37471
37472
37473static int
37474test_xmlUCSIsKhmerSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037475 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037476
William M. Brack21e4ef22005-01-02 09:53:13 +000037477#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037478 int mem_base;
37479 int ret_val;
37480 int code; /* UCS code point */
37481 int n_code;
37482
37483 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37484 mem_base = xmlMemBlocks();
37485 code = gen_int(n_code, 0);
37486
37487 ret_val = xmlUCSIsKhmerSymbols(code);
37488 desret_int(ret_val);
37489 call_tests++;
37490 des_int(n_code, code, 0);
37491 xmlResetLastError();
37492 if (mem_base != xmlMemBlocks()) {
37493 printf("Leak of %d blocks found in xmlUCSIsKhmerSymbols",
37494 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037495 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037496 printf(" %d", n_code);
37497 printf("\n");
37498 }
37499 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037500 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037501#endif
37502
Daniel Veillard42595322004-11-08 10:52:06 +000037503 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037504}
37505
37506
37507static int
37508test_xmlUCSIsLao(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037509 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037510
William M. Brack21e4ef22005-01-02 09:53:13 +000037511#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037512 int mem_base;
37513 int ret_val;
37514 int code; /* UCS code point */
37515 int n_code;
37516
37517 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37518 mem_base = xmlMemBlocks();
37519 code = gen_int(n_code, 0);
37520
37521 ret_val = xmlUCSIsLao(code);
37522 desret_int(ret_val);
37523 call_tests++;
37524 des_int(n_code, code, 0);
37525 xmlResetLastError();
37526 if (mem_base != xmlMemBlocks()) {
37527 printf("Leak of %d blocks found in xmlUCSIsLao",
37528 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037529 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037530 printf(" %d", n_code);
37531 printf("\n");
37532 }
37533 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037534 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037535#endif
37536
Daniel Veillard42595322004-11-08 10:52:06 +000037537 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037538}
37539
37540
37541static int
37542test_xmlUCSIsLatin1Supplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037543 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037544
William M. Brack21e4ef22005-01-02 09:53:13 +000037545#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037546 int mem_base;
37547 int ret_val;
37548 int code; /* UCS code point */
37549 int n_code;
37550
37551 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37552 mem_base = xmlMemBlocks();
37553 code = gen_int(n_code, 0);
37554
37555 ret_val = xmlUCSIsLatin1Supplement(code);
37556 desret_int(ret_val);
37557 call_tests++;
37558 des_int(n_code, code, 0);
37559 xmlResetLastError();
37560 if (mem_base != xmlMemBlocks()) {
37561 printf("Leak of %d blocks found in xmlUCSIsLatin1Supplement",
37562 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037563 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037564 printf(" %d", n_code);
37565 printf("\n");
37566 }
37567 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037568 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037569#endif
37570
Daniel Veillard42595322004-11-08 10:52:06 +000037571 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037572}
37573
37574
37575static int
37576test_xmlUCSIsLatinExtendedA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037577 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037578
William M. Brack21e4ef22005-01-02 09:53:13 +000037579#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037580 int mem_base;
37581 int ret_val;
37582 int code; /* UCS code point */
37583 int n_code;
37584
37585 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37586 mem_base = xmlMemBlocks();
37587 code = gen_int(n_code, 0);
37588
37589 ret_val = xmlUCSIsLatinExtendedA(code);
37590 desret_int(ret_val);
37591 call_tests++;
37592 des_int(n_code, code, 0);
37593 xmlResetLastError();
37594 if (mem_base != xmlMemBlocks()) {
37595 printf("Leak of %d blocks found in xmlUCSIsLatinExtendedA",
37596 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037597 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037598 printf(" %d", n_code);
37599 printf("\n");
37600 }
37601 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037602 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037603#endif
37604
Daniel Veillard42595322004-11-08 10:52:06 +000037605 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037606}
37607
37608
37609static int
37610test_xmlUCSIsLatinExtendedAdditional(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037611 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037612
William M. Brack21e4ef22005-01-02 09:53:13 +000037613#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037614 int mem_base;
37615 int ret_val;
37616 int code; /* UCS code point */
37617 int n_code;
37618
37619 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37620 mem_base = xmlMemBlocks();
37621 code = gen_int(n_code, 0);
37622
37623 ret_val = xmlUCSIsLatinExtendedAdditional(code);
37624 desret_int(ret_val);
37625 call_tests++;
37626 des_int(n_code, code, 0);
37627 xmlResetLastError();
37628 if (mem_base != xmlMemBlocks()) {
37629 printf("Leak of %d blocks found in xmlUCSIsLatinExtendedAdditional",
37630 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037631 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037632 printf(" %d", n_code);
37633 printf("\n");
37634 }
37635 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037636 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037637#endif
37638
Daniel Veillard42595322004-11-08 10:52:06 +000037639 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037640}
37641
37642
37643static int
37644test_xmlUCSIsLatinExtendedB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037645 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037646
William M. Brack21e4ef22005-01-02 09:53:13 +000037647#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037648 int mem_base;
37649 int ret_val;
37650 int code; /* UCS code point */
37651 int n_code;
37652
37653 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37654 mem_base = xmlMemBlocks();
37655 code = gen_int(n_code, 0);
37656
37657 ret_val = xmlUCSIsLatinExtendedB(code);
37658 desret_int(ret_val);
37659 call_tests++;
37660 des_int(n_code, code, 0);
37661 xmlResetLastError();
37662 if (mem_base != xmlMemBlocks()) {
37663 printf("Leak of %d blocks found in xmlUCSIsLatinExtendedB",
37664 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037665 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037666 printf(" %d", n_code);
37667 printf("\n");
37668 }
37669 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037670 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037671#endif
37672
Daniel Veillard42595322004-11-08 10:52:06 +000037673 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037674}
37675
37676
37677static int
37678test_xmlUCSIsLetterlikeSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037679 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037680
William M. Brack21e4ef22005-01-02 09:53:13 +000037681#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037682 int mem_base;
37683 int ret_val;
37684 int code; /* UCS code point */
37685 int n_code;
37686
37687 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37688 mem_base = xmlMemBlocks();
37689 code = gen_int(n_code, 0);
37690
37691 ret_val = xmlUCSIsLetterlikeSymbols(code);
37692 desret_int(ret_val);
37693 call_tests++;
37694 des_int(n_code, code, 0);
37695 xmlResetLastError();
37696 if (mem_base != xmlMemBlocks()) {
37697 printf("Leak of %d blocks found in xmlUCSIsLetterlikeSymbols",
37698 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037699 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037700 printf(" %d", n_code);
37701 printf("\n");
37702 }
37703 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037704 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037705#endif
37706
Daniel Veillard42595322004-11-08 10:52:06 +000037707 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037708}
37709
37710
37711static int
37712test_xmlUCSIsLimbu(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037713 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037714
William M. Brack21e4ef22005-01-02 09:53:13 +000037715#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037716 int mem_base;
37717 int ret_val;
37718 int code; /* UCS code point */
37719 int n_code;
37720
37721 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37722 mem_base = xmlMemBlocks();
37723 code = gen_int(n_code, 0);
37724
37725 ret_val = xmlUCSIsLimbu(code);
37726 desret_int(ret_val);
37727 call_tests++;
37728 des_int(n_code, code, 0);
37729 xmlResetLastError();
37730 if (mem_base != xmlMemBlocks()) {
37731 printf("Leak of %d blocks found in xmlUCSIsLimbu",
37732 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037733 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037734 printf(" %d", n_code);
37735 printf("\n");
37736 }
37737 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037738 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037739#endif
37740
Daniel Veillard42595322004-11-08 10:52:06 +000037741 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037742}
37743
37744
37745static int
37746test_xmlUCSIsLinearBIdeograms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037747 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037748
William M. Brack21e4ef22005-01-02 09:53:13 +000037749#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037750 int mem_base;
37751 int ret_val;
37752 int code; /* UCS code point */
37753 int n_code;
37754
37755 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37756 mem_base = xmlMemBlocks();
37757 code = gen_int(n_code, 0);
37758
37759 ret_val = xmlUCSIsLinearBIdeograms(code);
37760 desret_int(ret_val);
37761 call_tests++;
37762 des_int(n_code, code, 0);
37763 xmlResetLastError();
37764 if (mem_base != xmlMemBlocks()) {
37765 printf("Leak of %d blocks found in xmlUCSIsLinearBIdeograms",
37766 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037767 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037768 printf(" %d", n_code);
37769 printf("\n");
37770 }
37771 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037772 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037773#endif
37774
Daniel Veillard42595322004-11-08 10:52:06 +000037775 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037776}
37777
37778
37779static int
37780test_xmlUCSIsLinearBSyllabary(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037781 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037782
William M. Brack21e4ef22005-01-02 09:53:13 +000037783#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037784 int mem_base;
37785 int ret_val;
37786 int code; /* UCS code point */
37787 int n_code;
37788
37789 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37790 mem_base = xmlMemBlocks();
37791 code = gen_int(n_code, 0);
37792
37793 ret_val = xmlUCSIsLinearBSyllabary(code);
37794 desret_int(ret_val);
37795 call_tests++;
37796 des_int(n_code, code, 0);
37797 xmlResetLastError();
37798 if (mem_base != xmlMemBlocks()) {
37799 printf("Leak of %d blocks found in xmlUCSIsLinearBSyllabary",
37800 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037801 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037802 printf(" %d", n_code);
37803 printf("\n");
37804 }
37805 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037806 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037807#endif
37808
Daniel Veillard42595322004-11-08 10:52:06 +000037809 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037810}
37811
37812
37813static int
37814test_xmlUCSIsLowSurrogates(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037815 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037816
William M. Brack21e4ef22005-01-02 09:53:13 +000037817#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037818 int mem_base;
37819 int ret_val;
37820 int code; /* UCS code point */
37821 int n_code;
37822
37823 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37824 mem_base = xmlMemBlocks();
37825 code = gen_int(n_code, 0);
37826
37827 ret_val = xmlUCSIsLowSurrogates(code);
37828 desret_int(ret_val);
37829 call_tests++;
37830 des_int(n_code, code, 0);
37831 xmlResetLastError();
37832 if (mem_base != xmlMemBlocks()) {
37833 printf("Leak of %d blocks found in xmlUCSIsLowSurrogates",
37834 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037835 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037836 printf(" %d", n_code);
37837 printf("\n");
37838 }
37839 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037840 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037841#endif
37842
Daniel Veillard42595322004-11-08 10:52:06 +000037843 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037844}
37845
37846
37847static int
37848test_xmlUCSIsMalayalam(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037849 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037850
William M. Brack21e4ef22005-01-02 09:53:13 +000037851#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037852 int mem_base;
37853 int ret_val;
37854 int code; /* UCS code point */
37855 int n_code;
37856
37857 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37858 mem_base = xmlMemBlocks();
37859 code = gen_int(n_code, 0);
37860
37861 ret_val = xmlUCSIsMalayalam(code);
37862 desret_int(ret_val);
37863 call_tests++;
37864 des_int(n_code, code, 0);
37865 xmlResetLastError();
37866 if (mem_base != xmlMemBlocks()) {
37867 printf("Leak of %d blocks found in xmlUCSIsMalayalam",
37868 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037869 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037870 printf(" %d", n_code);
37871 printf("\n");
37872 }
37873 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037874 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037875#endif
37876
Daniel Veillard42595322004-11-08 10:52:06 +000037877 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037878}
37879
37880
37881static int
37882test_xmlUCSIsMathematicalAlphanumericSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037883 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037884
William M. Brack21e4ef22005-01-02 09:53:13 +000037885#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037886 int mem_base;
37887 int ret_val;
37888 int code; /* UCS code point */
37889 int n_code;
37890
37891 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37892 mem_base = xmlMemBlocks();
37893 code = gen_int(n_code, 0);
37894
37895 ret_val = xmlUCSIsMathematicalAlphanumericSymbols(code);
37896 desret_int(ret_val);
37897 call_tests++;
37898 des_int(n_code, code, 0);
37899 xmlResetLastError();
37900 if (mem_base != xmlMemBlocks()) {
37901 printf("Leak of %d blocks found in xmlUCSIsMathematicalAlphanumericSymbols",
37902 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037903 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037904 printf(" %d", n_code);
37905 printf("\n");
37906 }
37907 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037908 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037909#endif
37910
Daniel Veillard42595322004-11-08 10:52:06 +000037911 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037912}
37913
37914
37915static int
37916test_xmlUCSIsMathematicalOperators(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037917 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037918
William M. Brack21e4ef22005-01-02 09:53:13 +000037919#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037920 int mem_base;
37921 int ret_val;
37922 int code; /* UCS code point */
37923 int n_code;
37924
37925 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37926 mem_base = xmlMemBlocks();
37927 code = gen_int(n_code, 0);
37928
37929 ret_val = xmlUCSIsMathematicalOperators(code);
37930 desret_int(ret_val);
37931 call_tests++;
37932 des_int(n_code, code, 0);
37933 xmlResetLastError();
37934 if (mem_base != xmlMemBlocks()) {
37935 printf("Leak of %d blocks found in xmlUCSIsMathematicalOperators",
37936 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037937 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037938 printf(" %d", n_code);
37939 printf("\n");
37940 }
37941 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037942 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037943#endif
37944
Daniel Veillard42595322004-11-08 10:52:06 +000037945 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037946}
37947
37948
37949static int
37950test_xmlUCSIsMiscellaneousMathematicalSymbolsA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037951 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037952
William M. Brack21e4ef22005-01-02 09:53:13 +000037953#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037954 int mem_base;
37955 int ret_val;
37956 int code; /* UCS code point */
37957 int n_code;
37958
37959 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37960 mem_base = xmlMemBlocks();
37961 code = gen_int(n_code, 0);
37962
37963 ret_val = xmlUCSIsMiscellaneousMathematicalSymbolsA(code);
37964 desret_int(ret_val);
37965 call_tests++;
37966 des_int(n_code, code, 0);
37967 xmlResetLastError();
37968 if (mem_base != xmlMemBlocks()) {
37969 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousMathematicalSymbolsA",
37970 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000037971 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037972 printf(" %d", n_code);
37973 printf("\n");
37974 }
37975 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000037976 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037977#endif
37978
Daniel Veillard42595322004-11-08 10:52:06 +000037979 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037980}
37981
37982
37983static int
37984test_xmlUCSIsMiscellaneousMathematicalSymbolsB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000037985 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037986
William M. Brack21e4ef22005-01-02 09:53:13 +000037987#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000037988 int mem_base;
37989 int ret_val;
37990 int code; /* UCS code point */
37991 int n_code;
37992
37993 for (n_code = 0;n_code < gen_nb_int;n_code++) {
37994 mem_base = xmlMemBlocks();
37995 code = gen_int(n_code, 0);
37996
37997 ret_val = xmlUCSIsMiscellaneousMathematicalSymbolsB(code);
37998 desret_int(ret_val);
37999 call_tests++;
38000 des_int(n_code, code, 0);
38001 xmlResetLastError();
38002 if (mem_base != xmlMemBlocks()) {
38003 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousMathematicalSymbolsB",
38004 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038005 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038006 printf(" %d", n_code);
38007 printf("\n");
38008 }
38009 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038010 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038011#endif
38012
Daniel Veillard42595322004-11-08 10:52:06 +000038013 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038014}
38015
38016
38017static int
38018test_xmlUCSIsMiscellaneousSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038019 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038020
William M. Brack21e4ef22005-01-02 09:53:13 +000038021#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038022 int mem_base;
38023 int ret_val;
38024 int code; /* UCS code point */
38025 int n_code;
38026
38027 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38028 mem_base = xmlMemBlocks();
38029 code = gen_int(n_code, 0);
38030
38031 ret_val = xmlUCSIsMiscellaneousSymbols(code);
38032 desret_int(ret_val);
38033 call_tests++;
38034 des_int(n_code, code, 0);
38035 xmlResetLastError();
38036 if (mem_base != xmlMemBlocks()) {
38037 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousSymbols",
38038 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038039 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038040 printf(" %d", n_code);
38041 printf("\n");
38042 }
38043 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038044 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038045#endif
38046
Daniel Veillard42595322004-11-08 10:52:06 +000038047 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038048}
38049
38050
38051static int
38052test_xmlUCSIsMiscellaneousSymbolsandArrows(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038053 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038054
William M. Brack21e4ef22005-01-02 09:53:13 +000038055#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038056 int mem_base;
38057 int ret_val;
38058 int code; /* UCS code point */
38059 int n_code;
38060
38061 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38062 mem_base = xmlMemBlocks();
38063 code = gen_int(n_code, 0);
38064
38065 ret_val = xmlUCSIsMiscellaneousSymbolsandArrows(code);
38066 desret_int(ret_val);
38067 call_tests++;
38068 des_int(n_code, code, 0);
38069 xmlResetLastError();
38070 if (mem_base != xmlMemBlocks()) {
38071 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousSymbolsandArrows",
38072 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038073 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038074 printf(" %d", n_code);
38075 printf("\n");
38076 }
38077 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038078 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038079#endif
38080
Daniel Veillard42595322004-11-08 10:52:06 +000038081 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038082}
38083
38084
38085static int
38086test_xmlUCSIsMiscellaneousTechnical(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038087 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038088
William M. Brack21e4ef22005-01-02 09:53:13 +000038089#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038090 int mem_base;
38091 int ret_val;
38092 int code; /* UCS code point */
38093 int n_code;
38094
38095 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38096 mem_base = xmlMemBlocks();
38097 code = gen_int(n_code, 0);
38098
38099 ret_val = xmlUCSIsMiscellaneousTechnical(code);
38100 desret_int(ret_val);
38101 call_tests++;
38102 des_int(n_code, code, 0);
38103 xmlResetLastError();
38104 if (mem_base != xmlMemBlocks()) {
38105 printf("Leak of %d blocks found in xmlUCSIsMiscellaneousTechnical",
38106 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038107 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038108 printf(" %d", n_code);
38109 printf("\n");
38110 }
38111 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038112 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038113#endif
38114
Daniel Veillard42595322004-11-08 10:52:06 +000038115 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038116}
38117
38118
38119static int
38120test_xmlUCSIsMongolian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038121 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038122
William M. Brack21e4ef22005-01-02 09:53:13 +000038123#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038124 int mem_base;
38125 int ret_val;
38126 int code; /* UCS code point */
38127 int n_code;
38128
38129 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38130 mem_base = xmlMemBlocks();
38131 code = gen_int(n_code, 0);
38132
38133 ret_val = xmlUCSIsMongolian(code);
38134 desret_int(ret_val);
38135 call_tests++;
38136 des_int(n_code, code, 0);
38137 xmlResetLastError();
38138 if (mem_base != xmlMemBlocks()) {
38139 printf("Leak of %d blocks found in xmlUCSIsMongolian",
38140 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038141 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038142 printf(" %d", n_code);
38143 printf("\n");
38144 }
38145 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038146 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038147#endif
38148
Daniel Veillard42595322004-11-08 10:52:06 +000038149 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038150}
38151
38152
38153static int
38154test_xmlUCSIsMusicalSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038155 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038156
William M. Brack21e4ef22005-01-02 09:53:13 +000038157#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038158 int mem_base;
38159 int ret_val;
38160 int code; /* UCS code point */
38161 int n_code;
38162
38163 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38164 mem_base = xmlMemBlocks();
38165 code = gen_int(n_code, 0);
38166
38167 ret_val = xmlUCSIsMusicalSymbols(code);
38168 desret_int(ret_val);
38169 call_tests++;
38170 des_int(n_code, code, 0);
38171 xmlResetLastError();
38172 if (mem_base != xmlMemBlocks()) {
38173 printf("Leak of %d blocks found in xmlUCSIsMusicalSymbols",
38174 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038175 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038176 printf(" %d", n_code);
38177 printf("\n");
38178 }
38179 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038180 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038181#endif
38182
Daniel Veillard42595322004-11-08 10:52:06 +000038183 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038184}
38185
38186
38187static int
38188test_xmlUCSIsMyanmar(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038189 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038190
William M. Brack21e4ef22005-01-02 09:53:13 +000038191#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038192 int mem_base;
38193 int ret_val;
38194 int code; /* UCS code point */
38195 int n_code;
38196
38197 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38198 mem_base = xmlMemBlocks();
38199 code = gen_int(n_code, 0);
38200
38201 ret_val = xmlUCSIsMyanmar(code);
38202 desret_int(ret_val);
38203 call_tests++;
38204 des_int(n_code, code, 0);
38205 xmlResetLastError();
38206 if (mem_base != xmlMemBlocks()) {
38207 printf("Leak of %d blocks found in xmlUCSIsMyanmar",
38208 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038209 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038210 printf(" %d", n_code);
38211 printf("\n");
38212 }
38213 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038214 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038215#endif
38216
Daniel Veillard42595322004-11-08 10:52:06 +000038217 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038218}
38219
38220
38221static int
38222test_xmlUCSIsNumberForms(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038223 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038224
William M. Brack21e4ef22005-01-02 09:53:13 +000038225#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038226 int mem_base;
38227 int ret_val;
38228 int code; /* UCS code point */
38229 int n_code;
38230
38231 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38232 mem_base = xmlMemBlocks();
38233 code = gen_int(n_code, 0);
38234
38235 ret_val = xmlUCSIsNumberForms(code);
38236 desret_int(ret_val);
38237 call_tests++;
38238 des_int(n_code, code, 0);
38239 xmlResetLastError();
38240 if (mem_base != xmlMemBlocks()) {
38241 printf("Leak of %d blocks found in xmlUCSIsNumberForms",
38242 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038243 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038244 printf(" %d", n_code);
38245 printf("\n");
38246 }
38247 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038248 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038249#endif
38250
Daniel Veillard42595322004-11-08 10:52:06 +000038251 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038252}
38253
38254
38255static int
38256test_xmlUCSIsOgham(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038257 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038258
William M. Brack21e4ef22005-01-02 09:53:13 +000038259#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038260 int mem_base;
38261 int ret_val;
38262 int code; /* UCS code point */
38263 int n_code;
38264
38265 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38266 mem_base = xmlMemBlocks();
38267 code = gen_int(n_code, 0);
38268
38269 ret_val = xmlUCSIsOgham(code);
38270 desret_int(ret_val);
38271 call_tests++;
38272 des_int(n_code, code, 0);
38273 xmlResetLastError();
38274 if (mem_base != xmlMemBlocks()) {
38275 printf("Leak of %d blocks found in xmlUCSIsOgham",
38276 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038277 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038278 printf(" %d", n_code);
38279 printf("\n");
38280 }
38281 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038282 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038283#endif
38284
Daniel Veillard42595322004-11-08 10:52:06 +000038285 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038286}
38287
38288
38289static int
38290test_xmlUCSIsOldItalic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038291 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038292
William M. Brack21e4ef22005-01-02 09:53:13 +000038293#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038294 int mem_base;
38295 int ret_val;
38296 int code; /* UCS code point */
38297 int n_code;
38298
38299 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38300 mem_base = xmlMemBlocks();
38301 code = gen_int(n_code, 0);
38302
38303 ret_val = xmlUCSIsOldItalic(code);
38304 desret_int(ret_val);
38305 call_tests++;
38306 des_int(n_code, code, 0);
38307 xmlResetLastError();
38308 if (mem_base != xmlMemBlocks()) {
38309 printf("Leak of %d blocks found in xmlUCSIsOldItalic",
38310 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038311 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038312 printf(" %d", n_code);
38313 printf("\n");
38314 }
38315 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038316 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038317#endif
38318
Daniel Veillard42595322004-11-08 10:52:06 +000038319 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038320}
38321
38322
38323static int
38324test_xmlUCSIsOpticalCharacterRecognition(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038325 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038326
William M. Brack21e4ef22005-01-02 09:53:13 +000038327#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038328 int mem_base;
38329 int ret_val;
38330 int code; /* UCS code point */
38331 int n_code;
38332
38333 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38334 mem_base = xmlMemBlocks();
38335 code = gen_int(n_code, 0);
38336
38337 ret_val = xmlUCSIsOpticalCharacterRecognition(code);
38338 desret_int(ret_val);
38339 call_tests++;
38340 des_int(n_code, code, 0);
38341 xmlResetLastError();
38342 if (mem_base != xmlMemBlocks()) {
38343 printf("Leak of %d blocks found in xmlUCSIsOpticalCharacterRecognition",
38344 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038345 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038346 printf(" %d", n_code);
38347 printf("\n");
38348 }
38349 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038350 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038351#endif
38352
Daniel Veillard42595322004-11-08 10:52:06 +000038353 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038354}
38355
38356
38357static int
38358test_xmlUCSIsOriya(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038359 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038360
William M. Brack21e4ef22005-01-02 09:53:13 +000038361#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038362 int mem_base;
38363 int ret_val;
38364 int code; /* UCS code point */
38365 int n_code;
38366
38367 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38368 mem_base = xmlMemBlocks();
38369 code = gen_int(n_code, 0);
38370
38371 ret_val = xmlUCSIsOriya(code);
38372 desret_int(ret_val);
38373 call_tests++;
38374 des_int(n_code, code, 0);
38375 xmlResetLastError();
38376 if (mem_base != xmlMemBlocks()) {
38377 printf("Leak of %d blocks found in xmlUCSIsOriya",
38378 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038379 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038380 printf(" %d", n_code);
38381 printf("\n");
38382 }
38383 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038384 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038385#endif
38386
Daniel Veillard42595322004-11-08 10:52:06 +000038387 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038388}
38389
38390
38391static int
38392test_xmlUCSIsOsmanya(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038393 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038394
William M. Brack21e4ef22005-01-02 09:53:13 +000038395#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038396 int mem_base;
38397 int ret_val;
38398 int code; /* UCS code point */
38399 int n_code;
38400
38401 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38402 mem_base = xmlMemBlocks();
38403 code = gen_int(n_code, 0);
38404
38405 ret_val = xmlUCSIsOsmanya(code);
38406 desret_int(ret_val);
38407 call_tests++;
38408 des_int(n_code, code, 0);
38409 xmlResetLastError();
38410 if (mem_base != xmlMemBlocks()) {
38411 printf("Leak of %d blocks found in xmlUCSIsOsmanya",
38412 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038413 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038414 printf(" %d", n_code);
38415 printf("\n");
38416 }
38417 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038418 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038419#endif
38420
Daniel Veillard42595322004-11-08 10:52:06 +000038421 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038422}
38423
38424
38425static int
38426test_xmlUCSIsPhoneticExtensions(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038427 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038428
William M. Brack21e4ef22005-01-02 09:53:13 +000038429#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038430 int mem_base;
38431 int ret_val;
38432 int code; /* UCS code point */
38433 int n_code;
38434
38435 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38436 mem_base = xmlMemBlocks();
38437 code = gen_int(n_code, 0);
38438
38439 ret_val = xmlUCSIsPhoneticExtensions(code);
38440 desret_int(ret_val);
38441 call_tests++;
38442 des_int(n_code, code, 0);
38443 xmlResetLastError();
38444 if (mem_base != xmlMemBlocks()) {
38445 printf("Leak of %d blocks found in xmlUCSIsPhoneticExtensions",
38446 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038447 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038448 printf(" %d", n_code);
38449 printf("\n");
38450 }
38451 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038452 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038453#endif
38454
Daniel Veillard42595322004-11-08 10:52:06 +000038455 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038456}
38457
38458
38459static int
38460test_xmlUCSIsPrivateUse(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038461 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038462
William M. Brack21e4ef22005-01-02 09:53:13 +000038463#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038464 int mem_base;
38465 int ret_val;
38466 int code; /* UCS code point */
38467 int n_code;
38468
38469 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38470 mem_base = xmlMemBlocks();
38471 code = gen_int(n_code, 0);
38472
38473 ret_val = xmlUCSIsPrivateUse(code);
38474 desret_int(ret_val);
38475 call_tests++;
38476 des_int(n_code, code, 0);
38477 xmlResetLastError();
38478 if (mem_base != xmlMemBlocks()) {
38479 printf("Leak of %d blocks found in xmlUCSIsPrivateUse",
38480 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038481 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038482 printf(" %d", n_code);
38483 printf("\n");
38484 }
38485 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038486 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038487#endif
38488
Daniel Veillard42595322004-11-08 10:52:06 +000038489 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038490}
38491
38492
38493static int
38494test_xmlUCSIsPrivateUseArea(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038495 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038496
William M. Brack21e4ef22005-01-02 09:53:13 +000038497#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038498 int mem_base;
38499 int ret_val;
38500 int code; /* UCS code point */
38501 int n_code;
38502
38503 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38504 mem_base = xmlMemBlocks();
38505 code = gen_int(n_code, 0);
38506
38507 ret_val = xmlUCSIsPrivateUseArea(code);
38508 desret_int(ret_val);
38509 call_tests++;
38510 des_int(n_code, code, 0);
38511 xmlResetLastError();
38512 if (mem_base != xmlMemBlocks()) {
38513 printf("Leak of %d blocks found in xmlUCSIsPrivateUseArea",
38514 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038515 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038516 printf(" %d", n_code);
38517 printf("\n");
38518 }
38519 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038520 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038521#endif
38522
Daniel Veillard42595322004-11-08 10:52:06 +000038523 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038524}
38525
38526
38527static int
38528test_xmlUCSIsRunic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038529 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038530
William M. Brack21e4ef22005-01-02 09:53:13 +000038531#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038532 int mem_base;
38533 int ret_val;
38534 int code; /* UCS code point */
38535 int n_code;
38536
38537 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38538 mem_base = xmlMemBlocks();
38539 code = gen_int(n_code, 0);
38540
38541 ret_val = xmlUCSIsRunic(code);
38542 desret_int(ret_val);
38543 call_tests++;
38544 des_int(n_code, code, 0);
38545 xmlResetLastError();
38546 if (mem_base != xmlMemBlocks()) {
38547 printf("Leak of %d blocks found in xmlUCSIsRunic",
38548 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038549 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038550 printf(" %d", n_code);
38551 printf("\n");
38552 }
38553 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038554 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038555#endif
38556
Daniel Veillard42595322004-11-08 10:52:06 +000038557 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038558}
38559
38560
38561static int
38562test_xmlUCSIsShavian(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038563 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038564
William M. Brack21e4ef22005-01-02 09:53:13 +000038565#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038566 int mem_base;
38567 int ret_val;
38568 int code; /* UCS code point */
38569 int n_code;
38570
38571 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38572 mem_base = xmlMemBlocks();
38573 code = gen_int(n_code, 0);
38574
38575 ret_val = xmlUCSIsShavian(code);
38576 desret_int(ret_val);
38577 call_tests++;
38578 des_int(n_code, code, 0);
38579 xmlResetLastError();
38580 if (mem_base != xmlMemBlocks()) {
38581 printf("Leak of %d blocks found in xmlUCSIsShavian",
38582 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038583 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038584 printf(" %d", n_code);
38585 printf("\n");
38586 }
38587 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038588 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038589#endif
38590
Daniel Veillard42595322004-11-08 10:52:06 +000038591 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038592}
38593
38594
38595static int
38596test_xmlUCSIsSinhala(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038597 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038598
William M. Brack21e4ef22005-01-02 09:53:13 +000038599#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038600 int mem_base;
38601 int ret_val;
38602 int code; /* UCS code point */
38603 int n_code;
38604
38605 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38606 mem_base = xmlMemBlocks();
38607 code = gen_int(n_code, 0);
38608
38609 ret_val = xmlUCSIsSinhala(code);
38610 desret_int(ret_val);
38611 call_tests++;
38612 des_int(n_code, code, 0);
38613 xmlResetLastError();
38614 if (mem_base != xmlMemBlocks()) {
38615 printf("Leak of %d blocks found in xmlUCSIsSinhala",
38616 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038617 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038618 printf(" %d", n_code);
38619 printf("\n");
38620 }
38621 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038622 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038623#endif
38624
Daniel Veillard42595322004-11-08 10:52:06 +000038625 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038626}
38627
38628
38629static int
38630test_xmlUCSIsSmallFormVariants(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038631 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038632
William M. Brack21e4ef22005-01-02 09:53:13 +000038633#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038634 int mem_base;
38635 int ret_val;
38636 int code; /* UCS code point */
38637 int n_code;
38638
38639 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38640 mem_base = xmlMemBlocks();
38641 code = gen_int(n_code, 0);
38642
38643 ret_val = xmlUCSIsSmallFormVariants(code);
38644 desret_int(ret_val);
38645 call_tests++;
38646 des_int(n_code, code, 0);
38647 xmlResetLastError();
38648 if (mem_base != xmlMemBlocks()) {
38649 printf("Leak of %d blocks found in xmlUCSIsSmallFormVariants",
38650 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038651 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038652 printf(" %d", n_code);
38653 printf("\n");
38654 }
38655 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038656 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038657#endif
38658
Daniel Veillard42595322004-11-08 10:52:06 +000038659 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038660}
38661
38662
38663static int
38664test_xmlUCSIsSpacingModifierLetters(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038665 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038666
William M. Brack21e4ef22005-01-02 09:53:13 +000038667#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038668 int mem_base;
38669 int ret_val;
38670 int code; /* UCS code point */
38671 int n_code;
38672
38673 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38674 mem_base = xmlMemBlocks();
38675 code = gen_int(n_code, 0);
38676
38677 ret_val = xmlUCSIsSpacingModifierLetters(code);
38678 desret_int(ret_val);
38679 call_tests++;
38680 des_int(n_code, code, 0);
38681 xmlResetLastError();
38682 if (mem_base != xmlMemBlocks()) {
38683 printf("Leak of %d blocks found in xmlUCSIsSpacingModifierLetters",
38684 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038685 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038686 printf(" %d", n_code);
38687 printf("\n");
38688 }
38689 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038690 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038691#endif
38692
Daniel Veillard42595322004-11-08 10:52:06 +000038693 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038694}
38695
38696
38697static int
38698test_xmlUCSIsSpecials(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038699 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038700
William M. Brack21e4ef22005-01-02 09:53:13 +000038701#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038702 int mem_base;
38703 int ret_val;
38704 int code; /* UCS code point */
38705 int n_code;
38706
38707 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38708 mem_base = xmlMemBlocks();
38709 code = gen_int(n_code, 0);
38710
38711 ret_val = xmlUCSIsSpecials(code);
38712 desret_int(ret_val);
38713 call_tests++;
38714 des_int(n_code, code, 0);
38715 xmlResetLastError();
38716 if (mem_base != xmlMemBlocks()) {
38717 printf("Leak of %d blocks found in xmlUCSIsSpecials",
38718 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038719 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038720 printf(" %d", n_code);
38721 printf("\n");
38722 }
38723 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038724 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038725#endif
38726
Daniel Veillard42595322004-11-08 10:52:06 +000038727 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038728}
38729
38730
38731static int
38732test_xmlUCSIsSuperscriptsandSubscripts(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038733 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038734
William M. Brack21e4ef22005-01-02 09:53:13 +000038735#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038736 int mem_base;
38737 int ret_val;
38738 int code; /* UCS code point */
38739 int n_code;
38740
38741 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38742 mem_base = xmlMemBlocks();
38743 code = gen_int(n_code, 0);
38744
38745 ret_val = xmlUCSIsSuperscriptsandSubscripts(code);
38746 desret_int(ret_val);
38747 call_tests++;
38748 des_int(n_code, code, 0);
38749 xmlResetLastError();
38750 if (mem_base != xmlMemBlocks()) {
38751 printf("Leak of %d blocks found in xmlUCSIsSuperscriptsandSubscripts",
38752 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038753 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038754 printf(" %d", n_code);
38755 printf("\n");
38756 }
38757 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038758 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038759#endif
38760
Daniel Veillard42595322004-11-08 10:52:06 +000038761 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038762}
38763
38764
38765static int
38766test_xmlUCSIsSupplementalArrowsA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038767 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038768
William M. Brack21e4ef22005-01-02 09:53:13 +000038769#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038770 int mem_base;
38771 int ret_val;
38772 int code; /* UCS code point */
38773 int n_code;
38774
38775 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38776 mem_base = xmlMemBlocks();
38777 code = gen_int(n_code, 0);
38778
38779 ret_val = xmlUCSIsSupplementalArrowsA(code);
38780 desret_int(ret_val);
38781 call_tests++;
38782 des_int(n_code, code, 0);
38783 xmlResetLastError();
38784 if (mem_base != xmlMemBlocks()) {
38785 printf("Leak of %d blocks found in xmlUCSIsSupplementalArrowsA",
38786 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038787 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038788 printf(" %d", n_code);
38789 printf("\n");
38790 }
38791 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038792 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038793#endif
38794
Daniel Veillard42595322004-11-08 10:52:06 +000038795 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038796}
38797
38798
38799static int
38800test_xmlUCSIsSupplementalArrowsB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038801 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038802
William M. Brack21e4ef22005-01-02 09:53:13 +000038803#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038804 int mem_base;
38805 int ret_val;
38806 int code; /* UCS code point */
38807 int n_code;
38808
38809 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38810 mem_base = xmlMemBlocks();
38811 code = gen_int(n_code, 0);
38812
38813 ret_val = xmlUCSIsSupplementalArrowsB(code);
38814 desret_int(ret_val);
38815 call_tests++;
38816 des_int(n_code, code, 0);
38817 xmlResetLastError();
38818 if (mem_base != xmlMemBlocks()) {
38819 printf("Leak of %d blocks found in xmlUCSIsSupplementalArrowsB",
38820 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038821 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038822 printf(" %d", n_code);
38823 printf("\n");
38824 }
38825 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038826 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038827#endif
38828
Daniel Veillard42595322004-11-08 10:52:06 +000038829 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038830}
38831
38832
38833static int
38834test_xmlUCSIsSupplementalMathematicalOperators(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038835 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038836
William M. Brack21e4ef22005-01-02 09:53:13 +000038837#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038838 int mem_base;
38839 int ret_val;
38840 int code; /* UCS code point */
38841 int n_code;
38842
38843 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38844 mem_base = xmlMemBlocks();
38845 code = gen_int(n_code, 0);
38846
38847 ret_val = xmlUCSIsSupplementalMathematicalOperators(code);
38848 desret_int(ret_val);
38849 call_tests++;
38850 des_int(n_code, code, 0);
38851 xmlResetLastError();
38852 if (mem_base != xmlMemBlocks()) {
38853 printf("Leak of %d blocks found in xmlUCSIsSupplementalMathematicalOperators",
38854 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038855 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038856 printf(" %d", n_code);
38857 printf("\n");
38858 }
38859 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038860 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038861#endif
38862
Daniel Veillard42595322004-11-08 10:52:06 +000038863 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038864}
38865
38866
38867static int
38868test_xmlUCSIsSupplementaryPrivateUseAreaA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038869 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038870
William M. Brack21e4ef22005-01-02 09:53:13 +000038871#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038872 int mem_base;
38873 int ret_val;
38874 int code; /* UCS code point */
38875 int n_code;
38876
38877 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38878 mem_base = xmlMemBlocks();
38879 code = gen_int(n_code, 0);
38880
38881 ret_val = xmlUCSIsSupplementaryPrivateUseAreaA(code);
38882 desret_int(ret_val);
38883 call_tests++;
38884 des_int(n_code, code, 0);
38885 xmlResetLastError();
38886 if (mem_base != xmlMemBlocks()) {
38887 printf("Leak of %d blocks found in xmlUCSIsSupplementaryPrivateUseAreaA",
38888 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038889 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038890 printf(" %d", n_code);
38891 printf("\n");
38892 }
38893 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038894 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038895#endif
38896
Daniel Veillard42595322004-11-08 10:52:06 +000038897 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038898}
38899
38900
38901static int
38902test_xmlUCSIsSupplementaryPrivateUseAreaB(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038903 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038904
William M. Brack21e4ef22005-01-02 09:53:13 +000038905#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038906 int mem_base;
38907 int ret_val;
38908 int code; /* UCS code point */
38909 int n_code;
38910
38911 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38912 mem_base = xmlMemBlocks();
38913 code = gen_int(n_code, 0);
38914
38915 ret_val = xmlUCSIsSupplementaryPrivateUseAreaB(code);
38916 desret_int(ret_val);
38917 call_tests++;
38918 des_int(n_code, code, 0);
38919 xmlResetLastError();
38920 if (mem_base != xmlMemBlocks()) {
38921 printf("Leak of %d blocks found in xmlUCSIsSupplementaryPrivateUseAreaB",
38922 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038923 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038924 printf(" %d", n_code);
38925 printf("\n");
38926 }
38927 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038928 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038929#endif
38930
Daniel Veillard42595322004-11-08 10:52:06 +000038931 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038932}
38933
38934
38935static int
38936test_xmlUCSIsSyriac(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038937 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038938
William M. Brack21e4ef22005-01-02 09:53:13 +000038939#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038940 int mem_base;
38941 int ret_val;
38942 int code; /* UCS code point */
38943 int n_code;
38944
38945 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38946 mem_base = xmlMemBlocks();
38947 code = gen_int(n_code, 0);
38948
38949 ret_val = xmlUCSIsSyriac(code);
38950 desret_int(ret_val);
38951 call_tests++;
38952 des_int(n_code, code, 0);
38953 xmlResetLastError();
38954 if (mem_base != xmlMemBlocks()) {
38955 printf("Leak of %d blocks found in xmlUCSIsSyriac",
38956 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038957 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038958 printf(" %d", n_code);
38959 printf("\n");
38960 }
38961 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038962 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038963#endif
38964
Daniel Veillard42595322004-11-08 10:52:06 +000038965 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038966}
38967
38968
38969static int
38970test_xmlUCSIsTagalog(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000038971 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038972
William M. Brack21e4ef22005-01-02 09:53:13 +000038973#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038974 int mem_base;
38975 int ret_val;
38976 int code; /* UCS code point */
38977 int n_code;
38978
38979 for (n_code = 0;n_code < gen_nb_int;n_code++) {
38980 mem_base = xmlMemBlocks();
38981 code = gen_int(n_code, 0);
38982
38983 ret_val = xmlUCSIsTagalog(code);
38984 desret_int(ret_val);
38985 call_tests++;
38986 des_int(n_code, code, 0);
38987 xmlResetLastError();
38988 if (mem_base != xmlMemBlocks()) {
38989 printf("Leak of %d blocks found in xmlUCSIsTagalog",
38990 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000038991 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038992 printf(" %d", n_code);
38993 printf("\n");
38994 }
38995 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000038996 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000038997#endif
38998
Daniel Veillard42595322004-11-08 10:52:06 +000038999 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039000}
39001
39002
39003static int
39004test_xmlUCSIsTagbanwa(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039005 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039006
William M. Brack21e4ef22005-01-02 09:53:13 +000039007#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039008 int mem_base;
39009 int ret_val;
39010 int code; /* UCS code point */
39011 int n_code;
39012
39013 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39014 mem_base = xmlMemBlocks();
39015 code = gen_int(n_code, 0);
39016
39017 ret_val = xmlUCSIsTagbanwa(code);
39018 desret_int(ret_val);
39019 call_tests++;
39020 des_int(n_code, code, 0);
39021 xmlResetLastError();
39022 if (mem_base != xmlMemBlocks()) {
39023 printf("Leak of %d blocks found in xmlUCSIsTagbanwa",
39024 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039025 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039026 printf(" %d", n_code);
39027 printf("\n");
39028 }
39029 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039030 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039031#endif
39032
Daniel Veillard42595322004-11-08 10:52:06 +000039033 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039034}
39035
39036
39037static int
39038test_xmlUCSIsTags(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039039 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039040
William M. Brack21e4ef22005-01-02 09:53:13 +000039041#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039042 int mem_base;
39043 int ret_val;
39044 int code; /* UCS code point */
39045 int n_code;
39046
39047 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39048 mem_base = xmlMemBlocks();
39049 code = gen_int(n_code, 0);
39050
39051 ret_val = xmlUCSIsTags(code);
39052 desret_int(ret_val);
39053 call_tests++;
39054 des_int(n_code, code, 0);
39055 xmlResetLastError();
39056 if (mem_base != xmlMemBlocks()) {
39057 printf("Leak of %d blocks found in xmlUCSIsTags",
39058 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039059 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039060 printf(" %d", n_code);
39061 printf("\n");
39062 }
39063 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039064 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039065#endif
39066
Daniel Veillard42595322004-11-08 10:52:06 +000039067 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039068}
39069
39070
39071static int
39072test_xmlUCSIsTaiLe(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039073 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039074
William M. Brack21e4ef22005-01-02 09:53:13 +000039075#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039076 int mem_base;
39077 int ret_val;
39078 int code; /* UCS code point */
39079 int n_code;
39080
39081 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39082 mem_base = xmlMemBlocks();
39083 code = gen_int(n_code, 0);
39084
39085 ret_val = xmlUCSIsTaiLe(code);
39086 desret_int(ret_val);
39087 call_tests++;
39088 des_int(n_code, code, 0);
39089 xmlResetLastError();
39090 if (mem_base != xmlMemBlocks()) {
39091 printf("Leak of %d blocks found in xmlUCSIsTaiLe",
39092 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039093 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039094 printf(" %d", n_code);
39095 printf("\n");
39096 }
39097 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039098 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039099#endif
39100
Daniel Veillard42595322004-11-08 10:52:06 +000039101 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039102}
39103
39104
39105static int
39106test_xmlUCSIsTaiXuanJingSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039107 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039108
William M. Brack21e4ef22005-01-02 09:53:13 +000039109#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039110 int mem_base;
39111 int ret_val;
39112 int code; /* UCS code point */
39113 int n_code;
39114
39115 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39116 mem_base = xmlMemBlocks();
39117 code = gen_int(n_code, 0);
39118
39119 ret_val = xmlUCSIsTaiXuanJingSymbols(code);
39120 desret_int(ret_val);
39121 call_tests++;
39122 des_int(n_code, code, 0);
39123 xmlResetLastError();
39124 if (mem_base != xmlMemBlocks()) {
39125 printf("Leak of %d blocks found in xmlUCSIsTaiXuanJingSymbols",
39126 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039127 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039128 printf(" %d", n_code);
39129 printf("\n");
39130 }
39131 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039132 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039133#endif
39134
Daniel Veillard42595322004-11-08 10:52:06 +000039135 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039136}
39137
39138
39139static int
39140test_xmlUCSIsTamil(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039141 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039142
William M. Brack21e4ef22005-01-02 09:53:13 +000039143#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039144 int mem_base;
39145 int ret_val;
39146 int code; /* UCS code point */
39147 int n_code;
39148
39149 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39150 mem_base = xmlMemBlocks();
39151 code = gen_int(n_code, 0);
39152
39153 ret_val = xmlUCSIsTamil(code);
39154 desret_int(ret_val);
39155 call_tests++;
39156 des_int(n_code, code, 0);
39157 xmlResetLastError();
39158 if (mem_base != xmlMemBlocks()) {
39159 printf("Leak of %d blocks found in xmlUCSIsTamil",
39160 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039161 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039162 printf(" %d", n_code);
39163 printf("\n");
39164 }
39165 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039166 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039167#endif
39168
Daniel Veillard42595322004-11-08 10:52:06 +000039169 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039170}
39171
39172
39173static int
39174test_xmlUCSIsTelugu(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039175 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039176
William M. Brack21e4ef22005-01-02 09:53:13 +000039177#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039178 int mem_base;
39179 int ret_val;
39180 int code; /* UCS code point */
39181 int n_code;
39182
39183 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39184 mem_base = xmlMemBlocks();
39185 code = gen_int(n_code, 0);
39186
39187 ret_val = xmlUCSIsTelugu(code);
39188 desret_int(ret_val);
39189 call_tests++;
39190 des_int(n_code, code, 0);
39191 xmlResetLastError();
39192 if (mem_base != xmlMemBlocks()) {
39193 printf("Leak of %d blocks found in xmlUCSIsTelugu",
39194 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039195 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039196 printf(" %d", n_code);
39197 printf("\n");
39198 }
39199 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039200 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039201#endif
39202
Daniel Veillard42595322004-11-08 10:52:06 +000039203 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039204}
39205
39206
39207static int
39208test_xmlUCSIsThaana(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039209 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039210
William M. Brack21e4ef22005-01-02 09:53:13 +000039211#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039212 int mem_base;
39213 int ret_val;
39214 int code; /* UCS code point */
39215 int n_code;
39216
39217 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39218 mem_base = xmlMemBlocks();
39219 code = gen_int(n_code, 0);
39220
39221 ret_val = xmlUCSIsThaana(code);
39222 desret_int(ret_val);
39223 call_tests++;
39224 des_int(n_code, code, 0);
39225 xmlResetLastError();
39226 if (mem_base != xmlMemBlocks()) {
39227 printf("Leak of %d blocks found in xmlUCSIsThaana",
39228 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039229 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039230 printf(" %d", n_code);
39231 printf("\n");
39232 }
39233 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039234 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039235#endif
39236
Daniel Veillard42595322004-11-08 10:52:06 +000039237 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039238}
39239
39240
39241static int
39242test_xmlUCSIsThai(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039243 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039244
William M. Brack21e4ef22005-01-02 09:53:13 +000039245#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039246 int mem_base;
39247 int ret_val;
39248 int code; /* UCS code point */
39249 int n_code;
39250
39251 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39252 mem_base = xmlMemBlocks();
39253 code = gen_int(n_code, 0);
39254
39255 ret_val = xmlUCSIsThai(code);
39256 desret_int(ret_val);
39257 call_tests++;
39258 des_int(n_code, code, 0);
39259 xmlResetLastError();
39260 if (mem_base != xmlMemBlocks()) {
39261 printf("Leak of %d blocks found in xmlUCSIsThai",
39262 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039263 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039264 printf(" %d", n_code);
39265 printf("\n");
39266 }
39267 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039268 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039269#endif
39270
Daniel Veillard42595322004-11-08 10:52:06 +000039271 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039272}
39273
39274
39275static int
39276test_xmlUCSIsTibetan(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039277 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039278
William M. Brack21e4ef22005-01-02 09:53:13 +000039279#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039280 int mem_base;
39281 int ret_val;
39282 int code; /* UCS code point */
39283 int n_code;
39284
39285 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39286 mem_base = xmlMemBlocks();
39287 code = gen_int(n_code, 0);
39288
39289 ret_val = xmlUCSIsTibetan(code);
39290 desret_int(ret_val);
39291 call_tests++;
39292 des_int(n_code, code, 0);
39293 xmlResetLastError();
39294 if (mem_base != xmlMemBlocks()) {
39295 printf("Leak of %d blocks found in xmlUCSIsTibetan",
39296 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039297 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039298 printf(" %d", n_code);
39299 printf("\n");
39300 }
39301 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039302 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039303#endif
39304
Daniel Veillard42595322004-11-08 10:52:06 +000039305 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039306}
39307
39308
39309static int
39310test_xmlUCSIsUgaritic(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039311 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039312
William M. Brack21e4ef22005-01-02 09:53:13 +000039313#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039314 int mem_base;
39315 int ret_val;
39316 int code; /* UCS code point */
39317 int n_code;
39318
39319 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39320 mem_base = xmlMemBlocks();
39321 code = gen_int(n_code, 0);
39322
39323 ret_val = xmlUCSIsUgaritic(code);
39324 desret_int(ret_val);
39325 call_tests++;
39326 des_int(n_code, code, 0);
39327 xmlResetLastError();
39328 if (mem_base != xmlMemBlocks()) {
39329 printf("Leak of %d blocks found in xmlUCSIsUgaritic",
39330 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039331 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039332 printf(" %d", n_code);
39333 printf("\n");
39334 }
39335 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039336 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039337#endif
39338
Daniel Veillard42595322004-11-08 10:52:06 +000039339 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039340}
39341
39342
39343static int
39344test_xmlUCSIsUnifiedCanadianAboriginalSyllabics(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039345 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039346
William M. Brack21e4ef22005-01-02 09:53:13 +000039347#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039348 int mem_base;
39349 int ret_val;
39350 int code; /* UCS code point */
39351 int n_code;
39352
39353 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39354 mem_base = xmlMemBlocks();
39355 code = gen_int(n_code, 0);
39356
39357 ret_val = xmlUCSIsUnifiedCanadianAboriginalSyllabics(code);
39358 desret_int(ret_val);
39359 call_tests++;
39360 des_int(n_code, code, 0);
39361 xmlResetLastError();
39362 if (mem_base != xmlMemBlocks()) {
39363 printf("Leak of %d blocks found in xmlUCSIsUnifiedCanadianAboriginalSyllabics",
39364 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039365 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039366 printf(" %d", n_code);
39367 printf("\n");
39368 }
39369 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039370 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039371#endif
39372
Daniel Veillard42595322004-11-08 10:52:06 +000039373 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039374}
39375
39376
39377static int
39378test_xmlUCSIsVariationSelectors(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039379 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039380
William M. Brack21e4ef22005-01-02 09:53:13 +000039381#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039382 int mem_base;
39383 int ret_val;
39384 int code; /* UCS code point */
39385 int n_code;
39386
39387 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39388 mem_base = xmlMemBlocks();
39389 code = gen_int(n_code, 0);
39390
39391 ret_val = xmlUCSIsVariationSelectors(code);
39392 desret_int(ret_val);
39393 call_tests++;
39394 des_int(n_code, code, 0);
39395 xmlResetLastError();
39396 if (mem_base != xmlMemBlocks()) {
39397 printf("Leak of %d blocks found in xmlUCSIsVariationSelectors",
39398 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039399 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039400 printf(" %d", n_code);
39401 printf("\n");
39402 }
39403 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039404 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039405#endif
39406
Daniel Veillard42595322004-11-08 10:52:06 +000039407 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039408}
39409
39410
39411static int
39412test_xmlUCSIsVariationSelectorsSupplement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039413 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039414
William M. Brack21e4ef22005-01-02 09:53:13 +000039415#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039416 int mem_base;
39417 int ret_val;
39418 int code; /* UCS code point */
39419 int n_code;
39420
39421 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39422 mem_base = xmlMemBlocks();
39423 code = gen_int(n_code, 0);
39424
39425 ret_val = xmlUCSIsVariationSelectorsSupplement(code);
39426 desret_int(ret_val);
39427 call_tests++;
39428 des_int(n_code, code, 0);
39429 xmlResetLastError();
39430 if (mem_base != xmlMemBlocks()) {
39431 printf("Leak of %d blocks found in xmlUCSIsVariationSelectorsSupplement",
39432 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039433 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039434 printf(" %d", n_code);
39435 printf("\n");
39436 }
39437 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039438 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039439#endif
39440
Daniel Veillard42595322004-11-08 10:52:06 +000039441 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039442}
39443
39444
39445static int
39446test_xmlUCSIsYiRadicals(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039447 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039448
William M. Brack21e4ef22005-01-02 09:53:13 +000039449#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039450 int mem_base;
39451 int ret_val;
39452 int code; /* UCS code point */
39453 int n_code;
39454
39455 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39456 mem_base = xmlMemBlocks();
39457 code = gen_int(n_code, 0);
39458
39459 ret_val = xmlUCSIsYiRadicals(code);
39460 desret_int(ret_val);
39461 call_tests++;
39462 des_int(n_code, code, 0);
39463 xmlResetLastError();
39464 if (mem_base != xmlMemBlocks()) {
39465 printf("Leak of %d blocks found in xmlUCSIsYiRadicals",
39466 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039467 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039468 printf(" %d", n_code);
39469 printf("\n");
39470 }
39471 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039472 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039473#endif
39474
Daniel Veillard42595322004-11-08 10:52:06 +000039475 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039476}
39477
39478
39479static int
39480test_xmlUCSIsYiSyllables(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039481 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039482
William M. Brack21e4ef22005-01-02 09:53:13 +000039483#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039484 int mem_base;
39485 int ret_val;
39486 int code; /* UCS code point */
39487 int n_code;
39488
39489 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39490 mem_base = xmlMemBlocks();
39491 code = gen_int(n_code, 0);
39492
39493 ret_val = xmlUCSIsYiSyllables(code);
39494 desret_int(ret_val);
39495 call_tests++;
39496 des_int(n_code, code, 0);
39497 xmlResetLastError();
39498 if (mem_base != xmlMemBlocks()) {
39499 printf("Leak of %d blocks found in xmlUCSIsYiSyllables",
39500 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039501 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039502 printf(" %d", n_code);
39503 printf("\n");
39504 }
39505 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039506 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039507#endif
39508
Daniel Veillard42595322004-11-08 10:52:06 +000039509 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039510}
39511
39512
39513static int
39514test_xmlUCSIsYijingHexagramSymbols(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039515 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039516
William M. Brack21e4ef22005-01-02 09:53:13 +000039517#if defined(LIBXML_UNICODE_ENABLED)
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039518 int mem_base;
39519 int ret_val;
39520 int code; /* UCS code point */
39521 int n_code;
39522
39523 for (n_code = 0;n_code < gen_nb_int;n_code++) {
39524 mem_base = xmlMemBlocks();
39525 code = gen_int(n_code, 0);
39526
39527 ret_val = xmlUCSIsYijingHexagramSymbols(code);
39528 desret_int(ret_val);
39529 call_tests++;
39530 des_int(n_code, code, 0);
39531 xmlResetLastError();
39532 if (mem_base != xmlMemBlocks()) {
39533 printf("Leak of %d blocks found in xmlUCSIsYijingHexagramSymbols",
39534 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039535 test_ret++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039536 printf(" %d", n_code);
39537 printf("\n");
39538 }
39539 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039540 function_tests++;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039541#endif
39542
Daniel Veillard42595322004-11-08 10:52:06 +000039543 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039544}
39545
39546static int
39547test_xmlunicode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039548 int test_ret = 0;
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039549
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039550 if (quiet == 0) printf("Testing xmlunicode : 166 of 166 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000039551 test_ret += test_xmlUCSIsAegeanNumbers();
39552 test_ret += test_xmlUCSIsAlphabeticPresentationForms();
39553 test_ret += test_xmlUCSIsArabic();
39554 test_ret += test_xmlUCSIsArabicPresentationFormsA();
39555 test_ret += test_xmlUCSIsArabicPresentationFormsB();
39556 test_ret += test_xmlUCSIsArmenian();
39557 test_ret += test_xmlUCSIsArrows();
39558 test_ret += test_xmlUCSIsBasicLatin();
39559 test_ret += test_xmlUCSIsBengali();
39560 test_ret += test_xmlUCSIsBlock();
39561 test_ret += test_xmlUCSIsBlockElements();
39562 test_ret += test_xmlUCSIsBopomofo();
39563 test_ret += test_xmlUCSIsBopomofoExtended();
39564 test_ret += test_xmlUCSIsBoxDrawing();
39565 test_ret += test_xmlUCSIsBraillePatterns();
39566 test_ret += test_xmlUCSIsBuhid();
39567 test_ret += test_xmlUCSIsByzantineMusicalSymbols();
39568 test_ret += test_xmlUCSIsCJKCompatibility();
39569 test_ret += test_xmlUCSIsCJKCompatibilityForms();
39570 test_ret += test_xmlUCSIsCJKCompatibilityIdeographs();
39571 test_ret += test_xmlUCSIsCJKCompatibilityIdeographsSupplement();
39572 test_ret += test_xmlUCSIsCJKRadicalsSupplement();
39573 test_ret += test_xmlUCSIsCJKSymbolsandPunctuation();
39574 test_ret += test_xmlUCSIsCJKUnifiedIdeographs();
39575 test_ret += test_xmlUCSIsCJKUnifiedIdeographsExtensionA();
39576 test_ret += test_xmlUCSIsCJKUnifiedIdeographsExtensionB();
39577 test_ret += test_xmlUCSIsCat();
39578 test_ret += test_xmlUCSIsCatC();
39579 test_ret += test_xmlUCSIsCatCc();
39580 test_ret += test_xmlUCSIsCatCf();
39581 test_ret += test_xmlUCSIsCatCo();
39582 test_ret += test_xmlUCSIsCatCs();
39583 test_ret += test_xmlUCSIsCatL();
39584 test_ret += test_xmlUCSIsCatLl();
39585 test_ret += test_xmlUCSIsCatLm();
39586 test_ret += test_xmlUCSIsCatLo();
39587 test_ret += test_xmlUCSIsCatLt();
39588 test_ret += test_xmlUCSIsCatLu();
39589 test_ret += test_xmlUCSIsCatM();
39590 test_ret += test_xmlUCSIsCatMc();
39591 test_ret += test_xmlUCSIsCatMe();
39592 test_ret += test_xmlUCSIsCatMn();
39593 test_ret += test_xmlUCSIsCatN();
39594 test_ret += test_xmlUCSIsCatNd();
39595 test_ret += test_xmlUCSIsCatNl();
39596 test_ret += test_xmlUCSIsCatNo();
39597 test_ret += test_xmlUCSIsCatP();
39598 test_ret += test_xmlUCSIsCatPc();
39599 test_ret += test_xmlUCSIsCatPd();
39600 test_ret += test_xmlUCSIsCatPe();
39601 test_ret += test_xmlUCSIsCatPf();
39602 test_ret += test_xmlUCSIsCatPi();
39603 test_ret += test_xmlUCSIsCatPo();
39604 test_ret += test_xmlUCSIsCatPs();
39605 test_ret += test_xmlUCSIsCatS();
39606 test_ret += test_xmlUCSIsCatSc();
39607 test_ret += test_xmlUCSIsCatSk();
39608 test_ret += test_xmlUCSIsCatSm();
39609 test_ret += test_xmlUCSIsCatSo();
39610 test_ret += test_xmlUCSIsCatZ();
39611 test_ret += test_xmlUCSIsCatZl();
39612 test_ret += test_xmlUCSIsCatZp();
39613 test_ret += test_xmlUCSIsCatZs();
39614 test_ret += test_xmlUCSIsCherokee();
39615 test_ret += test_xmlUCSIsCombiningDiacriticalMarks();
39616 test_ret += test_xmlUCSIsCombiningDiacriticalMarksforSymbols();
39617 test_ret += test_xmlUCSIsCombiningHalfMarks();
39618 test_ret += test_xmlUCSIsCombiningMarksforSymbols();
39619 test_ret += test_xmlUCSIsControlPictures();
39620 test_ret += test_xmlUCSIsCurrencySymbols();
39621 test_ret += test_xmlUCSIsCypriotSyllabary();
39622 test_ret += test_xmlUCSIsCyrillic();
39623 test_ret += test_xmlUCSIsCyrillicSupplement();
39624 test_ret += test_xmlUCSIsDeseret();
39625 test_ret += test_xmlUCSIsDevanagari();
39626 test_ret += test_xmlUCSIsDingbats();
39627 test_ret += test_xmlUCSIsEnclosedAlphanumerics();
39628 test_ret += test_xmlUCSIsEnclosedCJKLettersandMonths();
39629 test_ret += test_xmlUCSIsEthiopic();
39630 test_ret += test_xmlUCSIsGeneralPunctuation();
39631 test_ret += test_xmlUCSIsGeometricShapes();
39632 test_ret += test_xmlUCSIsGeorgian();
39633 test_ret += test_xmlUCSIsGothic();
39634 test_ret += test_xmlUCSIsGreek();
39635 test_ret += test_xmlUCSIsGreekExtended();
39636 test_ret += test_xmlUCSIsGreekandCoptic();
39637 test_ret += test_xmlUCSIsGujarati();
39638 test_ret += test_xmlUCSIsGurmukhi();
39639 test_ret += test_xmlUCSIsHalfwidthandFullwidthForms();
39640 test_ret += test_xmlUCSIsHangulCompatibilityJamo();
39641 test_ret += test_xmlUCSIsHangulJamo();
39642 test_ret += test_xmlUCSIsHangulSyllables();
39643 test_ret += test_xmlUCSIsHanunoo();
39644 test_ret += test_xmlUCSIsHebrew();
39645 test_ret += test_xmlUCSIsHighPrivateUseSurrogates();
39646 test_ret += test_xmlUCSIsHighSurrogates();
39647 test_ret += test_xmlUCSIsHiragana();
39648 test_ret += test_xmlUCSIsIPAExtensions();
39649 test_ret += test_xmlUCSIsIdeographicDescriptionCharacters();
39650 test_ret += test_xmlUCSIsKanbun();
39651 test_ret += test_xmlUCSIsKangxiRadicals();
39652 test_ret += test_xmlUCSIsKannada();
39653 test_ret += test_xmlUCSIsKatakana();
39654 test_ret += test_xmlUCSIsKatakanaPhoneticExtensions();
39655 test_ret += test_xmlUCSIsKhmer();
39656 test_ret += test_xmlUCSIsKhmerSymbols();
39657 test_ret += test_xmlUCSIsLao();
39658 test_ret += test_xmlUCSIsLatin1Supplement();
39659 test_ret += test_xmlUCSIsLatinExtendedA();
39660 test_ret += test_xmlUCSIsLatinExtendedAdditional();
39661 test_ret += test_xmlUCSIsLatinExtendedB();
39662 test_ret += test_xmlUCSIsLetterlikeSymbols();
39663 test_ret += test_xmlUCSIsLimbu();
39664 test_ret += test_xmlUCSIsLinearBIdeograms();
39665 test_ret += test_xmlUCSIsLinearBSyllabary();
39666 test_ret += test_xmlUCSIsLowSurrogates();
39667 test_ret += test_xmlUCSIsMalayalam();
39668 test_ret += test_xmlUCSIsMathematicalAlphanumericSymbols();
39669 test_ret += test_xmlUCSIsMathematicalOperators();
39670 test_ret += test_xmlUCSIsMiscellaneousMathematicalSymbolsA();
39671 test_ret += test_xmlUCSIsMiscellaneousMathematicalSymbolsB();
39672 test_ret += test_xmlUCSIsMiscellaneousSymbols();
39673 test_ret += test_xmlUCSIsMiscellaneousSymbolsandArrows();
39674 test_ret += test_xmlUCSIsMiscellaneousTechnical();
39675 test_ret += test_xmlUCSIsMongolian();
39676 test_ret += test_xmlUCSIsMusicalSymbols();
39677 test_ret += test_xmlUCSIsMyanmar();
39678 test_ret += test_xmlUCSIsNumberForms();
39679 test_ret += test_xmlUCSIsOgham();
39680 test_ret += test_xmlUCSIsOldItalic();
39681 test_ret += test_xmlUCSIsOpticalCharacterRecognition();
39682 test_ret += test_xmlUCSIsOriya();
39683 test_ret += test_xmlUCSIsOsmanya();
39684 test_ret += test_xmlUCSIsPhoneticExtensions();
39685 test_ret += test_xmlUCSIsPrivateUse();
39686 test_ret += test_xmlUCSIsPrivateUseArea();
39687 test_ret += test_xmlUCSIsRunic();
39688 test_ret += test_xmlUCSIsShavian();
39689 test_ret += test_xmlUCSIsSinhala();
39690 test_ret += test_xmlUCSIsSmallFormVariants();
39691 test_ret += test_xmlUCSIsSpacingModifierLetters();
39692 test_ret += test_xmlUCSIsSpecials();
39693 test_ret += test_xmlUCSIsSuperscriptsandSubscripts();
39694 test_ret += test_xmlUCSIsSupplementalArrowsA();
39695 test_ret += test_xmlUCSIsSupplementalArrowsB();
39696 test_ret += test_xmlUCSIsSupplementalMathematicalOperators();
39697 test_ret += test_xmlUCSIsSupplementaryPrivateUseAreaA();
39698 test_ret += test_xmlUCSIsSupplementaryPrivateUseAreaB();
39699 test_ret += test_xmlUCSIsSyriac();
39700 test_ret += test_xmlUCSIsTagalog();
39701 test_ret += test_xmlUCSIsTagbanwa();
39702 test_ret += test_xmlUCSIsTags();
39703 test_ret += test_xmlUCSIsTaiLe();
39704 test_ret += test_xmlUCSIsTaiXuanJingSymbols();
39705 test_ret += test_xmlUCSIsTamil();
39706 test_ret += test_xmlUCSIsTelugu();
39707 test_ret += test_xmlUCSIsThaana();
39708 test_ret += test_xmlUCSIsThai();
39709 test_ret += test_xmlUCSIsTibetan();
39710 test_ret += test_xmlUCSIsUgaritic();
39711 test_ret += test_xmlUCSIsUnifiedCanadianAboriginalSyllabics();
39712 test_ret += test_xmlUCSIsVariationSelectors();
39713 test_ret += test_xmlUCSIsVariationSelectorsSupplement();
39714 test_ret += test_xmlUCSIsYiRadicals();
39715 test_ret += test_xmlUCSIsYiSyllables();
39716 test_ret += test_xmlUCSIsYijingHexagramSymbols();
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039717
Daniel Veillard42595322004-11-08 10:52:06 +000039718 if (test_ret != 0)
39719 printf("Module xmlunicode: %d errors\n", test_ret);
39720 return(test_ret);
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000039721}
39722
39723static int
Daniel Veillardd93f6252004-11-02 15:53:51 +000039724test_xmlNewTextWriter(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039725 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039726
William M. Brack21e4ef22005-01-02 09:53:13 +000039727#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039728 int mem_base;
39729 xmlTextWriterPtr ret_val;
39730 xmlOutputBufferPtr out; /* an xmlOutputBufferPtr */
39731 int n_out;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039732
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039733 for (n_out = 0;n_out < gen_nb_xmlOutputBufferPtr;n_out++) {
39734 mem_base = xmlMemBlocks();
39735 out = gen_xmlOutputBufferPtr(n_out, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039736
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039737 ret_val = xmlNewTextWriter(out);
39738 if (ret_val != NULL) out = NULL;
39739 desret_xmlTextWriterPtr(ret_val);
39740 call_tests++;
39741 des_xmlOutputBufferPtr(n_out, out, 0);
39742 xmlResetLastError();
39743 if (mem_base != xmlMemBlocks()) {
39744 printf("Leak of %d blocks found in xmlNewTextWriter",
39745 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039746 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039747 printf(" %d", n_out);
39748 printf("\n");
39749 }
39750 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039751 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039752#endif
Daniel Veillardd93f6252004-11-02 15:53:51 +000039753
Daniel Veillard42595322004-11-08 10:52:06 +000039754 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039755}
39756
39757
39758static int
39759test_xmlNewTextWriterFilename(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039760 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039761
William M. Brack21e4ef22005-01-02 09:53:13 +000039762#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039763 int mem_base;
39764 xmlTextWriterPtr ret_val;
39765 const char * uri; /* the URI of the resource for the output */
39766 int n_uri;
39767 int compression; /* compress the output? */
39768 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039769
Daniel Veillard42595322004-11-08 10:52:06 +000039770 for (n_uri = 0;n_uri < gen_nb_fileoutput;n_uri++) {
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039771 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
39772 mem_base = xmlMemBlocks();
Daniel Veillard42595322004-11-08 10:52:06 +000039773 uri = gen_fileoutput(n_uri, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039774 compression = gen_int(n_compression, 1);
39775
39776 ret_val = xmlNewTextWriterFilename(uri, compression);
39777 desret_xmlTextWriterPtr(ret_val);
39778 call_tests++;
Daniel Veillard42595322004-11-08 10:52:06 +000039779 des_fileoutput(n_uri, uri, 0);
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039780 des_int(n_compression, compression, 1);
39781 xmlResetLastError();
39782 if (mem_base != xmlMemBlocks()) {
39783 printf("Leak of %d blocks found in xmlNewTextWriterFilename",
39784 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039785 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039786 printf(" %d", n_uri);
39787 printf(" %d", n_compression);
39788 printf("\n");
39789 }
39790 }
39791 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039792 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039793#endif
39794
Daniel Veillard42595322004-11-08 10:52:06 +000039795 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039796}
39797
39798
39799static int
39800test_xmlNewTextWriterMemory(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039801 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039802
William M. Brack21e4ef22005-01-02 09:53:13 +000039803#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039804 int mem_base;
39805 xmlTextWriterPtr ret_val;
39806 xmlBufferPtr buf; /* xmlBufferPtr */
39807 int n_buf;
39808 int compression; /* compress the output? */
39809 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039810
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039811 for (n_buf = 0;n_buf < gen_nb_xmlBufferPtr;n_buf++) {
39812 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
39813 mem_base = xmlMemBlocks();
39814 buf = gen_xmlBufferPtr(n_buf, 0);
39815 compression = gen_int(n_compression, 1);
39816
39817 ret_val = xmlNewTextWriterMemory(buf, compression);
39818 desret_xmlTextWriterPtr(ret_val);
39819 call_tests++;
39820 des_xmlBufferPtr(n_buf, buf, 0);
39821 des_int(n_compression, compression, 1);
39822 xmlResetLastError();
39823 if (mem_base != xmlMemBlocks()) {
39824 printf("Leak of %d blocks found in xmlNewTextWriterMemory",
39825 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039826 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039827 printf(" %d", n_buf);
39828 printf(" %d", n_compression);
39829 printf("\n");
39830 }
39831 }
39832 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039833 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039834#endif
39835
Daniel Veillard42595322004-11-08 10:52:06 +000039836 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039837}
39838
39839
39840static int
39841test_xmlNewTextWriterPushParser(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039842 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039843
William M. Brack21e4ef22005-01-02 09:53:13 +000039844#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039845 int mem_base;
39846 xmlTextWriterPtr ret_val;
39847 xmlParserCtxtPtr ctxt; /* xmlParserCtxtPtr to hold the new XML document tree */
39848 int n_ctxt;
39849 int compression; /* compress the output? */
39850 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039851
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039852 for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) {
39853 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
39854 mem_base = xmlMemBlocks();
39855 ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0);
39856 compression = gen_int(n_compression, 1);
39857
39858 ret_val = xmlNewTextWriterPushParser(ctxt, compression);
Daniel Veillarda521d282004-11-09 14:59:59 +000039859 if (ctxt != NULL) {xmlFreeDoc(ctxt->myDoc); ctxt->myDoc = NULL;} if (ret_val != NULL) ctxt = NULL;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039860 desret_xmlTextWriterPtr(ret_val);
39861 call_tests++;
39862 des_xmlParserCtxtPtr(n_ctxt, ctxt, 0);
39863 des_int(n_compression, compression, 1);
39864 xmlResetLastError();
39865 if (mem_base != xmlMemBlocks()) {
39866 printf("Leak of %d blocks found in xmlNewTextWriterPushParser",
39867 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039868 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039869 printf(" %d", n_ctxt);
39870 printf(" %d", n_compression);
39871 printf("\n");
39872 }
39873 }
39874 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039875 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039876#endif
39877
Daniel Veillard42595322004-11-08 10:52:06 +000039878 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039879}
39880
39881
39882static int
39883test_xmlNewTextWriterTree(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039884 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039885
William M. Brack21e4ef22005-01-02 09:53:13 +000039886#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039887 int mem_base;
39888 xmlTextWriterPtr ret_val;
39889 xmlDocPtr doc; /* xmlDocPtr */
39890 int n_doc;
39891 xmlNodePtr node; /* xmlNodePtr or NULL for doc->children */
39892 int n_node;
39893 int compression; /* compress the output? */
39894 int n_compression;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039895
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039896 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
39897 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
39898 for (n_compression = 0;n_compression < gen_nb_int;n_compression++) {
39899 mem_base = xmlMemBlocks();
39900 doc = gen_xmlDocPtr(n_doc, 0);
39901 node = gen_xmlNodePtr(n_node, 1);
39902 compression = gen_int(n_compression, 2);
39903
39904 ret_val = xmlNewTextWriterTree(doc, node, compression);
39905 desret_xmlTextWriterPtr(ret_val);
39906 call_tests++;
39907 des_xmlDocPtr(n_doc, doc, 0);
39908 des_xmlNodePtr(n_node, node, 1);
39909 des_int(n_compression, compression, 2);
39910 xmlResetLastError();
39911 if (mem_base != xmlMemBlocks()) {
39912 printf("Leak of %d blocks found in xmlNewTextWriterTree",
39913 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039914 test_ret++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039915 printf(" %d", n_doc);
39916 printf(" %d", n_node);
39917 printf(" %d", n_compression);
39918 printf("\n");
39919 }
39920 }
39921 }
39922 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039923 function_tests++;
Daniel Veillardd5cc0f72004-11-06 19:24:28 +000039924#endif
39925
Daniel Veillard42595322004-11-08 10:52:06 +000039926 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039927}
39928
39929
39930static int
39931test_xmlTextWriterEndAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039932 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039933
William M. Brack21e4ef22005-01-02 09:53:13 +000039934#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000039935 int mem_base;
39936 int ret_val;
39937 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
39938 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039939
Daniel Veillarde43cc572004-11-03 11:50:29 +000039940 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
39941 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000039942 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000039943
39944 ret_val = xmlTextWriterEndAttribute(writer);
39945 desret_int(ret_val);
39946 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000039947 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000039948 xmlResetLastError();
39949 if (mem_base != xmlMemBlocks()) {
39950 printf("Leak of %d blocks found in xmlTextWriterEndAttribute",
39951 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039952 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000039953 printf(" %d", n_writer);
39954 printf("\n");
39955 }
39956 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039957 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000039958#endif
39959
Daniel Veillard42595322004-11-08 10:52:06 +000039960 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039961}
39962
39963
39964static int
39965test_xmlTextWriterEndCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000039966 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039967
William M. Brack21e4ef22005-01-02 09:53:13 +000039968#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000039969 int mem_base;
39970 int ret_val;
39971 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
39972 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000039973
Daniel Veillarde43cc572004-11-03 11:50:29 +000039974 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
39975 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000039976 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000039977
39978 ret_val = xmlTextWriterEndCDATA(writer);
39979 desret_int(ret_val);
39980 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000039981 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000039982 xmlResetLastError();
39983 if (mem_base != xmlMemBlocks()) {
39984 printf("Leak of %d blocks found in xmlTextWriterEndCDATA",
39985 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000039986 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000039987 printf(" %d", n_writer);
39988 printf("\n");
39989 }
39990 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000039991 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000039992#endif
39993
Daniel Veillard42595322004-11-08 10:52:06 +000039994 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000039995}
39996
39997
39998static int
39999test_xmlTextWriterEndComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040000 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040001
William M. Brack21e4ef22005-01-02 09:53:13 +000040002#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040003 int mem_base;
40004 int ret_val;
40005 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40006 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040007
Daniel Veillarde43cc572004-11-03 11:50:29 +000040008 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40009 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040010 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040011
40012 ret_val = xmlTextWriterEndComment(writer);
40013 desret_int(ret_val);
40014 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040015 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040016 xmlResetLastError();
40017 if (mem_base != xmlMemBlocks()) {
40018 printf("Leak of %d blocks found in xmlTextWriterEndComment",
40019 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040020 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040021 printf(" %d", n_writer);
40022 printf("\n");
40023 }
40024 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040025 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040026#endif
40027
Daniel Veillard42595322004-11-08 10:52:06 +000040028 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040029}
40030
40031
40032static int
40033test_xmlTextWriterEndDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040034 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040035
William M. Brack21e4ef22005-01-02 09:53:13 +000040036#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040037 int mem_base;
40038 int ret_val;
40039 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40040 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040041
Daniel Veillarde43cc572004-11-03 11:50:29 +000040042 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40043 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040044 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040045
40046 ret_val = xmlTextWriterEndDTD(writer);
40047 desret_int(ret_val);
40048 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040049 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040050 xmlResetLastError();
40051 if (mem_base != xmlMemBlocks()) {
40052 printf("Leak of %d blocks found in xmlTextWriterEndDTD",
40053 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040054 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040055 printf(" %d", n_writer);
40056 printf("\n");
40057 }
40058 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040059 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040060#endif
40061
Daniel Veillard42595322004-11-08 10:52:06 +000040062 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040063}
40064
40065
40066static int
40067test_xmlTextWriterEndDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040068 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040069
William M. Brack21e4ef22005-01-02 09:53:13 +000040070#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040071 int mem_base;
40072 int ret_val;
40073 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40074 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040075
Daniel Veillarde43cc572004-11-03 11:50:29 +000040076 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40077 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040078 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040079
40080 ret_val = xmlTextWriterEndDTDAttlist(writer);
40081 desret_int(ret_val);
40082 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040083 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040084 xmlResetLastError();
40085 if (mem_base != xmlMemBlocks()) {
40086 printf("Leak of %d blocks found in xmlTextWriterEndDTDAttlist",
40087 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040088 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040089 printf(" %d", n_writer);
40090 printf("\n");
40091 }
40092 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040093 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040094#endif
40095
Daniel Veillard42595322004-11-08 10:52:06 +000040096 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040097}
40098
40099
40100static int
40101test_xmlTextWriterEndDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040102 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040103
William M. Brack21e4ef22005-01-02 09:53:13 +000040104#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040105 int mem_base;
40106 int ret_val;
40107 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40108 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040109
Daniel Veillarde43cc572004-11-03 11:50:29 +000040110 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40111 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040112 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040113
40114 ret_val = xmlTextWriterEndDTDElement(writer);
40115 desret_int(ret_val);
40116 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040117 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040118 xmlResetLastError();
40119 if (mem_base != xmlMemBlocks()) {
40120 printf("Leak of %d blocks found in xmlTextWriterEndDTDElement",
40121 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040122 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040123 printf(" %d", n_writer);
40124 printf("\n");
40125 }
40126 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040127 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040128#endif
40129
Daniel Veillard42595322004-11-08 10:52:06 +000040130 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040131}
40132
40133
40134static int
40135test_xmlTextWriterEndDTDEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040136 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040137
William M. Brack21e4ef22005-01-02 09:53:13 +000040138#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040139 int mem_base;
40140 int ret_val;
40141 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40142 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040143
Daniel Veillarde43cc572004-11-03 11:50:29 +000040144 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40145 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040146 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040147
40148 ret_val = xmlTextWriterEndDTDEntity(writer);
40149 desret_int(ret_val);
40150 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040151 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040152 xmlResetLastError();
40153 if (mem_base != xmlMemBlocks()) {
40154 printf("Leak of %d blocks found in xmlTextWriterEndDTDEntity",
40155 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040156 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040157 printf(" %d", n_writer);
40158 printf("\n");
40159 }
40160 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040161 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040162#endif
40163
Daniel Veillard42595322004-11-08 10:52:06 +000040164 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040165}
40166
40167
40168static int
40169test_xmlTextWriterEndDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040170 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040171
William M. Brack21e4ef22005-01-02 09:53:13 +000040172#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040173 int mem_base;
40174 int ret_val;
40175 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40176 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040177
Daniel Veillarde43cc572004-11-03 11:50:29 +000040178 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40179 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040180 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040181
40182 ret_val = xmlTextWriterEndDocument(writer);
40183 desret_int(ret_val);
40184 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040185 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040186 xmlResetLastError();
40187 if (mem_base != xmlMemBlocks()) {
40188 printf("Leak of %d blocks found in xmlTextWriterEndDocument",
40189 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040190 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040191 printf(" %d", n_writer);
40192 printf("\n");
40193 }
40194 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040195 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040196#endif
40197
Daniel Veillard42595322004-11-08 10:52:06 +000040198 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040199}
40200
40201
40202static int
40203test_xmlTextWriterEndElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040204 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040205
William M. Brack21e4ef22005-01-02 09:53:13 +000040206#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040207 int mem_base;
40208 int ret_val;
40209 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40210 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040211
Daniel Veillarde43cc572004-11-03 11:50:29 +000040212 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40213 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040214 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040215
40216 ret_val = xmlTextWriterEndElement(writer);
40217 desret_int(ret_val);
40218 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040219 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040220 xmlResetLastError();
40221 if (mem_base != xmlMemBlocks()) {
40222 printf("Leak of %d blocks found in xmlTextWriterEndElement",
40223 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040224 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040225 printf(" %d", n_writer);
40226 printf("\n");
40227 }
40228 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040229 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040230#endif
40231
Daniel Veillard42595322004-11-08 10:52:06 +000040232 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040233}
40234
40235
40236static int
40237test_xmlTextWriterEndPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040238 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040239
William M. Brack21e4ef22005-01-02 09:53:13 +000040240#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040241 int mem_base;
40242 int ret_val;
40243 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40244 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040245
Daniel Veillarde43cc572004-11-03 11:50:29 +000040246 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40247 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040248 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040249
40250 ret_val = xmlTextWriterEndPI(writer);
40251 desret_int(ret_val);
40252 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040253 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040254 xmlResetLastError();
40255 if (mem_base != xmlMemBlocks()) {
40256 printf("Leak of %d blocks found in xmlTextWriterEndPI",
40257 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040258 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040259 printf(" %d", n_writer);
40260 printf("\n");
40261 }
40262 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040263 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040264#endif
40265
Daniel Veillard42595322004-11-08 10:52:06 +000040266 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040267}
40268
40269
40270static int
40271test_xmlTextWriterFlush(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040272 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040273
William M. Brack21e4ef22005-01-02 09:53:13 +000040274#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040275 int mem_base;
40276 int ret_val;
40277 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40278 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040279
Daniel Veillarde43cc572004-11-03 11:50:29 +000040280 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40281 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040282 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040283
40284 ret_val = xmlTextWriterFlush(writer);
40285 desret_int(ret_val);
40286 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040287 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040288 xmlResetLastError();
40289 if (mem_base != xmlMemBlocks()) {
40290 printf("Leak of %d blocks found in xmlTextWriterFlush",
40291 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040292 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040293 printf(" %d", n_writer);
40294 printf("\n");
40295 }
40296 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040297 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040298#endif
40299
Daniel Veillard42595322004-11-08 10:52:06 +000040300 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040301}
40302
40303
40304static int
40305test_xmlTextWriterFullEndElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040306 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040307
William M. Brack21e4ef22005-01-02 09:53:13 +000040308#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040309 int mem_base;
40310 int ret_val;
40311 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40312 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040313
Daniel Veillarde43cc572004-11-03 11:50:29 +000040314 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40315 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040316 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040317
40318 ret_val = xmlTextWriterFullEndElement(writer);
40319 desret_int(ret_val);
40320 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040321 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040322 xmlResetLastError();
40323 if (mem_base != xmlMemBlocks()) {
40324 printf("Leak of %d blocks found in xmlTextWriterFullEndElement",
40325 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040326 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040327 printf(" %d", n_writer);
40328 printf("\n");
40329 }
40330 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040331 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040332#endif
40333
Daniel Veillard42595322004-11-08 10:52:06 +000040334 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040335}
40336
40337
40338static int
40339test_xmlTextWriterSetIndent(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040340 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040341
William M. Brack21e4ef22005-01-02 09:53:13 +000040342#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040343 int mem_base;
40344 int ret_val;
40345 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40346 int n_writer;
40347 int indent; /* do indentation? */
40348 int n_indent;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040349
Daniel Veillarde43cc572004-11-03 11:50:29 +000040350 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40351 for (n_indent = 0;n_indent < gen_nb_int;n_indent++) {
40352 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040353 writer = gen_xmlTextWriterPtr(n_writer, 0);
40354 indent = gen_int(n_indent, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040355
40356 ret_val = xmlTextWriterSetIndent(writer, indent);
40357 desret_int(ret_val);
40358 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040359 des_xmlTextWriterPtr(n_writer, writer, 0);
40360 des_int(n_indent, indent, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040361 xmlResetLastError();
40362 if (mem_base != xmlMemBlocks()) {
40363 printf("Leak of %d blocks found in xmlTextWriterSetIndent",
40364 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040365 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040366 printf(" %d", n_writer);
40367 printf(" %d", n_indent);
40368 printf("\n");
40369 }
40370 }
40371 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040372 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040373#endif
40374
Daniel Veillard42595322004-11-08 10:52:06 +000040375 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040376}
40377
40378
40379static int
40380test_xmlTextWriterSetIndentString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040381 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040382
William M. Brack21e4ef22005-01-02 09:53:13 +000040383#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040384 int mem_base;
40385 int ret_val;
40386 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40387 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040388 xmlChar * str; /* the xmlChar string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040389 int n_str;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040390
Daniel Veillarde43cc572004-11-03 11:50:29 +000040391 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40392 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
40393 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040394 writer = gen_xmlTextWriterPtr(n_writer, 0);
40395 str = gen_const_xmlChar_ptr(n_str, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040396
William M. Brackf13f77f2004-11-12 16:03:48 +000040397 ret_val = xmlTextWriterSetIndentString(writer, (const xmlChar *)str);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040398 desret_int(ret_val);
40399 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040400 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000040401 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040402 xmlResetLastError();
40403 if (mem_base != xmlMemBlocks()) {
40404 printf("Leak of %d blocks found in xmlTextWriterSetIndentString",
40405 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040406 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040407 printf(" %d", n_writer);
40408 printf(" %d", n_str);
40409 printf("\n");
40410 }
40411 }
40412 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040413 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040414#endif
40415
Daniel Veillard42595322004-11-08 10:52:06 +000040416 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040417}
40418
40419
40420static int
40421test_xmlTextWriterStartAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040422 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040423
William M. Brack21e4ef22005-01-02 09:53:13 +000040424#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040425 int mem_base;
40426 int ret_val;
40427 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40428 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040429 xmlChar * name; /* element name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040430 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040431
Daniel Veillarde43cc572004-11-03 11:50:29 +000040432 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40433 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40434 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040435 writer = gen_xmlTextWriterPtr(n_writer, 0);
40436 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040437
William M. Brackf13f77f2004-11-12 16:03:48 +000040438 ret_val = xmlTextWriterStartAttribute(writer, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040439 desret_int(ret_val);
40440 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040441 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000040442 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040443 xmlResetLastError();
40444 if (mem_base != xmlMemBlocks()) {
40445 printf("Leak of %d blocks found in xmlTextWriterStartAttribute",
40446 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040447 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040448 printf(" %d", n_writer);
40449 printf(" %d", n_name);
40450 printf("\n");
40451 }
40452 }
40453 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040454 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040455#endif
40456
Daniel Veillard42595322004-11-08 10:52:06 +000040457 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040458}
40459
40460
40461static int
40462test_xmlTextWriterStartAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040463 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040464
William M. Brack21e4ef22005-01-02 09:53:13 +000040465#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040466 int mem_base;
40467 int ret_val;
40468 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40469 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040470 xmlChar * prefix; /* namespace prefix or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040471 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040472 xmlChar * name; /* element local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040473 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040474 xmlChar * namespaceURI; /* namespace URI or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040475 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040476
Daniel Veillarde43cc572004-11-03 11:50:29 +000040477 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40478 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
40479 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40480 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
40481 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040482 writer = gen_xmlTextWriterPtr(n_writer, 0);
40483 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
40484 name = gen_const_xmlChar_ptr(n_name, 2);
40485 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040486
William M. Brackf13f77f2004-11-12 16:03:48 +000040487 ret_val = xmlTextWriterStartAttributeNS(writer, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)namespaceURI);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040488 desret_int(ret_val);
40489 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040490 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000040491 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
40492 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
40493 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040494 xmlResetLastError();
40495 if (mem_base != xmlMemBlocks()) {
40496 printf("Leak of %d blocks found in xmlTextWriterStartAttributeNS",
40497 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040498 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040499 printf(" %d", n_writer);
40500 printf(" %d", n_prefix);
40501 printf(" %d", n_name);
40502 printf(" %d", n_namespaceURI);
40503 printf("\n");
40504 }
40505 }
40506 }
40507 }
40508 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040509 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040510#endif
40511
Daniel Veillard42595322004-11-08 10:52:06 +000040512 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040513}
40514
40515
40516static int
40517test_xmlTextWriterStartCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040518 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040519
William M. Brack21e4ef22005-01-02 09:53:13 +000040520#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040521 int mem_base;
40522 int ret_val;
40523 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40524 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040525
Daniel Veillarde43cc572004-11-03 11:50:29 +000040526 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40527 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040528 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040529
40530 ret_val = xmlTextWriterStartCDATA(writer);
40531 desret_int(ret_val);
40532 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040533 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040534 xmlResetLastError();
40535 if (mem_base != xmlMemBlocks()) {
40536 printf("Leak of %d blocks found in xmlTextWriterStartCDATA",
40537 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040538 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040539 printf(" %d", n_writer);
40540 printf("\n");
40541 }
40542 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040543 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040544#endif
40545
Daniel Veillard42595322004-11-08 10:52:06 +000040546 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040547}
40548
40549
40550static int
40551test_xmlTextWriterStartComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040552 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040553
William M. Brack21e4ef22005-01-02 09:53:13 +000040554#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040555 int mem_base;
40556 int ret_val;
40557 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40558 int n_writer;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040559
Daniel Veillarde43cc572004-11-03 11:50:29 +000040560 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40561 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040562 writer = gen_xmlTextWriterPtr(n_writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040563
40564 ret_val = xmlTextWriterStartComment(writer);
40565 desret_int(ret_val);
40566 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040567 des_xmlTextWriterPtr(n_writer, writer, 0);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040568 xmlResetLastError();
40569 if (mem_base != xmlMemBlocks()) {
40570 printf("Leak of %d blocks found in xmlTextWriterStartComment",
40571 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040572 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040573 printf(" %d", n_writer);
40574 printf("\n");
40575 }
40576 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040577 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040578#endif
40579
Daniel Veillard42595322004-11-08 10:52:06 +000040580 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040581}
40582
40583
40584static int
40585test_xmlTextWriterStartDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040586 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040587
William M. Brack21e4ef22005-01-02 09:53:13 +000040588#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040589 int mem_base;
40590 int ret_val;
40591 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40592 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040593 xmlChar * name; /* the name of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040594 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040595 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040596 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040597 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040598 int n_sysid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040599
Daniel Veillarde43cc572004-11-03 11:50:29 +000040600 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40601 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40602 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
40603 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
40604 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040605 writer = gen_xmlTextWriterPtr(n_writer, 0);
40606 name = gen_const_xmlChar_ptr(n_name, 1);
40607 pubid = gen_const_xmlChar_ptr(n_pubid, 2);
40608 sysid = gen_const_xmlChar_ptr(n_sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040609
William M. Brackf13f77f2004-11-12 16:03:48 +000040610 ret_val = xmlTextWriterStartDTD(writer, (const xmlChar *)name, (const xmlChar *)pubid, (const xmlChar *)sysid);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040611 desret_int(ret_val);
40612 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040613 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000040614 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
40615 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 2);
40616 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040617 xmlResetLastError();
40618 if (mem_base != xmlMemBlocks()) {
40619 printf("Leak of %d blocks found in xmlTextWriterStartDTD",
40620 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040621 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040622 printf(" %d", n_writer);
40623 printf(" %d", n_name);
40624 printf(" %d", n_pubid);
40625 printf(" %d", n_sysid);
40626 printf("\n");
40627 }
40628 }
40629 }
40630 }
40631 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040632 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040633#endif
40634
Daniel Veillard42595322004-11-08 10:52:06 +000040635 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040636}
40637
40638
40639static int
40640test_xmlTextWriterStartDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040641 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040642
William M. Brack21e4ef22005-01-02 09:53:13 +000040643#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040644 int mem_base;
40645 int ret_val;
40646 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40647 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040648 xmlChar * name; /* the name of the DTD ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040649 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040650
Daniel Veillarde43cc572004-11-03 11:50:29 +000040651 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40652 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40653 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040654 writer = gen_xmlTextWriterPtr(n_writer, 0);
40655 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040656
William M. Brackf13f77f2004-11-12 16:03:48 +000040657 ret_val = xmlTextWriterStartDTDAttlist(writer, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040658 desret_int(ret_val);
40659 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040660 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000040661 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040662 xmlResetLastError();
40663 if (mem_base != xmlMemBlocks()) {
40664 printf("Leak of %d blocks found in xmlTextWriterStartDTDAttlist",
40665 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040666 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040667 printf(" %d", n_writer);
40668 printf(" %d", n_name);
40669 printf("\n");
40670 }
40671 }
40672 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040673 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040674#endif
40675
Daniel Veillard42595322004-11-08 10:52:06 +000040676 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040677}
40678
40679
40680static int
40681test_xmlTextWriterStartDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040682 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040683
William M. Brack21e4ef22005-01-02 09:53:13 +000040684#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040685 int mem_base;
40686 int ret_val;
40687 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40688 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040689 xmlChar * name; /* the name of the DTD element */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040690 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040691
Daniel Veillarde43cc572004-11-03 11:50:29 +000040692 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40693 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40694 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040695 writer = gen_xmlTextWriterPtr(n_writer, 0);
40696 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040697
William M. Brackf13f77f2004-11-12 16:03:48 +000040698 ret_val = xmlTextWriterStartDTDElement(writer, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040699 desret_int(ret_val);
40700 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040701 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000040702 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040703 xmlResetLastError();
40704 if (mem_base != xmlMemBlocks()) {
40705 printf("Leak of %d blocks found in xmlTextWriterStartDTDElement",
40706 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040707 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040708 printf(" %d", n_writer);
40709 printf(" %d", n_name);
40710 printf("\n");
40711 }
40712 }
40713 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040714 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040715#endif
40716
Daniel Veillard42595322004-11-08 10:52:06 +000040717 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040718}
40719
40720
40721static int
40722test_xmlTextWriterStartDTDEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040723 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040724
William M. Brack21e4ef22005-01-02 09:53:13 +000040725#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040726 int mem_base;
40727 int ret_val;
40728 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40729 int n_writer;
40730 int pe; /* TRUE if this is a parameter entity, FALSE if not */
40731 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040732 xmlChar * name; /* the name of the DTD ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040733 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040734
Daniel Veillarde43cc572004-11-03 11:50:29 +000040735 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40736 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
40737 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40738 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040739 writer = gen_xmlTextWriterPtr(n_writer, 0);
40740 pe = gen_int(n_pe, 1);
40741 name = gen_const_xmlChar_ptr(n_name, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040742
William M. Brackf13f77f2004-11-12 16:03:48 +000040743 ret_val = xmlTextWriterStartDTDEntity(writer, pe, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040744 desret_int(ret_val);
40745 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040746 des_xmlTextWriterPtr(n_writer, writer, 0);
40747 des_int(n_pe, pe, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000040748 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040749 xmlResetLastError();
40750 if (mem_base != xmlMemBlocks()) {
40751 printf("Leak of %d blocks found in xmlTextWriterStartDTDEntity",
40752 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040753 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040754 printf(" %d", n_writer);
40755 printf(" %d", n_pe);
40756 printf(" %d", n_name);
40757 printf("\n");
40758 }
40759 }
40760 }
40761 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040762 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040763#endif
40764
Daniel Veillard42595322004-11-08 10:52:06 +000040765 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040766}
40767
40768
40769static int
40770test_xmlTextWriterStartDocument(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040771 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040772
William M. Brack21e4ef22005-01-02 09:53:13 +000040773#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040774 int mem_base;
40775 int ret_val;
40776 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40777 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040778 char * version; /* the xml version ("1.0") or NULL for default ("1.0") */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040779 int n_version;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040780 char * encoding; /* the encoding or NULL for default */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040781 int n_encoding;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040782 char * standalone; /* "yes" or "no" or NULL for default */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040783 int n_standalone;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040784
Daniel Veillarde43cc572004-11-03 11:50:29 +000040785 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40786 for (n_version = 0;n_version < gen_nb_const_char_ptr;n_version++) {
40787 for (n_encoding = 0;n_encoding < gen_nb_const_char_ptr;n_encoding++) {
40788 for (n_standalone = 0;n_standalone < gen_nb_const_char_ptr;n_standalone++) {
40789 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040790 writer = gen_xmlTextWriterPtr(n_writer, 0);
40791 version = gen_const_char_ptr(n_version, 1);
40792 encoding = gen_const_char_ptr(n_encoding, 2);
40793 standalone = gen_const_char_ptr(n_standalone, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040794
William M. Brackf13f77f2004-11-12 16:03:48 +000040795 ret_val = xmlTextWriterStartDocument(writer, (const char *)version, (const char *)encoding, (const char *)standalone);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040796 desret_int(ret_val);
40797 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040798 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000040799 des_const_char_ptr(n_version, (const char *)version, 1);
40800 des_const_char_ptr(n_encoding, (const char *)encoding, 2);
40801 des_const_char_ptr(n_standalone, (const char *)standalone, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040802 xmlResetLastError();
40803 if (mem_base != xmlMemBlocks()) {
40804 printf("Leak of %d blocks found in xmlTextWriterStartDocument",
40805 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040806 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040807 printf(" %d", n_writer);
40808 printf(" %d", n_version);
40809 printf(" %d", n_encoding);
40810 printf(" %d", n_standalone);
40811 printf("\n");
40812 }
40813 }
40814 }
40815 }
40816 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040817 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040818#endif
40819
Daniel Veillard42595322004-11-08 10:52:06 +000040820 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040821}
40822
40823
40824static int
40825test_xmlTextWriterStartElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040826 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040827
William M. Brack21e4ef22005-01-02 09:53:13 +000040828#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040829 int mem_base;
40830 int ret_val;
40831 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40832 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040833 xmlChar * name; /* element name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040834 int n_name;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040835
Daniel Veillarde43cc572004-11-03 11:50:29 +000040836 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40837 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40838 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040839 writer = gen_xmlTextWriterPtr(n_writer, 0);
40840 name = gen_const_xmlChar_ptr(n_name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040841
William M. Brackf13f77f2004-11-12 16:03:48 +000040842 ret_val = xmlTextWriterStartElement(writer, (const xmlChar *)name);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040843 desret_int(ret_val);
40844 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040845 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000040846 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040847 xmlResetLastError();
40848 if (mem_base != xmlMemBlocks()) {
40849 printf("Leak of %d blocks found in xmlTextWriterStartElement",
40850 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040851 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040852 printf(" %d", n_writer);
40853 printf(" %d", n_name);
40854 printf("\n");
40855 }
40856 }
40857 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040858 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040859#endif
40860
Daniel Veillard42595322004-11-08 10:52:06 +000040861 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040862}
40863
40864
40865static int
40866test_xmlTextWriterStartElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040867 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040868
William M. Brack21e4ef22005-01-02 09:53:13 +000040869#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040870 int mem_base;
40871 int ret_val;
40872 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40873 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040874 xmlChar * prefix; /* namespace prefix or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040875 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040876 xmlChar * name; /* element local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040877 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040878 xmlChar * namespaceURI; /* namespace URI or NULL */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040879 int n_namespaceURI;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040880
Daniel Veillarde43cc572004-11-03 11:50:29 +000040881 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40882 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
40883 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40884 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
40885 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040886 writer = gen_xmlTextWriterPtr(n_writer, 0);
40887 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
40888 name = gen_const_xmlChar_ptr(n_name, 2);
40889 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040890
William M. Brackf13f77f2004-11-12 16:03:48 +000040891 ret_val = xmlTextWriterStartElementNS(writer, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)namespaceURI);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040892 desret_int(ret_val);
40893 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040894 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000040895 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
40896 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
40897 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040898 xmlResetLastError();
40899 if (mem_base != xmlMemBlocks()) {
40900 printf("Leak of %d blocks found in xmlTextWriterStartElementNS",
40901 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040902 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040903 printf(" %d", n_writer);
40904 printf(" %d", n_prefix);
40905 printf(" %d", n_name);
40906 printf(" %d", n_namespaceURI);
40907 printf("\n");
40908 }
40909 }
40910 }
40911 }
40912 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040913 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040914#endif
40915
Daniel Veillard42595322004-11-08 10:52:06 +000040916 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040917}
40918
40919
40920static int
40921test_xmlTextWriterStartPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040922 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040923
William M. Brack21e4ef22005-01-02 09:53:13 +000040924#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040925 int mem_base;
40926 int ret_val;
40927 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40928 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040929 xmlChar * target; /* PI target */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040930 int n_target;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040931
Daniel Veillarde43cc572004-11-03 11:50:29 +000040932 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40933 for (n_target = 0;n_target < gen_nb_const_xmlChar_ptr;n_target++) {
40934 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040935 writer = gen_xmlTextWriterPtr(n_writer, 0);
40936 target = gen_const_xmlChar_ptr(n_target, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040937
William M. Brackf13f77f2004-11-12 16:03:48 +000040938 ret_val = xmlTextWriterStartPI(writer, (const xmlChar *)target);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040939 desret_int(ret_val);
40940 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000040941 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000040942 des_const_xmlChar_ptr(n_target, (const xmlChar *)target, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040943 xmlResetLastError();
40944 if (mem_base != xmlMemBlocks()) {
40945 printf("Leak of %d blocks found in xmlTextWriterStartPI",
40946 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040947 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040948 printf(" %d", n_writer);
40949 printf(" %d", n_target);
40950 printf("\n");
40951 }
40952 }
40953 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000040954 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040955#endif
40956
Daniel Veillard42595322004-11-08 10:52:06 +000040957 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000040958}
40959
40960
40961static int
40962test_xmlTextWriterWriteAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000040963 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040964
William M. Brack21e4ef22005-01-02 09:53:13 +000040965#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000040966 int mem_base;
40967 int ret_val;
40968 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
40969 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040970 xmlChar * name; /* attribute name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040971 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000040972 xmlChar * content; /* attribute content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000040973 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000040974
Daniel Veillarde43cc572004-11-03 11:50:29 +000040975 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
40976 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
40977 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
40978 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000040979 writer = gen_xmlTextWriterPtr(n_writer, 0);
40980 name = gen_const_xmlChar_ptr(n_name, 1);
40981 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040982
William M. Brackf13f77f2004-11-12 16:03:48 +000040983 ret_val = xmlTextWriterWriteAttribute(writer, (const xmlChar *)name, (const xmlChar *)content);
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_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
40988 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000040989 xmlResetLastError();
40990 if (mem_base != xmlMemBlocks()) {
40991 printf("Leak of %d blocks found in xmlTextWriterWriteAttribute",
40992 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000040993 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000040994 printf(" %d", n_writer);
40995 printf(" %d", n_name);
40996 printf(" %d", n_content);
40997 printf("\n");
40998 }
40999 }
41000 }
41001 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041002 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041003#endif
41004
Daniel Veillard42595322004-11-08 10:52:06 +000041005 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041006}
41007
41008
41009static int
41010test_xmlTextWriterWriteAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041011 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041012
William M. Brack21e4ef22005-01-02 09:53:13 +000041013#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041014 int mem_base;
41015 int ret_val;
41016 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41017 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041018 xmlChar * prefix; /* namespace prefix */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041019 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041020 xmlChar * name; /* attribute local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041021 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041022 xmlChar * namespaceURI; /* namespace URI */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041023 int n_namespaceURI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041024 xmlChar * content; /* attribute content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041025 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041026
Daniel Veillarde43cc572004-11-03 11:50:29 +000041027 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41028 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
41029 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41030 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
41031 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41032 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041033 writer = gen_xmlTextWriterPtr(n_writer, 0);
41034 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
41035 name = gen_const_xmlChar_ptr(n_name, 2);
41036 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
41037 content = gen_const_xmlChar_ptr(n_content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041038
William M. Brackf13f77f2004-11-12 16:03:48 +000041039 ret_val = xmlTextWriterWriteAttributeNS(writer, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)namespaceURI, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041040 desret_int(ret_val);
41041 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041042 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041043 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
41044 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
41045 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 3);
41046 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041047 xmlResetLastError();
41048 if (mem_base != xmlMemBlocks()) {
41049 printf("Leak of %d blocks found in xmlTextWriterWriteAttributeNS",
41050 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041051 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041052 printf(" %d", n_writer);
41053 printf(" %d", n_prefix);
41054 printf(" %d", n_name);
41055 printf(" %d", n_namespaceURI);
41056 printf(" %d", n_content);
41057 printf("\n");
41058 }
41059 }
41060 }
41061 }
41062 }
41063 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041064 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041065#endif
41066
Daniel Veillard42595322004-11-08 10:52:06 +000041067 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041068}
41069
41070
41071static int
41072test_xmlTextWriterWriteBase64(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041073 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041074
William M. Brack21e4ef22005-01-02 09:53:13 +000041075#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041076 int mem_base;
41077 int ret_val;
41078 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41079 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041080 char * data; /* binary data */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041081 int n_data;
41082 int start; /* the position within the data of the first byte to encode */
41083 int n_start;
41084 int len; /* the number of bytes to encode */
41085 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041086
Daniel Veillarde43cc572004-11-03 11:50:29 +000041087 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41088 for (n_data = 0;n_data < gen_nb_const_char_ptr;n_data++) {
41089 for (n_start = 0;n_start < gen_nb_int;n_start++) {
41090 for (n_len = 0;n_len < gen_nb_int;n_len++) {
41091 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041092 writer = gen_xmlTextWriterPtr(n_writer, 0);
41093 data = gen_const_char_ptr(n_data, 1);
41094 start = gen_int(n_start, 2);
41095 len = gen_int(n_len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041096
William M. Brackf13f77f2004-11-12 16:03:48 +000041097 ret_val = xmlTextWriterWriteBase64(writer, (const char *)data, start, len);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041098 desret_int(ret_val);
41099 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041100 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041101 des_const_char_ptr(n_data, (const char *)data, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000041102 des_int(n_start, start, 2);
41103 des_int(n_len, len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041104 xmlResetLastError();
41105 if (mem_base != xmlMemBlocks()) {
41106 printf("Leak of %d blocks found in xmlTextWriterWriteBase64",
41107 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041108 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041109 printf(" %d", n_writer);
41110 printf(" %d", n_data);
41111 printf(" %d", n_start);
41112 printf(" %d", n_len);
41113 printf("\n");
41114 }
41115 }
41116 }
41117 }
41118 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041119 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041120#endif
41121
Daniel Veillard42595322004-11-08 10:52:06 +000041122 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041123}
41124
41125
41126static int
41127test_xmlTextWriterWriteBinHex(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041128 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041129
William M. Brack21e4ef22005-01-02 09:53:13 +000041130#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041131 int mem_base;
41132 int ret_val;
41133 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41134 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041135 char * data; /* binary data */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041136 int n_data;
41137 int start; /* the position within the data of the first byte to encode */
41138 int n_start;
41139 int len; /* the number of bytes to encode */
41140 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041141
Daniel Veillarde43cc572004-11-03 11:50:29 +000041142 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41143 for (n_data = 0;n_data < gen_nb_const_char_ptr;n_data++) {
41144 for (n_start = 0;n_start < gen_nb_int;n_start++) {
41145 for (n_len = 0;n_len < gen_nb_int;n_len++) {
41146 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041147 writer = gen_xmlTextWriterPtr(n_writer, 0);
41148 data = gen_const_char_ptr(n_data, 1);
41149 start = gen_int(n_start, 2);
41150 len = gen_int(n_len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041151
William M. Brackf13f77f2004-11-12 16:03:48 +000041152 ret_val = xmlTextWriterWriteBinHex(writer, (const char *)data, start, len);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041153 desret_int(ret_val);
41154 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041155 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041156 des_const_char_ptr(n_data, (const char *)data, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000041157 des_int(n_start, start, 2);
41158 des_int(n_len, len, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041159 xmlResetLastError();
41160 if (mem_base != xmlMemBlocks()) {
41161 printf("Leak of %d blocks found in xmlTextWriterWriteBinHex",
41162 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041163 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041164 printf(" %d", n_writer);
41165 printf(" %d", n_data);
41166 printf(" %d", n_start);
41167 printf(" %d", n_len);
41168 printf("\n");
41169 }
41170 }
41171 }
41172 }
41173 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041174 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041175#endif
41176
Daniel Veillard42595322004-11-08 10:52:06 +000041177 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041178}
41179
41180
41181static int
41182test_xmlTextWriterWriteCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041183 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041184
William M. Brack21e4ef22005-01-02 09:53:13 +000041185#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041186 int mem_base;
41187 int ret_val;
41188 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41189 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041190 xmlChar * content; /* CDATA content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041191 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041192
Daniel Veillarde43cc572004-11-03 11:50:29 +000041193 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41194 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41195 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041196 writer = gen_xmlTextWriterPtr(n_writer, 0);
41197 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041198
William M. Brackf13f77f2004-11-12 16:03:48 +000041199 ret_val = xmlTextWriterWriteCDATA(writer, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041200 desret_int(ret_val);
41201 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041202 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041203 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041204 xmlResetLastError();
41205 if (mem_base != xmlMemBlocks()) {
41206 printf("Leak of %d blocks found in xmlTextWriterWriteCDATA",
41207 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041208 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041209 printf(" %d", n_writer);
41210 printf(" %d", n_content);
41211 printf("\n");
41212 }
41213 }
41214 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041215 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041216#endif
41217
Daniel Veillard42595322004-11-08 10:52:06 +000041218 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041219}
41220
41221
41222static int
41223test_xmlTextWriterWriteComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041224 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041225
William M. Brack21e4ef22005-01-02 09:53:13 +000041226#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041227 int mem_base;
41228 int ret_val;
41229 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41230 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041231 xmlChar * content; /* comment string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041232 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041233
Daniel Veillarde43cc572004-11-03 11:50:29 +000041234 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41235 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41236 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041237 writer = gen_xmlTextWriterPtr(n_writer, 0);
41238 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041239
William M. Brackf13f77f2004-11-12 16:03:48 +000041240 ret_val = xmlTextWriterWriteComment(writer, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041241 desret_int(ret_val);
41242 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041243 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041244 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041245 xmlResetLastError();
41246 if (mem_base != xmlMemBlocks()) {
41247 printf("Leak of %d blocks found in xmlTextWriterWriteComment",
41248 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041249 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041250 printf(" %d", n_writer);
41251 printf(" %d", n_content);
41252 printf("\n");
41253 }
41254 }
41255 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041256 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041257#endif
41258
Daniel Veillard42595322004-11-08 10:52:06 +000041259 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041260}
41261
41262
41263static int
41264test_xmlTextWriterWriteDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041265 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041266
William M. Brack21e4ef22005-01-02 09:53:13 +000041267#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041268 int mem_base;
41269 int ret_val;
41270 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41271 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041272 xmlChar * name; /* the name of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041273 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041274 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041275 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041276 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041277 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041278 xmlChar * subset; /* string content of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041279 int n_subset;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041280
Daniel Veillarde43cc572004-11-03 11:50:29 +000041281 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41282 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41283 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
41284 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
41285 for (n_subset = 0;n_subset < gen_nb_const_xmlChar_ptr;n_subset++) {
41286 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041287 writer = gen_xmlTextWriterPtr(n_writer, 0);
41288 name = gen_const_xmlChar_ptr(n_name, 1);
41289 pubid = gen_const_xmlChar_ptr(n_pubid, 2);
41290 sysid = gen_const_xmlChar_ptr(n_sysid, 3);
41291 subset = gen_const_xmlChar_ptr(n_subset, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041292
William M. Brackf13f77f2004-11-12 16:03:48 +000041293 ret_val = xmlTextWriterWriteDTD(writer, (const xmlChar *)name, (const xmlChar *)pubid, (const xmlChar *)sysid, (const xmlChar *)subset);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041294 desret_int(ret_val);
41295 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041296 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041297 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
41298 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 2);
41299 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 3);
41300 des_const_xmlChar_ptr(n_subset, (const xmlChar *)subset, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041301 xmlResetLastError();
41302 if (mem_base != xmlMemBlocks()) {
41303 printf("Leak of %d blocks found in xmlTextWriterWriteDTD",
41304 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041305 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041306 printf(" %d", n_writer);
41307 printf(" %d", n_name);
41308 printf(" %d", n_pubid);
41309 printf(" %d", n_sysid);
41310 printf(" %d", n_subset);
41311 printf("\n");
41312 }
41313 }
41314 }
41315 }
41316 }
41317 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041318 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041319#endif
41320
Daniel Veillard42595322004-11-08 10:52:06 +000041321 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041322}
41323
41324
41325static int
41326test_xmlTextWriterWriteDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041327 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041328
William M. Brack21e4ef22005-01-02 09:53:13 +000041329#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041330 int mem_base;
41331 int ret_val;
41332 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41333 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041334 xmlChar * name; /* the name of the DTD ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041335 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041336 xmlChar * content; /* content of the ATTLIST */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041337 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041338
Daniel Veillarde43cc572004-11-03 11:50:29 +000041339 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41340 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41341 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41342 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041343 writer = gen_xmlTextWriterPtr(n_writer, 0);
41344 name = gen_const_xmlChar_ptr(n_name, 1);
41345 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041346
William M. Brackf13f77f2004-11-12 16:03:48 +000041347 ret_val = xmlTextWriterWriteDTDAttlist(writer, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041348 desret_int(ret_val);
41349 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041350 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041351 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
41352 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041353 xmlResetLastError();
41354 if (mem_base != xmlMemBlocks()) {
41355 printf("Leak of %d blocks found in xmlTextWriterWriteDTDAttlist",
41356 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041357 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041358 printf(" %d", n_writer);
41359 printf(" %d", n_name);
41360 printf(" %d", n_content);
41361 printf("\n");
41362 }
41363 }
41364 }
41365 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041366 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041367#endif
41368
Daniel Veillard42595322004-11-08 10:52:06 +000041369 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041370}
41371
41372
41373static int
41374test_xmlTextWriterWriteDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041375 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041376
William M. Brack21e4ef22005-01-02 09:53:13 +000041377#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041378 int mem_base;
41379 int ret_val;
41380 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41381 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041382 xmlChar * name; /* the name of the DTD element */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041383 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041384 xmlChar * content; /* content of the element */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041385 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041386
Daniel Veillarde43cc572004-11-03 11:50:29 +000041387 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41388 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41389 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41390 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041391 writer = gen_xmlTextWriterPtr(n_writer, 0);
41392 name = gen_const_xmlChar_ptr(n_name, 1);
41393 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041394
William M. Brackf13f77f2004-11-12 16:03:48 +000041395 ret_val = xmlTextWriterWriteDTDElement(writer, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041396 desret_int(ret_val);
41397 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041398 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041399 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
41400 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041401 xmlResetLastError();
41402 if (mem_base != xmlMemBlocks()) {
41403 printf("Leak of %d blocks found in xmlTextWriterWriteDTDElement",
41404 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041405 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041406 printf(" %d", n_writer);
41407 printf(" %d", n_name);
41408 printf(" %d", n_content);
41409 printf("\n");
41410 }
41411 }
41412 }
41413 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041414 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041415#endif
41416
Daniel Veillard42595322004-11-08 10:52:06 +000041417 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041418}
41419
41420
41421static int
41422test_xmlTextWriterWriteDTDEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041423 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041424
William M. Brack21e4ef22005-01-02 09:53:13 +000041425#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041426 int mem_base;
41427 int ret_val;
41428 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41429 int n_writer;
41430 int pe; /* TRUE if this is a parameter entity, FALSE if not */
41431 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041432 xmlChar * name; /* the name of the DTD entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041433 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041434 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041435 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041436 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041437 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041438 xmlChar * ndataid; /* the xml notation name. */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041439 int n_ndataid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041440 xmlChar * content; /* content of the entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041441 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041442
Daniel Veillarde43cc572004-11-03 11:50:29 +000041443 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41444 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
41445 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41446 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
41447 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
41448 for (n_ndataid = 0;n_ndataid < gen_nb_const_xmlChar_ptr;n_ndataid++) {
41449 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41450 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041451 writer = gen_xmlTextWriterPtr(n_writer, 0);
41452 pe = gen_int(n_pe, 1);
41453 name = gen_const_xmlChar_ptr(n_name, 2);
41454 pubid = gen_const_xmlChar_ptr(n_pubid, 3);
41455 sysid = gen_const_xmlChar_ptr(n_sysid, 4);
41456 ndataid = gen_const_xmlChar_ptr(n_ndataid, 5);
41457 content = gen_const_xmlChar_ptr(n_content, 6);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041458
William M. Brackf13f77f2004-11-12 16:03:48 +000041459 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 +000041460 desret_int(ret_val);
41461 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041462 des_xmlTextWriterPtr(n_writer, writer, 0);
41463 des_int(n_pe, pe, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000041464 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
41465 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 3);
41466 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 4);
41467 des_const_xmlChar_ptr(n_ndataid, (const xmlChar *)ndataid, 5);
41468 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 6);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041469 xmlResetLastError();
41470 if (mem_base != xmlMemBlocks()) {
41471 printf("Leak of %d blocks found in xmlTextWriterWriteDTDEntity",
41472 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041473 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041474 printf(" %d", n_writer);
41475 printf(" %d", n_pe);
41476 printf(" %d", n_name);
41477 printf(" %d", n_pubid);
41478 printf(" %d", n_sysid);
41479 printf(" %d", n_ndataid);
41480 printf(" %d", n_content);
41481 printf("\n");
41482 }
41483 }
41484 }
41485 }
41486 }
41487 }
41488 }
41489 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041490 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041491#endif
41492
Daniel Veillard42595322004-11-08 10:52:06 +000041493 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041494}
41495
41496
41497static int
41498test_xmlTextWriterWriteDTDExternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041499 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041500
William M. Brack21e4ef22005-01-02 09:53:13 +000041501#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041502 int mem_base;
41503 int ret_val;
41504 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41505 int n_writer;
41506 int pe; /* TRUE if this is a parameter entity, FALSE if not */
41507 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041508 xmlChar * name; /* the name of the DTD entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041509 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041510 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041511 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041512 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041513 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041514 xmlChar * ndataid; /* the xml notation name. */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041515 int n_ndataid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041516
Daniel Veillarde43cc572004-11-03 11:50:29 +000041517 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41518 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
41519 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41520 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
41521 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
41522 for (n_ndataid = 0;n_ndataid < gen_nb_const_xmlChar_ptr;n_ndataid++) {
41523 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041524 writer = gen_xmlTextWriterPtr(n_writer, 0);
41525 pe = gen_int(n_pe, 1);
41526 name = gen_const_xmlChar_ptr(n_name, 2);
41527 pubid = gen_const_xmlChar_ptr(n_pubid, 3);
41528 sysid = gen_const_xmlChar_ptr(n_sysid, 4);
41529 ndataid = gen_const_xmlChar_ptr(n_ndataid, 5);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041530
William M. Brackf13f77f2004-11-12 16:03:48 +000041531 ret_val = xmlTextWriterWriteDTDExternalEntity(writer, pe, (const xmlChar *)name, (const xmlChar *)pubid, (const xmlChar *)sysid, (const xmlChar *)ndataid);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041532 desret_int(ret_val);
41533 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041534 des_xmlTextWriterPtr(n_writer, writer, 0);
41535 des_int(n_pe, pe, 1);
William M. Brackf13f77f2004-11-12 16:03:48 +000041536 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
41537 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 3);
41538 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 4);
41539 des_const_xmlChar_ptr(n_ndataid, (const xmlChar *)ndataid, 5);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041540 xmlResetLastError();
41541 if (mem_base != xmlMemBlocks()) {
41542 printf("Leak of %d blocks found in xmlTextWriterWriteDTDExternalEntity",
41543 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041544 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041545 printf(" %d", n_writer);
41546 printf(" %d", n_pe);
41547 printf(" %d", n_name);
41548 printf(" %d", n_pubid);
41549 printf(" %d", n_sysid);
41550 printf(" %d", n_ndataid);
41551 printf("\n");
41552 }
41553 }
41554 }
41555 }
41556 }
41557 }
41558 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041559 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041560#endif
41561
Daniel Veillard42595322004-11-08 10:52:06 +000041562 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041563}
41564
41565
41566static int
41567test_xmlTextWriterWriteDTDExternalEntityContents(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041568 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041569
William M. Brack21e4ef22005-01-02 09:53:13 +000041570#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041571 int mem_base;
41572 int ret_val;
41573 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41574 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041575 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041576 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041577 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041578 int n_sysid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041579 xmlChar * ndataid; /* the xml notation name. */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041580 int n_ndataid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041581
Daniel Veillarde43cc572004-11-03 11:50:29 +000041582 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41583 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
41584 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
41585 for (n_ndataid = 0;n_ndataid < gen_nb_const_xmlChar_ptr;n_ndataid++) {
41586 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041587 writer = gen_xmlTextWriterPtr(n_writer, 0);
41588 pubid = gen_const_xmlChar_ptr(n_pubid, 1);
41589 sysid = gen_const_xmlChar_ptr(n_sysid, 2);
41590 ndataid = gen_const_xmlChar_ptr(n_ndataid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041591
William M. Brackf13f77f2004-11-12 16:03:48 +000041592 ret_val = xmlTextWriterWriteDTDExternalEntityContents(writer, (const xmlChar *)pubid, (const xmlChar *)sysid, (const xmlChar *)ndataid);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041593 desret_int(ret_val);
41594 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041595 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041596 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 1);
41597 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 2);
41598 des_const_xmlChar_ptr(n_ndataid, (const xmlChar *)ndataid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041599 xmlResetLastError();
41600 if (mem_base != xmlMemBlocks()) {
41601 printf("Leak of %d blocks found in xmlTextWriterWriteDTDExternalEntityContents",
41602 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041603 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041604 printf(" %d", n_writer);
41605 printf(" %d", n_pubid);
41606 printf(" %d", n_sysid);
41607 printf(" %d", n_ndataid);
41608 printf("\n");
41609 }
41610 }
41611 }
41612 }
41613 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041614 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041615#endif
41616
Daniel Veillard42595322004-11-08 10:52:06 +000041617 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041618}
41619
41620
41621static int
41622test_xmlTextWriterWriteDTDInternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041623 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041624
William M. Brack21e4ef22005-01-02 09:53:13 +000041625#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041626 int mem_base;
41627 int ret_val;
41628 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41629 int n_writer;
41630 int pe; /* TRUE if this is a parameter entity, FALSE if not */
41631 int n_pe;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041632 xmlChar * name; /* the name of the DTD entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041633 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041634 xmlChar * content; /* content of the entity */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041635 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041636
Daniel Veillarde43cc572004-11-03 11:50:29 +000041637 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41638 for (n_pe = 0;n_pe < gen_nb_int;n_pe++) {
41639 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41640 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41641 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041642 writer = gen_xmlTextWriterPtr(n_writer, 0);
41643 pe = gen_int(n_pe, 1);
41644 name = gen_const_xmlChar_ptr(n_name, 2);
41645 content = gen_const_xmlChar_ptr(n_content, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041646
William M. Brackf13f77f2004-11-12 16:03:48 +000041647 ret_val = xmlTextWriterWriteDTDInternalEntity(writer, pe, (const xmlChar *)name, (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_content, (const xmlChar *)content, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041654 xmlResetLastError();
41655 if (mem_base != xmlMemBlocks()) {
41656 printf("Leak of %d blocks found in xmlTextWriterWriteDTDInternalEntity",
41657 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041658 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041659 printf(" %d", n_writer);
41660 printf(" %d", n_pe);
41661 printf(" %d", n_name);
41662 printf(" %d", n_content);
41663 printf("\n");
41664 }
41665 }
41666 }
41667 }
41668 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041669 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041670#endif
41671
Daniel Veillard42595322004-11-08 10:52:06 +000041672 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041673}
41674
41675
41676static int
41677test_xmlTextWriterWriteDTDNotation(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041678 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041679
William M. Brack21e4ef22005-01-02 09:53:13 +000041680#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041681 int mem_base;
41682 int ret_val;
41683 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41684 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041685 xmlChar * name; /* the name of the xml notation */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041686 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041687 xmlChar * pubid; /* the public identifier, which is an alternative to the system identifier */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041688 int n_pubid;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041689 xmlChar * sysid; /* the system identifier, which is the URI of the DTD */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041690 int n_sysid;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041691
Daniel Veillarde43cc572004-11-03 11:50:29 +000041692 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41693 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41694 for (n_pubid = 0;n_pubid < gen_nb_const_xmlChar_ptr;n_pubid++) {
41695 for (n_sysid = 0;n_sysid < gen_nb_const_xmlChar_ptr;n_sysid++) {
41696 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041697 writer = gen_xmlTextWriterPtr(n_writer, 0);
41698 name = gen_const_xmlChar_ptr(n_name, 1);
41699 pubid = gen_const_xmlChar_ptr(n_pubid, 2);
41700 sysid = gen_const_xmlChar_ptr(n_sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041701
William M. Brackf13f77f2004-11-12 16:03:48 +000041702 ret_val = xmlTextWriterWriteDTDNotation(writer, (const xmlChar *)name, (const xmlChar *)pubid, (const xmlChar *)sysid);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041703 desret_int(ret_val);
41704 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041705 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041706 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
41707 des_const_xmlChar_ptr(n_pubid, (const xmlChar *)pubid, 2);
41708 des_const_xmlChar_ptr(n_sysid, (const xmlChar *)sysid, 3);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041709 xmlResetLastError();
41710 if (mem_base != xmlMemBlocks()) {
41711 printf("Leak of %d blocks found in xmlTextWriterWriteDTDNotation",
41712 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041713 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041714 printf(" %d", n_writer);
41715 printf(" %d", n_name);
41716 printf(" %d", n_pubid);
41717 printf(" %d", n_sysid);
41718 printf("\n");
41719 }
41720 }
41721 }
41722 }
41723 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041724 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041725#endif
41726
Daniel Veillard42595322004-11-08 10:52:06 +000041727 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041728}
41729
41730
41731static int
41732test_xmlTextWriterWriteElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041733 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041734
William M. Brack21e4ef22005-01-02 09:53:13 +000041735#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041736 int mem_base;
41737 int ret_val;
41738 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41739 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041740 xmlChar * name; /* element name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041741 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041742 xmlChar * content; /* element content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041743 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041744
Daniel Veillarde43cc572004-11-03 11:50:29 +000041745 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41746 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41747 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41748 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041749 writer = gen_xmlTextWriterPtr(n_writer, 0);
41750 name = gen_const_xmlChar_ptr(n_name, 1);
41751 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041752
William M. Brackf13f77f2004-11-12 16:03:48 +000041753 ret_val = xmlTextWriterWriteElement(writer, (const xmlChar *)name, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041754 desret_int(ret_val);
41755 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041756 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041757 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
41758 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041759 xmlResetLastError();
41760 if (mem_base != xmlMemBlocks()) {
41761 printf("Leak of %d blocks found in xmlTextWriterWriteElement",
41762 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041763 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041764 printf(" %d", n_writer);
41765 printf(" %d", n_name);
41766 printf(" %d", n_content);
41767 printf("\n");
41768 }
41769 }
41770 }
41771 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041772 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041773#endif
41774
Daniel Veillard42595322004-11-08 10:52:06 +000041775 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041776}
41777
41778
41779static int
41780test_xmlTextWriterWriteElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041781 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041782
William M. Brack21e4ef22005-01-02 09:53:13 +000041783#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041784 int mem_base;
41785 int ret_val;
41786 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41787 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041788 xmlChar * prefix; /* namespace prefix */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041789 int n_prefix;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041790 xmlChar * name; /* element local name */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041791 int n_name;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041792 xmlChar * namespaceURI; /* namespace URI */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041793 int n_namespaceURI;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041794 xmlChar * content; /* element content */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041795 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041796
Daniel Veillarde43cc572004-11-03 11:50:29 +000041797 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
41798 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
41799 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
41800 for (n_namespaceURI = 0;n_namespaceURI < gen_nb_const_xmlChar_ptr;n_namespaceURI++) {
41801 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41802 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041803 writer = gen_xmlTextWriterPtr(n_writer, 0);
41804 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
41805 name = gen_const_xmlChar_ptr(n_name, 2);
41806 namespaceURI = gen_const_xmlChar_ptr(n_namespaceURI, 3);
41807 content = gen_const_xmlChar_ptr(n_content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041808
William M. Brackf13f77f2004-11-12 16:03:48 +000041809 ret_val = xmlTextWriterWriteElementNS(writer, (const xmlChar *)prefix, (const xmlChar *)name, (const xmlChar *)namespaceURI, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041810 desret_int(ret_val);
41811 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041812 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041813 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
41814 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 2);
41815 des_const_xmlChar_ptr(n_namespaceURI, (const xmlChar *)namespaceURI, 3);
41816 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 4);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041817 xmlResetLastError();
41818 if (mem_base != xmlMemBlocks()) {
41819 printf("Leak of %d blocks found in xmlTextWriterWriteElementNS",
41820 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000041821 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041822 printf(" %d", n_writer);
41823 printf(" %d", n_prefix);
41824 printf(" %d", n_name);
41825 printf(" %d", n_namespaceURI);
41826 printf(" %d", n_content);
41827 printf("\n");
41828 }
41829 }
41830 }
41831 }
41832 }
41833 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000041834 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000041835#endif
41836
Daniel Veillard42595322004-11-08 10:52:06 +000041837 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041838}
41839
41840
41841static int
41842test_xmlTextWriterWriteFormatAttribute(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041843 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041844
41845
41846 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041847 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041848}
41849
41850
41851static int
41852test_xmlTextWriterWriteFormatAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041853 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041854
41855
41856 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041857 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041858}
41859
41860
41861static int
41862test_xmlTextWriterWriteFormatCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041863 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041864
41865
41866 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041867 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041868}
41869
41870
41871static int
41872test_xmlTextWriterWriteFormatComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041873 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041874
41875
41876 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041877 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041878}
41879
41880
41881static int
41882test_xmlTextWriterWriteFormatDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041883 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041884
41885
41886 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041887 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041888}
41889
41890
41891static int
41892test_xmlTextWriterWriteFormatDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041893 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041894
41895
41896 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041897 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041898}
41899
41900
41901static int
41902test_xmlTextWriterWriteFormatDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041903 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041904
41905
41906 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041907 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041908}
41909
41910
41911static int
41912test_xmlTextWriterWriteFormatDTDInternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041913 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041914
41915
41916 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041917 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041918}
41919
41920
41921static int
41922test_xmlTextWriterWriteFormatElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041923 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041924
41925
41926 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041927 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041928}
41929
41930
41931static int
41932test_xmlTextWriterWriteFormatElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041933 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041934
41935
41936 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041937 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041938}
41939
41940
41941static int
41942test_xmlTextWriterWriteFormatPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041943 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041944
41945
41946 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041947 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041948}
41949
41950
41951static int
41952test_xmlTextWriterWriteFormatRaw(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041953 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041954
41955
41956 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041957 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041958}
41959
41960
41961static int
41962test_xmlTextWriterWriteFormatString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041963 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041964
41965
41966 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000041967 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000041968}
41969
41970
41971static int
41972test_xmlTextWriterWritePI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000041973 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000041974
William M. Brack21e4ef22005-01-02 09:53:13 +000041975#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000041976 int mem_base;
41977 int ret_val;
41978 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
41979 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041980 xmlChar * target; /* PI target */
Daniel Veillarde43cc572004-11-03 11:50:29 +000041981 int n_target;
Daniel Veillardce682bc2004-11-05 17:22:25 +000041982 xmlChar * content; /* PI 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_target = 0;n_target < gen_nb_const_xmlChar_ptr;n_target++) {
41987 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
41988 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000041989 writer = gen_xmlTextWriterPtr(n_writer, 0);
41990 target = gen_const_xmlChar_ptr(n_target, 1);
41991 content = gen_const_xmlChar_ptr(n_content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041992
William M. Brackf13f77f2004-11-12 16:03:48 +000041993 ret_val = xmlTextWriterWritePI(writer, (const xmlChar *)target, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041994 desret_int(ret_val);
41995 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000041996 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000041997 des_const_xmlChar_ptr(n_target, (const xmlChar *)target, 1);
41998 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000041999 xmlResetLastError();
42000 if (mem_base != xmlMemBlocks()) {
42001 printf("Leak of %d blocks found in xmlTextWriterWritePI",
42002 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042003 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042004 printf(" %d", n_writer);
42005 printf(" %d", n_target);
42006 printf(" %d", n_content);
42007 printf("\n");
42008 }
42009 }
42010 }
42011 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042012 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042013#endif
42014
Daniel Veillard42595322004-11-08 10:52:06 +000042015 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042016}
42017
42018
42019static int
42020test_xmlTextWriterWriteRaw(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042021 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042022
William M. Brack21e4ef22005-01-02 09:53:13 +000042023#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042024 int mem_base;
42025 int ret_val;
42026 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42027 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042028 xmlChar * content; /* text string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042029 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042030
Daniel Veillarde43cc572004-11-03 11:50:29 +000042031 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42032 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42033 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042034 writer = gen_xmlTextWriterPtr(n_writer, 0);
42035 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042036
William M. Brackf13f77f2004-11-12 16:03:48 +000042037 ret_val = xmlTextWriterWriteRaw(writer, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042038 desret_int(ret_val);
42039 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042040 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042041 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042042 xmlResetLastError();
42043 if (mem_base != xmlMemBlocks()) {
42044 printf("Leak of %d blocks found in xmlTextWriterWriteRaw",
42045 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042046 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042047 printf(" %d", n_writer);
42048 printf(" %d", n_content);
42049 printf("\n");
42050 }
42051 }
42052 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042053 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042054#endif
42055
Daniel Veillard42595322004-11-08 10:52:06 +000042056 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042057}
42058
42059
42060static int
42061test_xmlTextWriterWriteRawLen(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042062 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042063
William M. Brack21e4ef22005-01-02 09:53:13 +000042064#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042065 int mem_base;
42066 int ret_val;
42067 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42068 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042069 xmlChar * content; /* text string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042070 int n_content;
42071 int len; /* length of the text string */
42072 int n_len;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042073
Daniel Veillarde43cc572004-11-03 11:50:29 +000042074 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42075 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42076 for (n_len = 0;n_len < gen_nb_int;n_len++) {
42077 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042078 writer = gen_xmlTextWriterPtr(n_writer, 0);
42079 content = gen_const_xmlChar_ptr(n_content, 1);
42080 len = gen_int(n_len, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042081
William M. Brackf13f77f2004-11-12 16:03:48 +000042082 ret_val = xmlTextWriterWriteRawLen(writer, (const xmlChar *)content, len);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042083 desret_int(ret_val);
42084 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042085 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042086 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillard3d97e662004-11-04 10:49:00 +000042087 des_int(n_len, len, 2);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042088 xmlResetLastError();
42089 if (mem_base != xmlMemBlocks()) {
42090 printf("Leak of %d blocks found in xmlTextWriterWriteRawLen",
42091 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042092 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042093 printf(" %d", n_writer);
42094 printf(" %d", n_content);
42095 printf(" %d", n_len);
42096 printf("\n");
42097 }
42098 }
42099 }
42100 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042101 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042102#endif
42103
Daniel Veillard42595322004-11-08 10:52:06 +000042104 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042105}
42106
42107
42108static int
42109test_xmlTextWriterWriteString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042110 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042111
William M. Brack21e4ef22005-01-02 09:53:13 +000042112#if defined(LIBXML_WRITER_ENABLED)
Daniel Veillarde43cc572004-11-03 11:50:29 +000042113 int mem_base;
42114 int ret_val;
42115 xmlTextWriterPtr writer; /* the xmlTextWriterPtr */
42116 int n_writer;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042117 xmlChar * content; /* text string */
Daniel Veillarde43cc572004-11-03 11:50:29 +000042118 int n_content;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042119
Daniel Veillarde43cc572004-11-03 11:50:29 +000042120 for (n_writer = 0;n_writer < gen_nb_xmlTextWriterPtr;n_writer++) {
42121 for (n_content = 0;n_content < gen_nb_const_xmlChar_ptr;n_content++) {
42122 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042123 writer = gen_xmlTextWriterPtr(n_writer, 0);
42124 content = gen_const_xmlChar_ptr(n_content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042125
William M. Brackf13f77f2004-11-12 16:03:48 +000042126 ret_val = xmlTextWriterWriteString(writer, (const xmlChar *)content);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042127 desret_int(ret_val);
42128 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042129 des_xmlTextWriterPtr(n_writer, writer, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000042130 des_const_xmlChar_ptr(n_content, (const xmlChar *)content, 1);
Daniel Veillarde43cc572004-11-03 11:50:29 +000042131 xmlResetLastError();
42132 if (mem_base != xmlMemBlocks()) {
42133 printf("Leak of %d blocks found in xmlTextWriterWriteString",
42134 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042135 test_ret++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042136 printf(" %d", n_writer);
42137 printf(" %d", n_content);
42138 printf("\n");
42139 }
42140 }
42141 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042142 function_tests++;
Daniel Veillarde43cc572004-11-03 11:50:29 +000042143#endif
42144
Daniel Veillard42595322004-11-08 10:52:06 +000042145 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042146}
42147
42148
42149static int
42150test_xmlTextWriterWriteVFormatAttribute(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_xmlTextWriterWriteVFormatAttributeNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042161 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042162
42163
42164 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042165 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042166}
42167
42168
42169static int
42170test_xmlTextWriterWriteVFormatCDATA(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042171 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042172
42173
42174 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042175 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042176}
42177
42178
42179static int
42180test_xmlTextWriterWriteVFormatComment(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042181 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042182
42183
42184 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042185 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042186}
42187
42188
42189static int
42190test_xmlTextWriterWriteVFormatDTD(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042191 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042192
42193
42194 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042195 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042196}
42197
42198
42199static int
42200test_xmlTextWriterWriteVFormatDTDAttlist(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042201 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042202
42203
42204 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042205 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042206}
42207
42208
42209static int
42210test_xmlTextWriterWriteVFormatDTDElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042211 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042212
42213
42214 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042215 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042216}
42217
42218
42219static int
42220test_xmlTextWriterWriteVFormatDTDInternalEntity(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042221 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042222
42223
42224 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042225 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042226}
42227
42228
42229static int
42230test_xmlTextWriterWriteVFormatElement(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042231 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042232
42233
42234 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042235 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042236}
42237
42238
42239static int
42240test_xmlTextWriterWriteVFormatElementNS(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042241 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042242
42243
42244 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042245 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042246}
42247
42248
42249static int
42250test_xmlTextWriterWriteVFormatPI(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042251 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042252
42253
42254 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042255 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042256}
42257
42258
42259static int
42260test_xmlTextWriterWriteVFormatRaw(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042261 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042262
42263
42264 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042265 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042266}
42267
42268
42269static int
42270test_xmlTextWriterWriteVFormatString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042271 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042272
42273
42274 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042275 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042276}
42277
42278static int
42279test_xmlwriter(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042280 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042281
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042282 if (quiet == 0) printf("Testing xmlwriter : 51 of 79 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000042283 test_ret += test_xmlNewTextWriter();
42284 test_ret += test_xmlNewTextWriterFilename();
42285 test_ret += test_xmlNewTextWriterMemory();
42286 test_ret += test_xmlNewTextWriterPushParser();
42287 test_ret += test_xmlNewTextWriterTree();
42288 test_ret += test_xmlTextWriterEndAttribute();
42289 test_ret += test_xmlTextWriterEndCDATA();
42290 test_ret += test_xmlTextWriterEndComment();
42291 test_ret += test_xmlTextWriterEndDTD();
42292 test_ret += test_xmlTextWriterEndDTDAttlist();
42293 test_ret += test_xmlTextWriterEndDTDElement();
42294 test_ret += test_xmlTextWriterEndDTDEntity();
42295 test_ret += test_xmlTextWriterEndDocument();
42296 test_ret += test_xmlTextWriterEndElement();
42297 test_ret += test_xmlTextWriterEndPI();
42298 test_ret += test_xmlTextWriterFlush();
42299 test_ret += test_xmlTextWriterFullEndElement();
42300 test_ret += test_xmlTextWriterSetIndent();
42301 test_ret += test_xmlTextWriterSetIndentString();
42302 test_ret += test_xmlTextWriterStartAttribute();
42303 test_ret += test_xmlTextWriterStartAttributeNS();
42304 test_ret += test_xmlTextWriterStartCDATA();
42305 test_ret += test_xmlTextWriterStartComment();
42306 test_ret += test_xmlTextWriterStartDTD();
42307 test_ret += test_xmlTextWriterStartDTDAttlist();
42308 test_ret += test_xmlTextWriterStartDTDElement();
42309 test_ret += test_xmlTextWriterStartDTDEntity();
42310 test_ret += test_xmlTextWriterStartDocument();
42311 test_ret += test_xmlTextWriterStartElement();
42312 test_ret += test_xmlTextWriterStartElementNS();
42313 test_ret += test_xmlTextWriterStartPI();
42314 test_ret += test_xmlTextWriterWriteAttribute();
42315 test_ret += test_xmlTextWriterWriteAttributeNS();
42316 test_ret += test_xmlTextWriterWriteBase64();
42317 test_ret += test_xmlTextWriterWriteBinHex();
42318 test_ret += test_xmlTextWriterWriteCDATA();
42319 test_ret += test_xmlTextWriterWriteComment();
42320 test_ret += test_xmlTextWriterWriteDTD();
42321 test_ret += test_xmlTextWriterWriteDTDAttlist();
42322 test_ret += test_xmlTextWriterWriteDTDElement();
42323 test_ret += test_xmlTextWriterWriteDTDEntity();
42324 test_ret += test_xmlTextWriterWriteDTDExternalEntity();
42325 test_ret += test_xmlTextWriterWriteDTDExternalEntityContents();
42326 test_ret += test_xmlTextWriterWriteDTDInternalEntity();
42327 test_ret += test_xmlTextWriterWriteDTDNotation();
42328 test_ret += test_xmlTextWriterWriteElement();
42329 test_ret += test_xmlTextWriterWriteElementNS();
42330 test_ret += test_xmlTextWriterWriteFormatAttribute();
42331 test_ret += test_xmlTextWriterWriteFormatAttributeNS();
42332 test_ret += test_xmlTextWriterWriteFormatCDATA();
42333 test_ret += test_xmlTextWriterWriteFormatComment();
42334 test_ret += test_xmlTextWriterWriteFormatDTD();
42335 test_ret += test_xmlTextWriterWriteFormatDTDAttlist();
42336 test_ret += test_xmlTextWriterWriteFormatDTDElement();
42337 test_ret += test_xmlTextWriterWriteFormatDTDInternalEntity();
42338 test_ret += test_xmlTextWriterWriteFormatElement();
42339 test_ret += test_xmlTextWriterWriteFormatElementNS();
42340 test_ret += test_xmlTextWriterWriteFormatPI();
42341 test_ret += test_xmlTextWriterWriteFormatRaw();
42342 test_ret += test_xmlTextWriterWriteFormatString();
42343 test_ret += test_xmlTextWriterWritePI();
42344 test_ret += test_xmlTextWriterWriteRaw();
42345 test_ret += test_xmlTextWriterWriteRawLen();
42346 test_ret += test_xmlTextWriterWriteString();
42347 test_ret += test_xmlTextWriterWriteVFormatAttribute();
42348 test_ret += test_xmlTextWriterWriteVFormatAttributeNS();
42349 test_ret += test_xmlTextWriterWriteVFormatCDATA();
42350 test_ret += test_xmlTextWriterWriteVFormatComment();
42351 test_ret += test_xmlTextWriterWriteVFormatDTD();
42352 test_ret += test_xmlTextWriterWriteVFormatDTDAttlist();
42353 test_ret += test_xmlTextWriterWriteVFormatDTDElement();
42354 test_ret += test_xmlTextWriterWriteVFormatDTDInternalEntity();
42355 test_ret += test_xmlTextWriterWriteVFormatElement();
42356 test_ret += test_xmlTextWriterWriteVFormatElementNS();
42357 test_ret += test_xmlTextWriterWriteVFormatPI();
42358 test_ret += test_xmlTextWriterWriteVFormatRaw();
42359 test_ret += test_xmlTextWriterWriteVFormatString();
Daniel Veillardd93f6252004-11-02 15:53:51 +000042360
Daniel Veillard42595322004-11-08 10:52:06 +000042361 if (test_ret != 0)
42362 printf("Module xmlwriter: %d errors\n", test_ret);
42363 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042364}
42365
42366static int
42367test_xmlXPathCastBooleanToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042368 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042369
William M. Brack21e4ef22005-01-02 09:53:13 +000042370#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042371 int mem_base;
42372 double ret_val;
42373 int val; /* a boolean */
42374 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042375
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042376 for (n_val = 0;n_val < gen_nb_int;n_val++) {
42377 mem_base = xmlMemBlocks();
42378 val = gen_int(n_val, 0);
42379
42380 ret_val = xmlXPathCastBooleanToNumber(val);
42381 desret_double(ret_val);
42382 call_tests++;
42383 des_int(n_val, val, 0);
42384 xmlResetLastError();
42385 if (mem_base != xmlMemBlocks()) {
42386 printf("Leak of %d blocks found in xmlXPathCastBooleanToNumber",
42387 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042388 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042389 printf(" %d", n_val);
42390 printf("\n");
42391 }
42392 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042393 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042394#endif
42395
Daniel Veillard42595322004-11-08 10:52:06 +000042396 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042397}
42398
42399
42400static int
42401test_xmlXPathCastBooleanToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042402 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042403
William M. Brack21e4ef22005-01-02 09:53:13 +000042404#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042405 int mem_base;
42406 xmlChar * ret_val;
42407 int val; /* a boolean */
42408 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042409
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042410 for (n_val = 0;n_val < gen_nb_int;n_val++) {
42411 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042412 val = gen_int(n_val, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042413
42414 ret_val = xmlXPathCastBooleanToString(val);
42415 desret_xmlChar_ptr(ret_val);
42416 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042417 des_int(n_val, val, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042418 xmlResetLastError();
42419 if (mem_base != xmlMemBlocks()) {
42420 printf("Leak of %d blocks found in xmlXPathCastBooleanToString",
42421 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042422 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042423 printf(" %d", n_val);
42424 printf("\n");
42425 }
42426 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042427 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042428#endif
42429
Daniel Veillard42595322004-11-08 10:52:06 +000042430 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042431}
42432
42433
42434static int
42435test_xmlXPathCastNodeSetToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042436 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042437
William M. Brack21e4ef22005-01-02 09:53:13 +000042438#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000042439 int mem_base;
42440 int ret_val;
42441 xmlNodeSetPtr ns; /* a node-set */
42442 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042443
Daniel Veillardce682bc2004-11-05 17:22:25 +000042444 for (n_ns = 0;n_ns < gen_nb_xmlNodeSetPtr;n_ns++) {
42445 mem_base = xmlMemBlocks();
42446 ns = gen_xmlNodeSetPtr(n_ns, 0);
42447
42448 ret_val = xmlXPathCastNodeSetToBoolean(ns);
42449 desret_int(ret_val);
42450 call_tests++;
42451 des_xmlNodeSetPtr(n_ns, ns, 0);
42452 xmlResetLastError();
42453 if (mem_base != xmlMemBlocks()) {
42454 printf("Leak of %d blocks found in xmlXPathCastNodeSetToBoolean",
42455 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042456 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042457 printf(" %d", n_ns);
42458 printf("\n");
42459 }
42460 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042461 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042462#endif
42463
Daniel Veillard42595322004-11-08 10:52:06 +000042464 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042465}
42466
42467
42468static int
42469test_xmlXPathCastNodeSetToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042470 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042471
William M. Brack21e4ef22005-01-02 09:53:13 +000042472#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000042473 int mem_base;
42474 double ret_val;
42475 xmlNodeSetPtr ns; /* a node-set */
42476 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042477
Daniel Veillardce682bc2004-11-05 17:22:25 +000042478 for (n_ns = 0;n_ns < gen_nb_xmlNodeSetPtr;n_ns++) {
42479 mem_base = xmlMemBlocks();
42480 ns = gen_xmlNodeSetPtr(n_ns, 0);
42481
42482 ret_val = xmlXPathCastNodeSetToNumber(ns);
42483 desret_double(ret_val);
42484 call_tests++;
42485 des_xmlNodeSetPtr(n_ns, ns, 0);
42486 xmlResetLastError();
42487 if (mem_base != xmlMemBlocks()) {
42488 printf("Leak of %d blocks found in xmlXPathCastNodeSetToNumber",
42489 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042490 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042491 printf(" %d", n_ns);
42492 printf("\n");
42493 }
42494 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042495 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042496#endif
42497
Daniel Veillard42595322004-11-08 10:52:06 +000042498 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042499}
42500
42501
42502static int
42503test_xmlXPathCastNodeSetToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042504 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042505
William M. Brack21e4ef22005-01-02 09:53:13 +000042506#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000042507 int mem_base;
42508 xmlChar * ret_val;
42509 xmlNodeSetPtr ns; /* a node-set */
42510 int n_ns;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042511
Daniel Veillardce682bc2004-11-05 17:22:25 +000042512 for (n_ns = 0;n_ns < gen_nb_xmlNodeSetPtr;n_ns++) {
42513 mem_base = xmlMemBlocks();
42514 ns = gen_xmlNodeSetPtr(n_ns, 0);
42515
42516 ret_val = xmlXPathCastNodeSetToString(ns);
42517 desret_xmlChar_ptr(ret_val);
42518 call_tests++;
42519 des_xmlNodeSetPtr(n_ns, ns, 0);
42520 xmlResetLastError();
42521 if (mem_base != xmlMemBlocks()) {
42522 printf("Leak of %d blocks found in xmlXPathCastNodeSetToString",
42523 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042524 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042525 printf(" %d", n_ns);
42526 printf("\n");
42527 }
42528 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042529 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042530#endif
42531
Daniel Veillard42595322004-11-08 10:52:06 +000042532 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042533}
42534
42535
42536static int
42537test_xmlXPathCastNodeToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042538 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042539
William M. Brack21e4ef22005-01-02 09:53:13 +000042540#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042541 int mem_base;
42542 double ret_val;
42543 xmlNodePtr node; /* a node */
42544 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042545
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042546 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
42547 mem_base = xmlMemBlocks();
42548 node = gen_xmlNodePtr(n_node, 0);
42549
42550 ret_val = xmlXPathCastNodeToNumber(node);
42551 desret_double(ret_val);
42552 call_tests++;
42553 des_xmlNodePtr(n_node, node, 0);
42554 xmlResetLastError();
42555 if (mem_base != xmlMemBlocks()) {
42556 printf("Leak of %d blocks found in xmlXPathCastNodeToNumber",
42557 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042558 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042559 printf(" %d", n_node);
42560 printf("\n");
42561 }
42562 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042563 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042564#endif
42565
Daniel Veillard42595322004-11-08 10:52:06 +000042566 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042567}
42568
42569
42570static int
42571test_xmlXPathCastNodeToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042572 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042573
William M. Brack21e4ef22005-01-02 09:53:13 +000042574#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042575 int mem_base;
42576 xmlChar * ret_val;
42577 xmlNodePtr node; /* a node */
42578 int n_node;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042579
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042580 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
42581 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042582 node = gen_xmlNodePtr(n_node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042583
42584 ret_val = xmlXPathCastNodeToString(node);
42585 desret_xmlChar_ptr(ret_val);
42586 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042587 des_xmlNodePtr(n_node, node, 0);
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042588 xmlResetLastError();
42589 if (mem_base != xmlMemBlocks()) {
42590 printf("Leak of %d blocks found in xmlXPathCastNodeToString",
42591 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042592 test_ret++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042593 printf(" %d", n_node);
42594 printf("\n");
42595 }
42596 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042597 function_tests++;
Daniel Veillard8a32fe42004-11-02 22:10:16 +000042598#endif
42599
Daniel Veillard42595322004-11-08 10:52:06 +000042600 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042601}
42602
42603
42604static int
42605test_xmlXPathCastNumberToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042606 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042607
William M. Brack21e4ef22005-01-02 09:53:13 +000042608#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000042609 int mem_base;
42610 int ret_val;
42611 double val; /* a number */
42612 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042613
Daniel Veillard3d95c732004-11-06 22:25:14 +000042614 for (n_val = 0;n_val < gen_nb_double;n_val++) {
42615 mem_base = xmlMemBlocks();
42616 val = gen_double(n_val, 0);
42617
42618 ret_val = xmlXPathCastNumberToBoolean(val);
42619 desret_int(ret_val);
42620 call_tests++;
42621 des_double(n_val, val, 0);
42622 xmlResetLastError();
42623 if (mem_base != xmlMemBlocks()) {
42624 printf("Leak of %d blocks found in xmlXPathCastNumberToBoolean",
42625 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042626 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000042627 printf(" %d", n_val);
42628 printf("\n");
42629 }
42630 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042631 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000042632#endif
42633
Daniel Veillard42595322004-11-08 10:52:06 +000042634 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042635}
42636
42637
42638static int
42639test_xmlXPathCastNumberToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042640 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042641
William M. Brack21e4ef22005-01-02 09:53:13 +000042642#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000042643 int mem_base;
42644 xmlChar * ret_val;
42645 double val; /* a number */
42646 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042647
Daniel Veillard3d95c732004-11-06 22:25:14 +000042648 for (n_val = 0;n_val < gen_nb_double;n_val++) {
42649 mem_base = xmlMemBlocks();
42650 val = gen_double(n_val, 0);
42651
42652 ret_val = xmlXPathCastNumberToString(val);
42653 desret_xmlChar_ptr(ret_val);
42654 call_tests++;
42655 des_double(n_val, val, 0);
42656 xmlResetLastError();
42657 if (mem_base != xmlMemBlocks()) {
42658 printf("Leak of %d blocks found in xmlXPathCastNumberToString",
42659 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042660 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000042661 printf(" %d", n_val);
42662 printf("\n");
42663 }
42664 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042665 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000042666#endif
42667
Daniel Veillard42595322004-11-08 10:52:06 +000042668 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042669}
42670
42671
42672static int
42673test_xmlXPathCastStringToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042674 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042675
William M. Brack21e4ef22005-01-02 09:53:13 +000042676#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000042677 int mem_base;
42678 int ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042679 xmlChar * val; /* a string */
Daniel Veillardd93f6252004-11-02 15:53:51 +000042680 int n_val;
42681
42682 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
42683 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042684 val = gen_const_xmlChar_ptr(n_val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042685
William M. Brackf13f77f2004-11-12 16:03:48 +000042686 ret_val = xmlXPathCastStringToBoolean((const xmlChar *)val);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042687 desret_int(ret_val);
42688 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000042689 des_const_xmlChar_ptr(n_val, (const xmlChar *)val, 0);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042690 xmlResetLastError();
42691 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000042692 printf("Leak of %d blocks found in xmlXPathCastStringToBoolean",
Daniel Veillardd93f6252004-11-02 15:53:51 +000042693 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042694 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000042695 printf(" %d", n_val);
42696 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000042697 }
42698 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042699 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042700#endif
42701
Daniel Veillard42595322004-11-08 10:52:06 +000042702 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042703}
42704
42705
42706static int
42707test_xmlXPathCastStringToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042708 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042709
William M. Brack21e4ef22005-01-02 09:53:13 +000042710#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042711 int mem_base;
42712 double ret_val;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042713 xmlChar * val; /* a string */
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042714 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042715
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042716 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
42717 mem_base = xmlMemBlocks();
42718 val = gen_const_xmlChar_ptr(n_val, 0);
42719
William M. Brackf13f77f2004-11-12 16:03:48 +000042720 ret_val = xmlXPathCastStringToNumber((const xmlChar *)val);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042721 desret_double(ret_val);
42722 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000042723 des_const_xmlChar_ptr(n_val, (const xmlChar *)val, 0);
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042724 xmlResetLastError();
42725 if (mem_base != xmlMemBlocks()) {
42726 printf("Leak of %d blocks found in xmlXPathCastStringToNumber",
42727 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042728 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042729 printf(" %d", n_val);
42730 printf("\n");
42731 }
42732 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042733 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042734#endif
42735
Daniel Veillard42595322004-11-08 10:52:06 +000042736 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042737}
42738
42739
42740static int
42741test_xmlXPathCastToBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042742 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042743
William M. Brack21e4ef22005-01-02 09:53:13 +000042744#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042745 int mem_base;
42746 int ret_val;
42747 xmlXPathObjectPtr val; /* an XPath object */
42748 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042749
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042750 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
42751 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042752 val = gen_xmlXPathObjectPtr(n_val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042753
42754 ret_val = xmlXPathCastToBoolean(val);
42755 desret_int(ret_val);
42756 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042757 des_xmlXPathObjectPtr(n_val, val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042758 xmlResetLastError();
42759 if (mem_base != xmlMemBlocks()) {
42760 printf("Leak of %d blocks found in xmlXPathCastToBoolean",
42761 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042762 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042763 printf(" %d", n_val);
42764 printf("\n");
42765 }
42766 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042767 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042768#endif
42769
Daniel Veillard42595322004-11-08 10:52:06 +000042770 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042771}
42772
42773
42774static int
42775test_xmlXPathCastToNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042776 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042777
William M. Brack21e4ef22005-01-02 09:53:13 +000042778#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042779 int mem_base;
42780 double ret_val;
42781 xmlXPathObjectPtr val; /* an XPath object */
42782 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042783
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042784 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
42785 mem_base = xmlMemBlocks();
42786 val = gen_xmlXPathObjectPtr(n_val, 0);
42787
42788 ret_val = xmlXPathCastToNumber(val);
42789 desret_double(ret_val);
42790 call_tests++;
42791 des_xmlXPathObjectPtr(n_val, val, 0);
42792 xmlResetLastError();
42793 if (mem_base != xmlMemBlocks()) {
42794 printf("Leak of %d blocks found in xmlXPathCastToNumber",
42795 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042796 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042797 printf(" %d", n_val);
42798 printf("\n");
42799 }
42800 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042801 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000042802#endif
42803
Daniel Veillard42595322004-11-08 10:52:06 +000042804 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042805}
42806
42807
42808static int
42809test_xmlXPathCastToString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042810 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042811
William M. Brack21e4ef22005-01-02 09:53:13 +000042812#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042813 int mem_base;
42814 xmlChar * ret_val;
42815 xmlXPathObjectPtr val; /* an XPath object */
42816 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042817
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042818 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
42819 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042820 val = gen_xmlXPathObjectPtr(n_val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042821
42822 ret_val = xmlXPathCastToString(val);
42823 desret_xmlChar_ptr(ret_val);
42824 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042825 des_xmlXPathObjectPtr(n_val, val, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042826 xmlResetLastError();
42827 if (mem_base != xmlMemBlocks()) {
42828 printf("Leak of %d blocks found in xmlXPathCastToString",
42829 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042830 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042831 printf(" %d", n_val);
42832 printf("\n");
42833 }
42834 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042835 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000042836#endif
42837
Daniel Veillard42595322004-11-08 10:52:06 +000042838 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042839}
42840
42841
42842static int
42843test_xmlXPathCmpNodes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042844 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042845
William M. Brack21e4ef22005-01-02 09:53:13 +000042846#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000042847 int mem_base;
42848 int ret_val;
42849 xmlNodePtr node1; /* the first node */
42850 int n_node1;
42851 xmlNodePtr node2; /* the second node */
42852 int n_node2;
42853
42854 for (n_node1 = 0;n_node1 < gen_nb_xmlNodePtr;n_node1++) {
42855 for (n_node2 = 0;n_node2 < gen_nb_xmlNodePtr;n_node2++) {
42856 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000042857 node1 = gen_xmlNodePtr(n_node1, 0);
42858 node2 = gen_xmlNodePtr(n_node2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042859
42860 ret_val = xmlXPathCmpNodes(node1, node2);
42861 desret_int(ret_val);
42862 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042863 des_xmlNodePtr(n_node1, node1, 0);
42864 des_xmlNodePtr(n_node2, node2, 1);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042865 xmlResetLastError();
42866 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000042867 printf("Leak of %d blocks found in xmlXPathCmpNodes",
Daniel Veillardd93f6252004-11-02 15:53:51 +000042868 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042869 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000042870 printf(" %d", n_node1);
42871 printf(" %d", n_node2);
42872 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000042873 }
42874 }
42875 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042876 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042877#endif
42878
Daniel Veillard42595322004-11-08 10:52:06 +000042879 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042880}
42881
42882
42883static int
42884test_xmlXPathCompile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042885 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042886
42887
42888 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000042889 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042890}
42891
Daniel Veillarda521d282004-11-09 14:59:59 +000042892#ifdef LIBXML_XPATH_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000042893
Daniel Veillardce682bc2004-11-05 17:22:25 +000042894#define gen_nb_xmlXPathCompExprPtr 1
42895static xmlXPathCompExprPtr gen_xmlXPathCompExprPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
42896 return(NULL);
42897}
42898static void des_xmlXPathCompExprPtr(int no ATTRIBUTE_UNUSED, xmlXPathCompExprPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
42899}
Daniel Veillarda521d282004-11-09 14:59:59 +000042900#endif
42901
42902#ifdef LIBXML_XPATH_ENABLED
Daniel Veillardce682bc2004-11-05 17:22:25 +000042903
42904#define gen_nb_xmlXPathContextPtr 1
42905static xmlXPathContextPtr gen_xmlXPathContextPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
42906 return(NULL);
42907}
42908static void des_xmlXPathContextPtr(int no ATTRIBUTE_UNUSED, xmlXPathContextPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
42909}
Daniel Veillarda521d282004-11-09 14:59:59 +000042910#endif
42911
Daniel Veillardce682bc2004-11-05 17:22:25 +000042912
Daniel Veillardd93f6252004-11-02 15:53:51 +000042913static int
42914test_xmlXPathCompiledEval(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042915 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042916
William M. Brack21e4ef22005-01-02 09:53:13 +000042917#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000042918 int mem_base;
42919 xmlXPathObjectPtr ret_val;
42920 xmlXPathCompExprPtr comp; /* the compiled XPath expression */
42921 int n_comp;
42922 xmlXPathContextPtr ctx; /* the XPath context */
42923 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042924
Daniel Veillardce682bc2004-11-05 17:22:25 +000042925 for (n_comp = 0;n_comp < gen_nb_xmlXPathCompExprPtr;n_comp++) {
42926 for (n_ctx = 0;n_ctx < gen_nb_xmlXPathContextPtr;n_ctx++) {
42927 mem_base = xmlMemBlocks();
42928 comp = gen_xmlXPathCompExprPtr(n_comp, 0);
42929 ctx = gen_xmlXPathContextPtr(n_ctx, 1);
42930
42931 ret_val = xmlXPathCompiledEval(comp, ctx);
42932 desret_xmlXPathObjectPtr(ret_val);
42933 call_tests++;
42934 des_xmlXPathCompExprPtr(n_comp, comp, 0);
42935 des_xmlXPathContextPtr(n_ctx, ctx, 1);
42936 xmlResetLastError();
42937 if (mem_base != xmlMemBlocks()) {
42938 printf("Leak of %d blocks found in xmlXPathCompiledEval",
42939 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042940 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042941 printf(" %d", n_comp);
42942 printf(" %d", n_ctx);
42943 printf("\n");
42944 }
42945 }
42946 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042947 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000042948#endif
42949
Daniel Veillard42595322004-11-08 10:52:06 +000042950 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042951}
42952
42953
42954static int
42955test_xmlXPathConvertBoolean(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042956 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042957
William M. Brack21e4ef22005-01-02 09:53:13 +000042958#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000042959 int mem_base;
42960 xmlXPathObjectPtr ret_val;
42961 xmlXPathObjectPtr val; /* an XPath object */
42962 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042963
Daniel Veillard3d97e662004-11-04 10:49:00 +000042964 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
42965 mem_base = xmlMemBlocks();
42966 val = gen_xmlXPathObjectPtr(n_val, 0);
42967
42968 ret_val = xmlXPathConvertBoolean(val);
42969 val = NULL;
42970 desret_xmlXPathObjectPtr(ret_val);
42971 call_tests++;
42972 des_xmlXPathObjectPtr(n_val, val, 0);
42973 xmlResetLastError();
42974 if (mem_base != xmlMemBlocks()) {
42975 printf("Leak of %d blocks found in xmlXPathConvertBoolean",
42976 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000042977 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042978 printf(" %d", n_val);
42979 printf("\n");
42980 }
42981 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000042982 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000042983#endif
42984
Daniel Veillard42595322004-11-08 10:52:06 +000042985 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000042986}
42987
42988
42989static int
42990test_xmlXPathConvertNumber(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000042991 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042992
William M. Brack21e4ef22005-01-02 09:53:13 +000042993#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000042994 int mem_base;
42995 xmlXPathObjectPtr ret_val;
42996 xmlXPathObjectPtr val; /* an XPath object */
42997 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000042998
Daniel Veillard3d97e662004-11-04 10:49:00 +000042999 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43000 mem_base = xmlMemBlocks();
43001 val = gen_xmlXPathObjectPtr(n_val, 0);
43002
43003 ret_val = xmlXPathConvertNumber(val);
43004 val = NULL;
43005 desret_xmlXPathObjectPtr(ret_val);
43006 call_tests++;
43007 des_xmlXPathObjectPtr(n_val, val, 0);
43008 xmlResetLastError();
43009 if (mem_base != xmlMemBlocks()) {
43010 printf("Leak of %d blocks found in xmlXPathConvertNumber",
43011 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043012 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043013 printf(" %d", n_val);
43014 printf("\n");
43015 }
43016 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043017 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043018#endif
43019
Daniel Veillard42595322004-11-08 10:52:06 +000043020 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043021}
43022
43023
43024static int
43025test_xmlXPathConvertString(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043026 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043027
William M. Brack21e4ef22005-01-02 09:53:13 +000043028#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000043029 int mem_base;
43030 xmlXPathObjectPtr ret_val;
43031 xmlXPathObjectPtr val; /* an XPath object */
43032 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043033
Daniel Veillard3d97e662004-11-04 10:49:00 +000043034 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43035 mem_base = xmlMemBlocks();
43036 val = gen_xmlXPathObjectPtr(n_val, 0);
43037
43038 ret_val = xmlXPathConvertString(val);
43039 val = NULL;
43040 desret_xmlXPathObjectPtr(ret_val);
43041 call_tests++;
43042 des_xmlXPathObjectPtr(n_val, val, 0);
43043 xmlResetLastError();
43044 if (mem_base != xmlMemBlocks()) {
43045 printf("Leak of %d blocks found in xmlXPathConvertString",
43046 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043047 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043048 printf(" %d", n_val);
43049 printf("\n");
43050 }
43051 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043052 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043053#endif
43054
Daniel Veillard42595322004-11-08 10:52:06 +000043055 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043056}
43057
43058
43059static int
43060test_xmlXPathCtxtCompile(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043061 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043062
43063
43064 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043065 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043066}
43067
43068
43069static int
43070test_xmlXPathEval(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043071 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043072
William M. Brack21e4ef22005-01-02 09:53:13 +000043073#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000043074 int mem_base;
43075 xmlXPathObjectPtr ret_val;
43076 xmlChar * str; /* the XPath expression */
43077 int n_str;
43078 xmlXPathContextPtr ctx; /* the XPath context */
43079 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043080
Daniel Veillardce682bc2004-11-05 17:22:25 +000043081 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
43082 for (n_ctx = 0;n_ctx < gen_nb_xmlXPathContextPtr;n_ctx++) {
43083 mem_base = xmlMemBlocks();
43084 str = gen_const_xmlChar_ptr(n_str, 0);
43085 ctx = gen_xmlXPathContextPtr(n_ctx, 1);
43086
William M. Brackf13f77f2004-11-12 16:03:48 +000043087 ret_val = xmlXPathEval((const xmlChar *)str, ctx);
Daniel Veillardce682bc2004-11-05 17:22:25 +000043088 desret_xmlXPathObjectPtr(ret_val);
43089 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000043090 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000043091 des_xmlXPathContextPtr(n_ctx, ctx, 1);
43092 xmlResetLastError();
43093 if (mem_base != xmlMemBlocks()) {
43094 printf("Leak of %d blocks found in xmlXPathEval",
43095 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043096 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043097 printf(" %d", n_str);
43098 printf(" %d", n_ctx);
43099 printf("\n");
43100 }
43101 }
43102 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043103 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043104#endif
43105
Daniel Veillard42595322004-11-08 10:52:06 +000043106 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043107}
43108
43109
43110static int
43111test_xmlXPathEvalExpression(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043112 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043113
William M. Brack21e4ef22005-01-02 09:53:13 +000043114#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000043115 int mem_base;
43116 xmlXPathObjectPtr ret_val;
43117 xmlChar * str; /* the XPath expression */
43118 int n_str;
43119 xmlXPathContextPtr ctxt; /* the XPath context */
43120 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043121
Daniel Veillardce682bc2004-11-05 17:22:25 +000043122 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
43123 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
43124 mem_base = xmlMemBlocks();
43125 str = gen_const_xmlChar_ptr(n_str, 0);
43126 ctxt = gen_xmlXPathContextPtr(n_ctxt, 1);
43127
William M. Brackf13f77f2004-11-12 16:03:48 +000043128 ret_val = xmlXPathEvalExpression((const xmlChar *)str, ctxt);
Daniel Veillardce682bc2004-11-05 17:22:25 +000043129 desret_xmlXPathObjectPtr(ret_val);
43130 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000043131 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000043132 des_xmlXPathContextPtr(n_ctxt, ctxt, 1);
43133 xmlResetLastError();
43134 if (mem_base != xmlMemBlocks()) {
43135 printf("Leak of %d blocks found in xmlXPathEvalExpression",
43136 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043137 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043138 printf(" %d", n_str);
43139 printf(" %d", n_ctxt);
43140 printf("\n");
43141 }
43142 }
43143 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043144 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043145#endif
43146
Daniel Veillard42595322004-11-08 10:52:06 +000043147 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043148}
43149
43150
43151static int
43152test_xmlXPathEvalPredicate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043153 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043154
William M. Brack21e4ef22005-01-02 09:53:13 +000043155#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000043156 int mem_base;
43157 int ret_val;
43158 xmlXPathContextPtr ctxt; /* the XPath context */
43159 int n_ctxt;
43160 xmlXPathObjectPtr res; /* the Predicate Expression evaluation result */
43161 int n_res;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043162
Daniel Veillardce682bc2004-11-05 17:22:25 +000043163 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
43164 for (n_res = 0;n_res < gen_nb_xmlXPathObjectPtr;n_res++) {
43165 mem_base = xmlMemBlocks();
43166 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
43167 res = gen_xmlXPathObjectPtr(n_res, 1);
43168
43169 ret_val = xmlXPathEvalPredicate(ctxt, res);
43170 desret_int(ret_val);
43171 call_tests++;
43172 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
43173 des_xmlXPathObjectPtr(n_res, res, 1);
43174 xmlResetLastError();
43175 if (mem_base != xmlMemBlocks()) {
43176 printf("Leak of %d blocks found in xmlXPathEvalPredicate",
43177 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043178 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043179 printf(" %d", n_ctxt);
43180 printf(" %d", n_res);
43181 printf("\n");
43182 }
43183 }
43184 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043185 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000043186#endif
43187
Daniel Veillard42595322004-11-08 10:52:06 +000043188 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043189}
43190
43191
43192static int
43193test_xmlXPathInit(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043194 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043195
William M. Brack21e4ef22005-01-02 09:53:13 +000043196#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillardd93f6252004-11-02 15:53:51 +000043197 int mem_base;
43198
43199 mem_base = xmlMemBlocks();
43200
43201 xmlXPathInit();
43202 call_tests++;
43203 xmlResetLastError();
43204 if (mem_base != xmlMemBlocks()) {
Daniel Veillarda03e3652004-11-02 18:45:30 +000043205 printf("Leak of %d blocks found in xmlXPathInit",
Daniel Veillardd93f6252004-11-02 15:53:51 +000043206 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043207 test_ret++;
Daniel Veillarda03e3652004-11-02 18:45:30 +000043208 printf("\n");
Daniel Veillardd93f6252004-11-02 15:53:51 +000043209 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043210 function_tests++;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043211#endif
43212
Daniel Veillard42595322004-11-08 10:52:06 +000043213 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043214}
43215
43216
43217static int
43218test_xmlXPathIsInf(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043219 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043220
William M. Brack21e4ef22005-01-02 09:53:13 +000043221#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000043222 int mem_base;
43223 int ret_val;
43224 double val; /* a double value */
43225 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043226
Daniel Veillard3d95c732004-11-06 22:25:14 +000043227 for (n_val = 0;n_val < gen_nb_double;n_val++) {
43228 mem_base = xmlMemBlocks();
43229 val = gen_double(n_val, 0);
43230
43231 ret_val = xmlXPathIsInf(val);
43232 desret_int(ret_val);
43233 call_tests++;
43234 des_double(n_val, val, 0);
43235 xmlResetLastError();
43236 if (mem_base != xmlMemBlocks()) {
43237 printf("Leak of %d blocks found in xmlXPathIsInf",
43238 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043239 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043240 printf(" %d", n_val);
43241 printf("\n");
43242 }
43243 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043244 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043245#endif
43246
Daniel Veillard42595322004-11-08 10:52:06 +000043247 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043248}
43249
43250
43251static int
43252test_xmlXPathIsNaN(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043253 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043254
William M. Brack21e4ef22005-01-02 09:53:13 +000043255#if defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED)
Daniel Veillard3d95c732004-11-06 22:25:14 +000043256 int mem_base;
43257 int ret_val;
43258 double val; /* a double value */
43259 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043260
Daniel Veillard3d95c732004-11-06 22:25:14 +000043261 for (n_val = 0;n_val < gen_nb_double;n_val++) {
43262 mem_base = xmlMemBlocks();
43263 val = gen_double(n_val, 0);
43264
43265 ret_val = xmlXPathIsNaN(val);
43266 desret_int(ret_val);
43267 call_tests++;
43268 des_double(n_val, val, 0);
43269 xmlResetLastError();
43270 if (mem_base != xmlMemBlocks()) {
43271 printf("Leak of %d blocks found in xmlXPathIsNaN",
43272 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043273 test_ret++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043274 printf(" %d", n_val);
43275 printf("\n");
43276 }
43277 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043278 function_tests++;
Daniel Veillard3d95c732004-11-06 22:25:14 +000043279#endif
43280
Daniel Veillard42595322004-11-08 10:52:06 +000043281 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043282}
43283
43284
43285static int
43286test_xmlXPathNewContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043287 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043288
43289
43290 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000043291 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043292}
43293
43294
43295static int
43296test_xmlXPathNodeSetCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043297 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043298
William M. Brack21e4ef22005-01-02 09:53:13 +000043299#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000043300 int mem_base;
43301 xmlNodeSetPtr ret_val;
43302 xmlNodePtr val; /* an initial xmlNodePtr, or NULL */
43303 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043304
Daniel Veillardf2a36f92004-11-08 17:55:01 +000043305 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
43306 mem_base = xmlMemBlocks();
43307 val = gen_xmlNodePtr(n_val, 0);
43308
43309 ret_val = xmlXPathNodeSetCreate(val);
43310 desret_xmlNodeSetPtr(ret_val);
43311 call_tests++;
43312 des_xmlNodePtr(n_val, val, 0);
43313 xmlResetLastError();
43314 if (mem_base != xmlMemBlocks()) {
43315 printf("Leak of %d blocks found in xmlXPathNodeSetCreate",
43316 xmlMemBlocks() - mem_base);
43317 test_ret++;
43318 printf(" %d", n_val);
43319 printf("\n");
43320 }
43321 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043322 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000043323#endif
43324
Daniel Veillard42595322004-11-08 10:52:06 +000043325 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043326}
43327
43328
43329static int
43330test_xmlXPathObjectCopy(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043331 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043332
William M. Brack21e4ef22005-01-02 09:53:13 +000043333#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000043334 int mem_base;
43335 xmlXPathObjectPtr ret_val;
43336 xmlXPathObjectPtr val; /* the original object */
43337 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043338
Daniel Veillard3d97e662004-11-04 10:49:00 +000043339 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
43340 mem_base = xmlMemBlocks();
43341 val = gen_xmlXPathObjectPtr(n_val, 0);
43342
43343 ret_val = xmlXPathObjectCopy(val);
43344 desret_xmlXPathObjectPtr(ret_val);
43345 call_tests++;
43346 des_xmlXPathObjectPtr(n_val, val, 0);
43347 xmlResetLastError();
43348 if (mem_base != xmlMemBlocks()) {
43349 printf("Leak of %d blocks found in xmlXPathObjectCopy",
43350 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043351 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043352 printf(" %d", n_val);
43353 printf("\n");
43354 }
43355 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043356 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000043357#endif
43358
Daniel Veillard42595322004-11-08 10:52:06 +000043359 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043360}
43361
43362
43363static int
43364test_xmlXPathOrderDocElems(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043365 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043366
William M. Brack21e4ef22005-01-02 09:53:13 +000043367#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043368 int mem_base;
43369 long ret_val;
43370 xmlDocPtr doc; /* an input document */
43371 int n_doc;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043372
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043373 for (n_doc = 0;n_doc < gen_nb_xmlDocPtr;n_doc++) {
43374 mem_base = xmlMemBlocks();
43375 doc = gen_xmlDocPtr(n_doc, 0);
43376
43377 ret_val = xmlXPathOrderDocElems(doc);
43378 desret_long(ret_val);
43379 call_tests++;
43380 des_xmlDocPtr(n_doc, doc, 0);
43381 xmlResetLastError();
43382 if (mem_base != xmlMemBlocks()) {
43383 printf("Leak of %d blocks found in xmlXPathOrderDocElems",
43384 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000043385 test_ret++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043386 printf(" %d", n_doc);
43387 printf("\n");
43388 }
43389 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043390 function_tests++;
Daniel Veillard1ba06bb2004-11-04 12:32:18 +000043391#endif
43392
Daniel Veillard42595322004-11-08 10:52:06 +000043393 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043394}
43395
43396static int
43397test_xpath(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000043398 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000043399
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043400 if (quiet == 0) printf("Testing xpath : 28 of 36 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000043401 test_ret += test_xmlXPathCastBooleanToNumber();
43402 test_ret += test_xmlXPathCastBooleanToString();
43403 test_ret += test_xmlXPathCastNodeSetToBoolean();
43404 test_ret += test_xmlXPathCastNodeSetToNumber();
43405 test_ret += test_xmlXPathCastNodeSetToString();
43406 test_ret += test_xmlXPathCastNodeToNumber();
43407 test_ret += test_xmlXPathCastNodeToString();
43408 test_ret += test_xmlXPathCastNumberToBoolean();
43409 test_ret += test_xmlXPathCastNumberToString();
43410 test_ret += test_xmlXPathCastStringToBoolean();
43411 test_ret += test_xmlXPathCastStringToNumber();
43412 test_ret += test_xmlXPathCastToBoolean();
43413 test_ret += test_xmlXPathCastToNumber();
43414 test_ret += test_xmlXPathCastToString();
43415 test_ret += test_xmlXPathCmpNodes();
43416 test_ret += test_xmlXPathCompile();
43417 test_ret += test_xmlXPathCompiledEval();
43418 test_ret += test_xmlXPathConvertBoolean();
43419 test_ret += test_xmlXPathConvertNumber();
43420 test_ret += test_xmlXPathConvertString();
43421 test_ret += test_xmlXPathCtxtCompile();
43422 test_ret += test_xmlXPathEval();
43423 test_ret += test_xmlXPathEvalExpression();
43424 test_ret += test_xmlXPathEvalPredicate();
43425 test_ret += test_xmlXPathInit();
43426 test_ret += test_xmlXPathIsInf();
43427 test_ret += test_xmlXPathIsNaN();
43428 test_ret += test_xmlXPathNewContext();
43429 test_ret += test_xmlXPathNodeSetCreate();
43430 test_ret += test_xmlXPathObjectCopy();
43431 test_ret += test_xmlXPathOrderDocElems();
Daniel Veillardd93f6252004-11-02 15:53:51 +000043432
Daniel Veillard42595322004-11-08 10:52:06 +000043433 if (test_ret != 0)
43434 printf("Module xpath: %d errors\n", test_ret);
43435 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000043436}
Daniel Veillarda521d282004-11-09 14:59:59 +000043437#ifdef LIBXML_XPATH_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000043438
Daniel Veillarda82b1822004-11-08 16:24:57 +000043439#define gen_nb_xmlXPathParserContextPtr 1
43440static xmlXPathParserContextPtr gen_xmlXPathParserContextPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
43441 return(NULL);
43442}
43443static void des_xmlXPathParserContextPtr(int no ATTRIBUTE_UNUSED, xmlXPathParserContextPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
43444}
Daniel Veillarda521d282004-11-09 14:59:59 +000043445#endif
43446
Daniel Veillarda82b1822004-11-08 16:24:57 +000043447
43448static int
43449test_valuePop(void) {
43450 int test_ret = 0;
43451
William M. Brack21e4ef22005-01-02 09:53:13 +000043452#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000043453 int mem_base;
43454 xmlXPathObjectPtr ret_val;
43455 xmlXPathParserContextPtr ctxt; /* an XPath evaluation context */
43456 int n_ctxt;
43457
43458 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43459 mem_base = xmlMemBlocks();
43460 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43461
43462 ret_val = valuePop(ctxt);
43463 desret_xmlXPathObjectPtr(ret_val);
43464 call_tests++;
43465 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43466 xmlResetLastError();
43467 if (mem_base != xmlMemBlocks()) {
43468 printf("Leak of %d blocks found in valuePop",
43469 xmlMemBlocks() - mem_base);
43470 test_ret++;
43471 printf(" %d", n_ctxt);
43472 printf("\n");
43473 }
43474 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043475 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043476#endif
43477
Daniel Veillarda82b1822004-11-08 16:24:57 +000043478 return(test_ret);
43479}
43480
43481
43482static int
43483test_valuePush(void) {
43484 int test_ret = 0;
43485
William M. Brack21e4ef22005-01-02 09:53:13 +000043486#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000043487 int mem_base;
43488 int ret_val;
43489 xmlXPathParserContextPtr ctxt; /* an XPath evaluation context */
43490 int n_ctxt;
43491 xmlXPathObjectPtr value; /* the XPath object */
43492 int n_value;
43493
43494 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43495 for (n_value = 0;n_value < gen_nb_xmlXPathObjectPtr;n_value++) {
43496 mem_base = xmlMemBlocks();
43497 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43498 value = gen_xmlXPathObjectPtr(n_value, 1);
43499
43500 ret_val = valuePush(ctxt, value);
43501 desret_int(ret_val);
43502 call_tests++;
43503 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43504 des_xmlXPathObjectPtr(n_value, value, 1);
43505 xmlResetLastError();
43506 if (mem_base != xmlMemBlocks()) {
43507 printf("Leak of %d blocks found in valuePush",
43508 xmlMemBlocks() - mem_base);
43509 test_ret++;
43510 printf(" %d", n_ctxt);
43511 printf(" %d", n_value);
43512 printf("\n");
43513 }
43514 }
43515 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043516 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043517#endif
43518
Daniel Veillarda82b1822004-11-08 16:24:57 +000043519 return(test_ret);
43520}
43521
43522
43523static int
43524test_xmlXPathAddValues(void) {
43525 int test_ret = 0;
43526
William M. Brack21e4ef22005-01-02 09:53:13 +000043527#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000043528 int mem_base;
43529 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43530 int n_ctxt;
43531
43532 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43533 mem_base = xmlMemBlocks();
43534 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43535
43536 xmlXPathAddValues(ctxt);
43537 call_tests++;
43538 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43539 xmlResetLastError();
43540 if (mem_base != xmlMemBlocks()) {
43541 printf("Leak of %d blocks found in xmlXPathAddValues",
43542 xmlMemBlocks() - mem_base);
43543 test_ret++;
43544 printf(" %d", n_ctxt);
43545 printf("\n");
43546 }
43547 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043548 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043549#endif
43550
Daniel Veillarda82b1822004-11-08 16:24:57 +000043551 return(test_ret);
43552}
43553
43554
43555static int
43556test_xmlXPathBooleanFunction(void) {
43557 int test_ret = 0;
43558
William M. Brack21e4ef22005-01-02 09:53:13 +000043559#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000043560 int mem_base;
43561 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43562 int n_ctxt;
43563 int nargs; /* the number of arguments */
43564 int n_nargs;
43565
43566 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43567 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
43568 mem_base = xmlMemBlocks();
43569 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43570 nargs = gen_int(n_nargs, 1);
43571
43572 xmlXPathBooleanFunction(ctxt, nargs);
43573 call_tests++;
43574 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43575 des_int(n_nargs, nargs, 1);
43576 xmlResetLastError();
43577 if (mem_base != xmlMemBlocks()) {
43578 printf("Leak of %d blocks found in xmlXPathBooleanFunction",
43579 xmlMemBlocks() - mem_base);
43580 test_ret++;
43581 printf(" %d", n_ctxt);
43582 printf(" %d", n_nargs);
43583 printf("\n");
43584 }
43585 }
43586 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043587 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043588#endif
43589
Daniel Veillarda82b1822004-11-08 16:24:57 +000043590 return(test_ret);
43591}
43592
43593
43594static int
43595test_xmlXPathCeilingFunction(void) {
43596 int test_ret = 0;
43597
William M. Brack21e4ef22005-01-02 09:53:13 +000043598#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000043599 int mem_base;
43600 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43601 int n_ctxt;
43602 int nargs; /* the number of arguments */
43603 int n_nargs;
43604
43605 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43606 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
43607 mem_base = xmlMemBlocks();
43608 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43609 nargs = gen_int(n_nargs, 1);
43610
43611 xmlXPathCeilingFunction(ctxt, nargs);
43612 call_tests++;
43613 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43614 des_int(n_nargs, nargs, 1);
43615 xmlResetLastError();
43616 if (mem_base != xmlMemBlocks()) {
43617 printf("Leak of %d blocks found in xmlXPathCeilingFunction",
43618 xmlMemBlocks() - mem_base);
43619 test_ret++;
43620 printf(" %d", n_ctxt);
43621 printf(" %d", n_nargs);
43622 printf("\n");
43623 }
43624 }
43625 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043626 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043627#endif
43628
Daniel Veillarda82b1822004-11-08 16:24:57 +000043629 return(test_ret);
43630}
43631
43632
43633static int
43634test_xmlXPathCompareValues(void) {
43635 int test_ret = 0;
43636
William M. Brack21e4ef22005-01-02 09:53:13 +000043637#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000043638 int mem_base;
43639 int ret_val;
43640 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43641 int n_ctxt;
43642 int inf; /* less than (1) or greater than (0) */
43643 int n_inf;
43644 int strict; /* is the comparison strict */
43645 int n_strict;
43646
43647 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43648 for (n_inf = 0;n_inf < gen_nb_int;n_inf++) {
43649 for (n_strict = 0;n_strict < gen_nb_int;n_strict++) {
43650 mem_base = xmlMemBlocks();
43651 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43652 inf = gen_int(n_inf, 1);
43653 strict = gen_int(n_strict, 2);
43654
43655 ret_val = xmlXPathCompareValues(ctxt, inf, strict);
43656 desret_int(ret_val);
43657 call_tests++;
43658 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43659 des_int(n_inf, inf, 1);
43660 des_int(n_strict, strict, 2);
43661 xmlResetLastError();
43662 if (mem_base != xmlMemBlocks()) {
43663 printf("Leak of %d blocks found in xmlXPathCompareValues",
43664 xmlMemBlocks() - mem_base);
43665 test_ret++;
43666 printf(" %d", n_ctxt);
43667 printf(" %d", n_inf);
43668 printf(" %d", n_strict);
43669 printf("\n");
43670 }
43671 }
43672 }
43673 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043674 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043675#endif
43676
Daniel Veillarda82b1822004-11-08 16:24:57 +000043677 return(test_ret);
43678}
43679
43680
43681static int
43682test_xmlXPathConcatFunction(void) {
43683 int test_ret = 0;
43684
William M. Brack21e4ef22005-01-02 09:53:13 +000043685#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000043686 int mem_base;
43687 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43688 int n_ctxt;
43689 int nargs; /* the number of arguments */
43690 int n_nargs;
43691
43692 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43693 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
43694 mem_base = xmlMemBlocks();
43695 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43696 nargs = gen_int(n_nargs, 1);
43697
43698 xmlXPathConcatFunction(ctxt, nargs);
43699 call_tests++;
43700 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43701 des_int(n_nargs, nargs, 1);
43702 xmlResetLastError();
43703 if (mem_base != xmlMemBlocks()) {
43704 printf("Leak of %d blocks found in xmlXPathConcatFunction",
43705 xmlMemBlocks() - mem_base);
43706 test_ret++;
43707 printf(" %d", n_ctxt);
43708 printf(" %d", n_nargs);
43709 printf("\n");
43710 }
43711 }
43712 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043713 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043714#endif
43715
Daniel Veillarda82b1822004-11-08 16:24:57 +000043716 return(test_ret);
43717}
43718
43719
43720static int
43721test_xmlXPathContainsFunction(void) {
43722 int test_ret = 0;
43723
William M. Brack21e4ef22005-01-02 09:53:13 +000043724#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000043725 int mem_base;
43726 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43727 int n_ctxt;
43728 int nargs; /* the number of arguments */
43729 int n_nargs;
43730
43731 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43732 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
43733 mem_base = xmlMemBlocks();
43734 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43735 nargs = gen_int(n_nargs, 1);
43736
43737 xmlXPathContainsFunction(ctxt, nargs);
43738 call_tests++;
43739 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43740 des_int(n_nargs, nargs, 1);
43741 xmlResetLastError();
43742 if (mem_base != xmlMemBlocks()) {
43743 printf("Leak of %d blocks found in xmlXPathContainsFunction",
43744 xmlMemBlocks() - mem_base);
43745 test_ret++;
43746 printf(" %d", n_ctxt);
43747 printf(" %d", n_nargs);
43748 printf("\n");
43749 }
43750 }
43751 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043752 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043753#endif
43754
Daniel Veillarda82b1822004-11-08 16:24:57 +000043755 return(test_ret);
43756}
43757
43758
43759static int
43760test_xmlXPathCountFunction(void) {
43761 int test_ret = 0;
43762
William M. Brack21e4ef22005-01-02 09:53:13 +000043763#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000043764 int mem_base;
43765 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
43766 int n_ctxt;
43767 int nargs; /* the number of arguments */
43768 int n_nargs;
43769
43770 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
43771 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
43772 mem_base = xmlMemBlocks();
43773 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
43774 nargs = gen_int(n_nargs, 1);
43775
43776 xmlXPathCountFunction(ctxt, nargs);
43777 call_tests++;
43778 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
43779 des_int(n_nargs, nargs, 1);
43780 xmlResetLastError();
43781 if (mem_base != xmlMemBlocks()) {
43782 printf("Leak of %d blocks found in xmlXPathCountFunction",
43783 xmlMemBlocks() - mem_base);
43784 test_ret++;
43785 printf(" %d", n_ctxt);
43786 printf(" %d", n_nargs);
43787 printf("\n");
43788 }
43789 }
43790 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043791 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043792#endif
43793
Daniel Veillarda82b1822004-11-08 16:24:57 +000043794 return(test_ret);
43795}
43796
43797
43798static int
43799test_xmlXPathDebugDumpCompExpr(void) {
43800 int test_ret = 0;
43801
William M. Brack21e4ef22005-01-02 09:53:13 +000043802#if defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000043803 int mem_base;
43804 FILE * output; /* the FILE * for the output */
43805 int n_output;
43806 xmlXPathCompExprPtr comp; /* the precompiled XPath expression */
43807 int n_comp;
43808 int depth; /* the indentation level. */
43809 int n_depth;
43810
43811 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
43812 for (n_comp = 0;n_comp < gen_nb_xmlXPathCompExprPtr;n_comp++) {
43813 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
43814 mem_base = xmlMemBlocks();
43815 output = gen_FILE_ptr(n_output, 0);
43816 comp = gen_xmlXPathCompExprPtr(n_comp, 1);
43817 depth = gen_int(n_depth, 2);
43818
43819 xmlXPathDebugDumpCompExpr(output, comp, depth);
43820 call_tests++;
43821 des_FILE_ptr(n_output, output, 0);
43822 des_xmlXPathCompExprPtr(n_comp, comp, 1);
43823 des_int(n_depth, depth, 2);
43824 xmlResetLastError();
43825 if (mem_base != xmlMemBlocks()) {
43826 printf("Leak of %d blocks found in xmlXPathDebugDumpCompExpr",
43827 xmlMemBlocks() - mem_base);
43828 test_ret++;
43829 printf(" %d", n_output);
43830 printf(" %d", n_comp);
43831 printf(" %d", n_depth);
43832 printf("\n");
43833 }
43834 }
43835 }
43836 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043837 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043838#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +000043839
Daniel Veillarda82b1822004-11-08 16:24:57 +000043840 return(test_ret);
43841}
43842
43843
43844static int
43845test_xmlXPathDebugDumpObject(void) {
43846 int test_ret = 0;
43847
William M. Brack21e4ef22005-01-02 09:53:13 +000043848#if defined(LIBXML_XPATH_ENABLED) && defined(LIBXML_DEBUG_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000043849 int mem_base;
43850 FILE * output; /* the FILE * to dump the output */
43851 int n_output;
43852 xmlXPathObjectPtr cur; /* the object to inspect */
43853 int n_cur;
43854 int depth; /* indentation level */
43855 int n_depth;
43856
43857 for (n_output = 0;n_output < gen_nb_FILE_ptr;n_output++) {
43858 for (n_cur = 0;n_cur < gen_nb_xmlXPathObjectPtr;n_cur++) {
43859 for (n_depth = 0;n_depth < gen_nb_int;n_depth++) {
43860 mem_base = xmlMemBlocks();
43861 output = gen_FILE_ptr(n_output, 0);
43862 cur = gen_xmlXPathObjectPtr(n_cur, 1);
43863 depth = gen_int(n_depth, 2);
43864
43865 xmlXPathDebugDumpObject(output, cur, depth);
43866 call_tests++;
43867 des_FILE_ptr(n_output, output, 0);
43868 des_xmlXPathObjectPtr(n_cur, cur, 1);
43869 des_int(n_depth, depth, 2);
43870 xmlResetLastError();
43871 if (mem_base != xmlMemBlocks()) {
43872 printf("Leak of %d blocks found in xmlXPathDebugDumpObject",
43873 xmlMemBlocks() - mem_base);
43874 test_ret++;
43875 printf(" %d", n_output);
43876 printf(" %d", n_cur);
43877 printf(" %d", n_depth);
43878 printf("\n");
43879 }
43880 }
43881 }
43882 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043883 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043884#endif
Daniel Veillarda82b1822004-11-08 16:24:57 +000043885
Daniel Veillarda82b1822004-11-08 16:24:57 +000043886 return(test_ret);
43887}
43888
43889
43890static int
43891test_xmlXPathDifference(void) {
43892 int test_ret = 0;
43893
William M. Brack21e4ef22005-01-02 09:53:13 +000043894#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000043895 int mem_base;
43896 xmlNodeSetPtr ret_val;
43897 xmlNodeSetPtr nodes1; /* a node-set */
43898 int n_nodes1;
43899 xmlNodeSetPtr nodes2; /* a node-set */
43900 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043901
Daniel Veillardf2a36f92004-11-08 17:55:01 +000043902 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
43903 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
43904 mem_base = xmlMemBlocks();
43905 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
43906 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
43907
43908 ret_val = xmlXPathDifference(nodes1, nodes2);
43909 desret_xmlNodeSetPtr(ret_val);
43910 call_tests++;
43911 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
43912 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
43913 xmlResetLastError();
43914 if (mem_base != xmlMemBlocks()) {
43915 printf("Leak of %d blocks found in xmlXPathDifference",
43916 xmlMemBlocks() - mem_base);
43917 test_ret++;
43918 printf(" %d", n_nodes1);
43919 printf(" %d", n_nodes2);
43920 printf("\n");
43921 }
43922 }
43923 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043924 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000043925#endif
43926
Daniel Veillarda82b1822004-11-08 16:24:57 +000043927 return(test_ret);
43928}
43929
43930
43931static int
43932test_xmlXPathDistinct(void) {
43933 int test_ret = 0;
43934
William M. Brack21e4ef22005-01-02 09:53:13 +000043935#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000043936 int mem_base;
43937 xmlNodeSetPtr ret_val;
43938 xmlNodeSetPtr nodes; /* a node-set */
43939 int n_nodes;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043940
Daniel Veillardf2a36f92004-11-08 17:55:01 +000043941 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
43942 mem_base = xmlMemBlocks();
43943 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
43944
43945 ret_val = xmlXPathDistinct(nodes);
43946 desret_xmlNodeSetPtr(ret_val);
43947 call_tests++;
43948 des_xmlNodeSetPtr(n_nodes, nodes, 0);
43949 xmlResetLastError();
43950 if (mem_base != xmlMemBlocks()) {
43951 printf("Leak of %d blocks found in xmlXPathDistinct",
43952 xmlMemBlocks() - mem_base);
43953 test_ret++;
43954 printf(" %d", n_nodes);
43955 printf("\n");
43956 }
43957 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043958 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000043959#endif
43960
Daniel Veillarda82b1822004-11-08 16:24:57 +000043961 return(test_ret);
43962}
43963
43964
43965static int
43966test_xmlXPathDistinctSorted(void) {
43967 int test_ret = 0;
43968
William M. Brack21e4ef22005-01-02 09:53:13 +000043969#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000043970 int mem_base;
43971 xmlNodeSetPtr ret_val;
43972 xmlNodeSetPtr nodes; /* a node-set, sorted by document order */
43973 int n_nodes;
Daniel Veillarda82b1822004-11-08 16:24:57 +000043974
Daniel Veillardf2a36f92004-11-08 17:55:01 +000043975 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
43976 mem_base = xmlMemBlocks();
43977 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
43978
43979 ret_val = xmlXPathDistinctSorted(nodes);
43980 desret_xmlNodeSetPtr(ret_val);
43981 call_tests++;
43982 des_xmlNodeSetPtr(n_nodes, nodes, 0);
43983 xmlResetLastError();
43984 if (mem_base != xmlMemBlocks()) {
43985 printf("Leak of %d blocks found in xmlXPathDistinctSorted",
43986 xmlMemBlocks() - mem_base);
43987 test_ret++;
43988 printf(" %d", n_nodes);
43989 printf("\n");
43990 }
43991 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000043992 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000043993#endif
43994
Daniel Veillarda82b1822004-11-08 16:24:57 +000043995 return(test_ret);
43996}
43997
43998
43999static int
44000test_xmlXPathDivValues(void) {
44001 int test_ret = 0;
44002
William M. Brack21e4ef22005-01-02 09:53:13 +000044003#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044004 int mem_base;
44005 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44006 int n_ctxt;
44007
44008 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44009 mem_base = xmlMemBlocks();
44010 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44011
44012 xmlXPathDivValues(ctxt);
44013 call_tests++;
44014 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44015 xmlResetLastError();
44016 if (mem_base != xmlMemBlocks()) {
44017 printf("Leak of %d blocks found in xmlXPathDivValues",
44018 xmlMemBlocks() - mem_base);
44019 test_ret++;
44020 printf(" %d", n_ctxt);
44021 printf("\n");
44022 }
44023 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044024 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044025#endif
44026
Daniel Veillarda82b1822004-11-08 16:24:57 +000044027 return(test_ret);
44028}
44029
44030
44031static int
44032test_xmlXPathEqualValues(void) {
44033 int test_ret = 0;
44034
William M. Brack21e4ef22005-01-02 09:53:13 +000044035#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044036 int mem_base;
44037 int ret_val;
44038 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44039 int n_ctxt;
44040
44041 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44042 mem_base = xmlMemBlocks();
44043 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44044
44045 ret_val = xmlXPathEqualValues(ctxt);
44046 desret_int(ret_val);
44047 call_tests++;
44048 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44049 xmlResetLastError();
44050 if (mem_base != xmlMemBlocks()) {
44051 printf("Leak of %d blocks found in xmlXPathEqualValues",
44052 xmlMemBlocks() - mem_base);
44053 test_ret++;
44054 printf(" %d", n_ctxt);
44055 printf("\n");
44056 }
44057 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044058 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044059#endif
44060
Daniel Veillarda82b1822004-11-08 16:24:57 +000044061 return(test_ret);
44062}
44063
44064
44065static int
44066test_xmlXPathErr(void) {
44067 int test_ret = 0;
44068
William M. Brack21e4ef22005-01-02 09:53:13 +000044069#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044070 int mem_base;
44071 xmlXPathParserContextPtr ctxt; /* a XPath parser context */
44072 int n_ctxt;
44073 int error; /* the error code */
44074 int n_error;
44075
44076 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44077 for (n_error = 0;n_error < gen_nb_int;n_error++) {
44078 mem_base = xmlMemBlocks();
44079 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44080 error = gen_int(n_error, 1);
44081
44082 xmlXPathErr(ctxt, error);
44083 call_tests++;
44084 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44085 des_int(n_error, error, 1);
44086 xmlResetLastError();
44087 if (mem_base != xmlMemBlocks()) {
44088 printf("Leak of %d blocks found in xmlXPathErr",
44089 xmlMemBlocks() - mem_base);
44090 test_ret++;
44091 printf(" %d", n_ctxt);
44092 printf(" %d", n_error);
44093 printf("\n");
44094 }
44095 }
44096 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044097 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044098#endif
44099
Daniel Veillarda82b1822004-11-08 16:24:57 +000044100 return(test_ret);
44101}
44102
44103
44104static int
44105test_xmlXPathEvalExpr(void) {
44106 int test_ret = 0;
44107
William M. Brack21e4ef22005-01-02 09:53:13 +000044108#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044109 int mem_base;
44110 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44111 int n_ctxt;
44112
44113 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44114 mem_base = xmlMemBlocks();
44115 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44116
44117 xmlXPathEvalExpr(ctxt);
44118 call_tests++;
44119 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44120 xmlResetLastError();
44121 if (mem_base != xmlMemBlocks()) {
44122 printf("Leak of %d blocks found in xmlXPathEvalExpr",
44123 xmlMemBlocks() - mem_base);
44124 test_ret++;
44125 printf(" %d", n_ctxt);
44126 printf("\n");
44127 }
44128 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044129 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044130#endif
44131
Daniel Veillarda82b1822004-11-08 16:24:57 +000044132 return(test_ret);
44133}
44134
44135
44136static int
44137test_xmlXPathEvaluatePredicateResult(void) {
44138 int test_ret = 0;
44139
William M. Brack21e4ef22005-01-02 09:53:13 +000044140#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044141 int mem_base;
44142 int ret_val;
44143 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44144 int n_ctxt;
44145 xmlXPathObjectPtr res; /* the Predicate Expression evaluation result */
44146 int n_res;
44147
44148 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44149 for (n_res = 0;n_res < gen_nb_xmlXPathObjectPtr;n_res++) {
44150 mem_base = xmlMemBlocks();
44151 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44152 res = gen_xmlXPathObjectPtr(n_res, 1);
44153
44154 ret_val = xmlXPathEvaluatePredicateResult(ctxt, res);
44155 desret_int(ret_val);
44156 call_tests++;
44157 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44158 des_xmlXPathObjectPtr(n_res, res, 1);
44159 xmlResetLastError();
44160 if (mem_base != xmlMemBlocks()) {
44161 printf("Leak of %d blocks found in xmlXPathEvaluatePredicateResult",
44162 xmlMemBlocks() - mem_base);
44163 test_ret++;
44164 printf(" %d", n_ctxt);
44165 printf(" %d", n_res);
44166 printf("\n");
44167 }
44168 }
44169 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044170 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044171#endif
44172
Daniel Veillarda82b1822004-11-08 16:24:57 +000044173 return(test_ret);
44174}
44175
44176
44177static int
44178test_xmlXPathFalseFunction(void) {
44179 int test_ret = 0;
44180
William M. Brack21e4ef22005-01-02 09:53:13 +000044181#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044182 int mem_base;
44183 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44184 int n_ctxt;
44185 int nargs; /* the number of arguments */
44186 int n_nargs;
44187
44188 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44189 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44190 mem_base = xmlMemBlocks();
44191 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44192 nargs = gen_int(n_nargs, 1);
44193
44194 xmlXPathFalseFunction(ctxt, nargs);
44195 call_tests++;
44196 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44197 des_int(n_nargs, nargs, 1);
44198 xmlResetLastError();
44199 if (mem_base != xmlMemBlocks()) {
44200 printf("Leak of %d blocks found in xmlXPathFalseFunction",
44201 xmlMemBlocks() - mem_base);
44202 test_ret++;
44203 printf(" %d", n_ctxt);
44204 printf(" %d", n_nargs);
44205 printf("\n");
44206 }
44207 }
44208 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044209 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044210#endif
44211
Daniel Veillarda82b1822004-11-08 16:24:57 +000044212 return(test_ret);
44213}
44214
44215
44216static int
44217test_xmlXPathFloorFunction(void) {
44218 int test_ret = 0;
44219
William M. Brack21e4ef22005-01-02 09:53:13 +000044220#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044221 int mem_base;
44222 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44223 int n_ctxt;
44224 int nargs; /* the number of arguments */
44225 int n_nargs;
44226
44227 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44228 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44229 mem_base = xmlMemBlocks();
44230 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44231 nargs = gen_int(n_nargs, 1);
44232
44233 xmlXPathFloorFunction(ctxt, nargs);
44234 call_tests++;
44235 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44236 des_int(n_nargs, nargs, 1);
44237 xmlResetLastError();
44238 if (mem_base != xmlMemBlocks()) {
44239 printf("Leak of %d blocks found in xmlXPathFloorFunction",
44240 xmlMemBlocks() - mem_base);
44241 test_ret++;
44242 printf(" %d", n_ctxt);
44243 printf(" %d", n_nargs);
44244 printf("\n");
44245 }
44246 }
44247 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044248 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044249#endif
44250
Daniel Veillarda82b1822004-11-08 16:24:57 +000044251 return(test_ret);
44252}
44253
44254
44255static int
44256test_xmlXPathFunctionLookup(void) {
44257 int test_ret = 0;
44258
44259
44260 /* missing type support */
44261 return(test_ret);
44262}
44263
44264
44265static int
44266test_xmlXPathFunctionLookupNS(void) {
44267 int test_ret = 0;
44268
44269
44270 /* missing type support */
44271 return(test_ret);
44272}
44273
44274
44275static int
44276test_xmlXPathHasSameNodes(void) {
44277 int test_ret = 0;
44278
William M. Brack21e4ef22005-01-02 09:53:13 +000044279#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044280 int mem_base;
44281 int ret_val;
44282 xmlNodeSetPtr nodes1; /* a node-set */
44283 int n_nodes1;
44284 xmlNodeSetPtr nodes2; /* a node-set */
44285 int n_nodes2;
44286
44287 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
44288 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
44289 mem_base = xmlMemBlocks();
44290 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
44291 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
44292
44293 ret_val = xmlXPathHasSameNodes(nodes1, nodes2);
44294 desret_int(ret_val);
44295 call_tests++;
44296 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
44297 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
44298 xmlResetLastError();
44299 if (mem_base != xmlMemBlocks()) {
44300 printf("Leak of %d blocks found in xmlXPathHasSameNodes",
44301 xmlMemBlocks() - mem_base);
44302 test_ret++;
44303 printf(" %d", n_nodes1);
44304 printf(" %d", n_nodes2);
44305 printf("\n");
44306 }
44307 }
44308 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044309 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044310#endif
44311
Daniel Veillarda82b1822004-11-08 16:24:57 +000044312 return(test_ret);
44313}
44314
44315
44316static int
44317test_xmlXPathIdFunction(void) {
44318 int test_ret = 0;
44319
William M. Brack21e4ef22005-01-02 09:53:13 +000044320#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044321 int mem_base;
44322 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44323 int n_ctxt;
44324 int nargs; /* the number of arguments */
44325 int n_nargs;
44326
44327 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44328 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44329 mem_base = xmlMemBlocks();
44330 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44331 nargs = gen_int(n_nargs, 1);
44332
44333 xmlXPathIdFunction(ctxt, nargs);
44334 call_tests++;
44335 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44336 des_int(n_nargs, nargs, 1);
44337 xmlResetLastError();
44338 if (mem_base != xmlMemBlocks()) {
44339 printf("Leak of %d blocks found in xmlXPathIdFunction",
44340 xmlMemBlocks() - mem_base);
44341 test_ret++;
44342 printf(" %d", n_ctxt);
44343 printf(" %d", n_nargs);
44344 printf("\n");
44345 }
44346 }
44347 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044348 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044349#endif
44350
Daniel Veillarda82b1822004-11-08 16:24:57 +000044351 return(test_ret);
44352}
44353
44354
44355static int
44356test_xmlXPathIntersection(void) {
44357 int test_ret = 0;
44358
William M. Brack21e4ef22005-01-02 09:53:13 +000044359#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044360 int mem_base;
44361 xmlNodeSetPtr ret_val;
44362 xmlNodeSetPtr nodes1; /* a node-set */
44363 int n_nodes1;
44364 xmlNodeSetPtr nodes2; /* a node-set */
44365 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044366
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044367 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
44368 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
44369 mem_base = xmlMemBlocks();
44370 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
44371 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
44372
44373 ret_val = xmlXPathIntersection(nodes1, nodes2);
44374 desret_xmlNodeSetPtr(ret_val);
44375 call_tests++;
44376 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
44377 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
44378 xmlResetLastError();
44379 if (mem_base != xmlMemBlocks()) {
44380 printf("Leak of %d blocks found in xmlXPathIntersection",
44381 xmlMemBlocks() - mem_base);
44382 test_ret++;
44383 printf(" %d", n_nodes1);
44384 printf(" %d", n_nodes2);
44385 printf("\n");
44386 }
44387 }
44388 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044389 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044390#endif
44391
Daniel Veillarda82b1822004-11-08 16:24:57 +000044392 return(test_ret);
44393}
44394
44395
44396static int
44397test_xmlXPathIsNodeType(void) {
44398 int test_ret = 0;
44399
William M. Brack21e4ef22005-01-02 09:53:13 +000044400#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044401 int mem_base;
44402 int ret_val;
44403 xmlChar * name; /* a name string */
44404 int n_name;
44405
44406 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
44407 mem_base = xmlMemBlocks();
44408 name = gen_const_xmlChar_ptr(n_name, 0);
44409
William M. Brackf13f77f2004-11-12 16:03:48 +000044410 ret_val = xmlXPathIsNodeType((const xmlChar *)name);
Daniel Veillarda82b1822004-11-08 16:24:57 +000044411 desret_int(ret_val);
44412 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000044413 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 0);
Daniel Veillarda82b1822004-11-08 16:24:57 +000044414 xmlResetLastError();
44415 if (mem_base != xmlMemBlocks()) {
44416 printf("Leak of %d blocks found in xmlXPathIsNodeType",
44417 xmlMemBlocks() - mem_base);
44418 test_ret++;
44419 printf(" %d", n_name);
44420 printf("\n");
44421 }
44422 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044423 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044424#endif
44425
Daniel Veillarda82b1822004-11-08 16:24:57 +000044426 return(test_ret);
44427}
44428
44429
44430static int
44431test_xmlXPathLangFunction(void) {
44432 int test_ret = 0;
44433
William M. Brack21e4ef22005-01-02 09:53:13 +000044434#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044435 int mem_base;
44436 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44437 int n_ctxt;
44438 int nargs; /* the number of arguments */
44439 int n_nargs;
44440
44441 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44442 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44443 mem_base = xmlMemBlocks();
44444 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44445 nargs = gen_int(n_nargs, 1);
44446
44447 xmlXPathLangFunction(ctxt, nargs);
44448 call_tests++;
44449 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44450 des_int(n_nargs, nargs, 1);
44451 xmlResetLastError();
44452 if (mem_base != xmlMemBlocks()) {
44453 printf("Leak of %d blocks found in xmlXPathLangFunction",
44454 xmlMemBlocks() - mem_base);
44455 test_ret++;
44456 printf(" %d", n_ctxt);
44457 printf(" %d", n_nargs);
44458 printf("\n");
44459 }
44460 }
44461 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044462 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044463#endif
44464
Daniel Veillarda82b1822004-11-08 16:24:57 +000044465 return(test_ret);
44466}
44467
44468
44469static int
44470test_xmlXPathLastFunction(void) {
44471 int test_ret = 0;
44472
William M. Brack21e4ef22005-01-02 09:53:13 +000044473#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044474 int mem_base;
44475 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44476 int n_ctxt;
44477 int nargs; /* the number of arguments */
44478 int n_nargs;
44479
44480 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44481 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44482 mem_base = xmlMemBlocks();
44483 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44484 nargs = gen_int(n_nargs, 1);
44485
44486 xmlXPathLastFunction(ctxt, nargs);
44487 call_tests++;
44488 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44489 des_int(n_nargs, nargs, 1);
44490 xmlResetLastError();
44491 if (mem_base != xmlMemBlocks()) {
44492 printf("Leak of %d blocks found in xmlXPathLastFunction",
44493 xmlMemBlocks() - mem_base);
44494 test_ret++;
44495 printf(" %d", n_ctxt);
44496 printf(" %d", n_nargs);
44497 printf("\n");
44498 }
44499 }
44500 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044501 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044502#endif
44503
Daniel Veillarda82b1822004-11-08 16:24:57 +000044504 return(test_ret);
44505}
44506
44507
44508static int
44509test_xmlXPathLeading(void) {
44510 int test_ret = 0;
44511
William M. Brack21e4ef22005-01-02 09:53:13 +000044512#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044513 int mem_base;
44514 xmlNodeSetPtr ret_val;
44515 xmlNodeSetPtr nodes1; /* a node-set */
44516 int n_nodes1;
44517 xmlNodeSetPtr nodes2; /* a node-set */
44518 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044519
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044520 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
44521 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
44522 mem_base = xmlMemBlocks();
44523 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
44524 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
44525
44526 ret_val = xmlXPathLeading(nodes1, nodes2);
44527 desret_xmlNodeSetPtr(ret_val);
44528 call_tests++;
44529 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
44530 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
44531 xmlResetLastError();
44532 if (mem_base != xmlMemBlocks()) {
44533 printf("Leak of %d blocks found in xmlXPathLeading",
44534 xmlMemBlocks() - mem_base);
44535 test_ret++;
44536 printf(" %d", n_nodes1);
44537 printf(" %d", n_nodes2);
44538 printf("\n");
44539 }
44540 }
44541 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044542 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044543#endif
44544
Daniel Veillarda82b1822004-11-08 16:24:57 +000044545 return(test_ret);
44546}
44547
44548
44549static int
44550test_xmlXPathLeadingSorted(void) {
44551 int test_ret = 0;
44552
William M. Brack21e4ef22005-01-02 09:53:13 +000044553#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044554 int mem_base;
44555 xmlNodeSetPtr ret_val;
44556 xmlNodeSetPtr nodes1; /* a node-set, sorted by document order */
44557 int n_nodes1;
44558 xmlNodeSetPtr nodes2; /* a node-set, sorted by document order */
44559 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044560
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044561 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
44562 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
44563 mem_base = xmlMemBlocks();
44564 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
44565 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
44566
44567 ret_val = xmlXPathLeadingSorted(nodes1, nodes2);
44568 desret_xmlNodeSetPtr(ret_val);
44569 call_tests++;
44570 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
44571 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
44572 xmlResetLastError();
44573 if (mem_base != xmlMemBlocks()) {
44574 printf("Leak of %d blocks found in xmlXPathLeadingSorted",
44575 xmlMemBlocks() - mem_base);
44576 test_ret++;
44577 printf(" %d", n_nodes1);
44578 printf(" %d", n_nodes2);
44579 printf("\n");
44580 }
44581 }
44582 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044583 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000044584#endif
44585
Daniel Veillarda82b1822004-11-08 16:24:57 +000044586 return(test_ret);
44587}
44588
44589
44590static int
44591test_xmlXPathLocalNameFunction(void) {
44592 int test_ret = 0;
44593
William M. Brack21e4ef22005-01-02 09:53:13 +000044594#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044595 int mem_base;
44596 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44597 int n_ctxt;
44598 int nargs; /* the number of arguments */
44599 int n_nargs;
44600
44601 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44602 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44603 mem_base = xmlMemBlocks();
44604 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44605 nargs = gen_int(n_nargs, 1);
44606
44607 xmlXPathLocalNameFunction(ctxt, nargs);
44608 call_tests++;
44609 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44610 des_int(n_nargs, nargs, 1);
44611 xmlResetLastError();
44612 if (mem_base != xmlMemBlocks()) {
44613 printf("Leak of %d blocks found in xmlXPathLocalNameFunction",
44614 xmlMemBlocks() - mem_base);
44615 test_ret++;
44616 printf(" %d", n_ctxt);
44617 printf(" %d", n_nargs);
44618 printf("\n");
44619 }
44620 }
44621 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044622 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044623#endif
44624
Daniel Veillarda82b1822004-11-08 16:24:57 +000044625 return(test_ret);
44626}
44627
44628
44629static int
44630test_xmlXPathModValues(void) {
44631 int test_ret = 0;
44632
William M. Brack21e4ef22005-01-02 09:53:13 +000044633#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044634 int mem_base;
44635 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44636 int n_ctxt;
44637
44638 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44639 mem_base = xmlMemBlocks();
44640 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44641
44642 xmlXPathModValues(ctxt);
44643 call_tests++;
44644 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44645 xmlResetLastError();
44646 if (mem_base != xmlMemBlocks()) {
44647 printf("Leak of %d blocks found in xmlXPathModValues",
44648 xmlMemBlocks() - mem_base);
44649 test_ret++;
44650 printf(" %d", n_ctxt);
44651 printf("\n");
44652 }
44653 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044654 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044655#endif
44656
Daniel Veillarda82b1822004-11-08 16:24:57 +000044657 return(test_ret);
44658}
44659
44660
44661static int
44662test_xmlXPathMultValues(void) {
44663 int test_ret = 0;
44664
William M. Brack21e4ef22005-01-02 09:53:13 +000044665#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044666 int mem_base;
44667 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44668 int n_ctxt;
44669
44670 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44671 mem_base = xmlMemBlocks();
44672 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44673
44674 xmlXPathMultValues(ctxt);
44675 call_tests++;
44676 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44677 xmlResetLastError();
44678 if (mem_base != xmlMemBlocks()) {
44679 printf("Leak of %d blocks found in xmlXPathMultValues",
44680 xmlMemBlocks() - mem_base);
44681 test_ret++;
44682 printf(" %d", n_ctxt);
44683 printf("\n");
44684 }
44685 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044686 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044687#endif
44688
Daniel Veillarda82b1822004-11-08 16:24:57 +000044689 return(test_ret);
44690}
44691
44692
44693static int
44694test_xmlXPathNamespaceURIFunction(void) {
44695 int test_ret = 0;
44696
William M. Brack21e4ef22005-01-02 09:53:13 +000044697#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044698 int mem_base;
44699 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44700 int n_ctxt;
44701 int nargs; /* the number of arguments */
44702 int n_nargs;
44703
44704 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44705 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
44706 mem_base = xmlMemBlocks();
44707 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44708 nargs = gen_int(n_nargs, 1);
44709
44710 xmlXPathNamespaceURIFunction(ctxt, nargs);
44711 call_tests++;
44712 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44713 des_int(n_nargs, nargs, 1);
44714 xmlResetLastError();
44715 if (mem_base != xmlMemBlocks()) {
44716 printf("Leak of %d blocks found in xmlXPathNamespaceURIFunction",
44717 xmlMemBlocks() - mem_base);
44718 test_ret++;
44719 printf(" %d", n_ctxt);
44720 printf(" %d", n_nargs);
44721 printf("\n");
44722 }
44723 }
44724 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044725 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044726#endif
44727
Daniel Veillarda82b1822004-11-08 16:24:57 +000044728 return(test_ret);
44729}
44730
44731
44732static int
44733test_xmlXPathNewBoolean(void) {
44734 int test_ret = 0;
44735
William M. Brack21e4ef22005-01-02 09:53:13 +000044736#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044737 int mem_base;
44738 xmlXPathObjectPtr ret_val;
44739 int val; /* the boolean value */
44740 int n_val;
44741
44742 for (n_val = 0;n_val < gen_nb_int;n_val++) {
44743 mem_base = xmlMemBlocks();
44744 val = gen_int(n_val, 0);
44745
44746 ret_val = xmlXPathNewBoolean(val);
44747 desret_xmlXPathObjectPtr(ret_val);
44748 call_tests++;
44749 des_int(n_val, val, 0);
44750 xmlResetLastError();
44751 if (mem_base != xmlMemBlocks()) {
44752 printf("Leak of %d blocks found in xmlXPathNewBoolean",
44753 xmlMemBlocks() - mem_base);
44754 test_ret++;
44755 printf(" %d", n_val);
44756 printf("\n");
44757 }
44758 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044759 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044760#endif
44761
Daniel Veillarda82b1822004-11-08 16:24:57 +000044762 return(test_ret);
44763}
44764
44765
44766static int
44767test_xmlXPathNewCString(void) {
44768 int test_ret = 0;
44769
William M. Brack21e4ef22005-01-02 09:53:13 +000044770#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044771 int mem_base;
44772 xmlXPathObjectPtr ret_val;
44773 char * val; /* the char * value */
44774 int n_val;
44775
44776 for (n_val = 0;n_val < gen_nb_const_char_ptr;n_val++) {
44777 mem_base = xmlMemBlocks();
44778 val = gen_const_char_ptr(n_val, 0);
44779
William M. Brackf13f77f2004-11-12 16:03:48 +000044780 ret_val = xmlXPathNewCString((const char *)val);
Daniel Veillarda82b1822004-11-08 16:24:57 +000044781 desret_xmlXPathObjectPtr(ret_val);
44782 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000044783 des_const_char_ptr(n_val, (const char *)val, 0);
Daniel Veillarda82b1822004-11-08 16:24:57 +000044784 xmlResetLastError();
44785 if (mem_base != xmlMemBlocks()) {
44786 printf("Leak of %d blocks found in xmlXPathNewCString",
44787 xmlMemBlocks() - mem_base);
44788 test_ret++;
44789 printf(" %d", n_val);
44790 printf("\n");
44791 }
44792 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044793 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044794#endif
44795
Daniel Veillarda82b1822004-11-08 16:24:57 +000044796 return(test_ret);
44797}
44798
44799
44800static int
44801test_xmlXPathNewFloat(void) {
44802 int test_ret = 0;
44803
William M. Brack21e4ef22005-01-02 09:53:13 +000044804#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044805 int mem_base;
44806 xmlXPathObjectPtr ret_val;
44807 double val; /* the double value */
44808 int n_val;
44809
44810 for (n_val = 0;n_val < gen_nb_double;n_val++) {
44811 mem_base = xmlMemBlocks();
44812 val = gen_double(n_val, 0);
44813
44814 ret_val = xmlXPathNewFloat(val);
44815 desret_xmlXPathObjectPtr(ret_val);
44816 call_tests++;
44817 des_double(n_val, val, 0);
44818 xmlResetLastError();
44819 if (mem_base != xmlMemBlocks()) {
44820 printf("Leak of %d blocks found in xmlXPathNewFloat",
44821 xmlMemBlocks() - mem_base);
44822 test_ret++;
44823 printf(" %d", n_val);
44824 printf("\n");
44825 }
44826 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044827 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044828#endif
44829
Daniel Veillarda82b1822004-11-08 16:24:57 +000044830 return(test_ret);
44831}
44832
44833
44834static int
44835test_xmlXPathNewNodeSet(void) {
44836 int test_ret = 0;
44837
William M. Brack21e4ef22005-01-02 09:53:13 +000044838#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044839 int mem_base;
44840 xmlXPathObjectPtr ret_val;
44841 xmlNodePtr val; /* the NodePtr value */
44842 int n_val;
44843
44844 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
44845 mem_base = xmlMemBlocks();
44846 val = gen_xmlNodePtr(n_val, 0);
44847
44848 ret_val = xmlXPathNewNodeSet(val);
44849 desret_xmlXPathObjectPtr(ret_val);
44850 call_tests++;
44851 des_xmlNodePtr(n_val, val, 0);
44852 xmlResetLastError();
44853 if (mem_base != xmlMemBlocks()) {
44854 printf("Leak of %d blocks found in xmlXPathNewNodeSet",
44855 xmlMemBlocks() - mem_base);
44856 test_ret++;
44857 printf(" %d", n_val);
44858 printf("\n");
44859 }
44860 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044861 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044862#endif
44863
Daniel Veillarda82b1822004-11-08 16:24:57 +000044864 return(test_ret);
44865}
44866
44867
44868static int
44869test_xmlXPathNewNodeSetList(void) {
44870 int test_ret = 0;
44871
William M. Brack21e4ef22005-01-02 09:53:13 +000044872#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044873 int mem_base;
44874 xmlXPathObjectPtr ret_val;
44875 xmlNodeSetPtr val; /* an existing NodeSet */
44876 int n_val;
44877
44878 for (n_val = 0;n_val < gen_nb_xmlNodeSetPtr;n_val++) {
44879 mem_base = xmlMemBlocks();
44880 val = gen_xmlNodeSetPtr(n_val, 0);
44881
44882 ret_val = xmlXPathNewNodeSetList(val);
44883 desret_xmlXPathObjectPtr(ret_val);
44884 call_tests++;
44885 des_xmlNodeSetPtr(n_val, val, 0);
44886 xmlResetLastError();
44887 if (mem_base != xmlMemBlocks()) {
44888 printf("Leak of %d blocks found in xmlXPathNewNodeSetList",
44889 xmlMemBlocks() - mem_base);
44890 test_ret++;
44891 printf(" %d", n_val);
44892 printf("\n");
44893 }
44894 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044895 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044896#endif
44897
Daniel Veillarda82b1822004-11-08 16:24:57 +000044898 return(test_ret);
44899}
44900
44901
44902static int
44903test_xmlXPathNewParserContext(void) {
44904 int test_ret = 0;
44905
44906
44907 /* missing type support */
44908 return(test_ret);
44909}
44910
44911
44912static int
44913test_xmlXPathNewString(void) {
44914 int test_ret = 0;
44915
William M. Brack21e4ef22005-01-02 09:53:13 +000044916#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044917 int mem_base;
44918 xmlXPathObjectPtr ret_val;
44919 xmlChar * val; /* the xmlChar * value */
44920 int n_val;
44921
44922 for (n_val = 0;n_val < gen_nb_const_xmlChar_ptr;n_val++) {
44923 mem_base = xmlMemBlocks();
44924 val = gen_const_xmlChar_ptr(n_val, 0);
44925
William M. Brackf13f77f2004-11-12 16:03:48 +000044926 ret_val = xmlXPathNewString((const xmlChar *)val);
Daniel Veillarda82b1822004-11-08 16:24:57 +000044927 desret_xmlXPathObjectPtr(ret_val);
44928 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000044929 des_const_xmlChar_ptr(n_val, (const xmlChar *)val, 0);
Daniel Veillarda82b1822004-11-08 16:24:57 +000044930 xmlResetLastError();
44931 if (mem_base != xmlMemBlocks()) {
44932 printf("Leak of %d blocks found in xmlXPathNewString",
44933 xmlMemBlocks() - mem_base);
44934 test_ret++;
44935 printf(" %d", n_val);
44936 printf("\n");
44937 }
44938 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044939 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044940#endif
44941
Daniel Veillarda82b1822004-11-08 16:24:57 +000044942 return(test_ret);
44943}
44944
44945
44946static int
44947test_xmlXPathNextAncestor(void) {
44948 int test_ret = 0;
44949
William M. Brack21e4ef22005-01-02 09:53:13 +000044950#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044951 int mem_base;
44952 xmlNodePtr ret_val;
44953 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44954 int n_ctxt;
44955 xmlNodePtr cur; /* the current node in the traversal */
44956 int n_cur;
44957
44958 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
44959 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
44960 mem_base = xmlMemBlocks();
44961 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
44962 cur = gen_xmlNodePtr(n_cur, 1);
44963
44964 ret_val = xmlXPathNextAncestor(ctxt, cur);
44965 desret_xmlNodePtr(ret_val);
44966 call_tests++;
44967 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
44968 des_xmlNodePtr(n_cur, cur, 1);
44969 xmlResetLastError();
44970 if (mem_base != xmlMemBlocks()) {
44971 printf("Leak of %d blocks found in xmlXPathNextAncestor",
44972 xmlMemBlocks() - mem_base);
44973 test_ret++;
44974 printf(" %d", n_ctxt);
44975 printf(" %d", n_cur);
44976 printf("\n");
44977 }
44978 }
44979 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000044980 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000044981#endif
44982
Daniel Veillarda82b1822004-11-08 16:24:57 +000044983 return(test_ret);
44984}
44985
44986
44987static int
44988test_xmlXPathNextAncestorOrSelf(void) {
44989 int test_ret = 0;
44990
William M. Brack21e4ef22005-01-02 09:53:13 +000044991#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000044992 int mem_base;
44993 xmlNodePtr ret_val;
44994 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
44995 int n_ctxt;
44996 xmlNodePtr cur; /* the current node in the traversal */
44997 int n_cur;
44998
44999 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45000 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45001 mem_base = xmlMemBlocks();
45002 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45003 cur = gen_xmlNodePtr(n_cur, 1);
45004
45005 ret_val = xmlXPathNextAncestorOrSelf(ctxt, cur);
45006 desret_xmlNodePtr(ret_val);
45007 call_tests++;
45008 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45009 des_xmlNodePtr(n_cur, cur, 1);
45010 xmlResetLastError();
45011 if (mem_base != xmlMemBlocks()) {
45012 printf("Leak of %d blocks found in xmlXPathNextAncestorOrSelf",
45013 xmlMemBlocks() - mem_base);
45014 test_ret++;
45015 printf(" %d", n_ctxt);
45016 printf(" %d", n_cur);
45017 printf("\n");
45018 }
45019 }
45020 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045021 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045022#endif
45023
Daniel Veillarda82b1822004-11-08 16:24:57 +000045024 return(test_ret);
45025}
45026
45027
45028static int
45029test_xmlXPathNextAttribute(void) {
45030 int test_ret = 0;
45031
William M. Brack21e4ef22005-01-02 09:53:13 +000045032#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045033 int mem_base;
45034 xmlNodePtr ret_val;
45035 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45036 int n_ctxt;
45037 xmlNodePtr cur; /* the current attribute in the traversal */
45038 int n_cur;
45039
45040 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45041 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45042 mem_base = xmlMemBlocks();
45043 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45044 cur = gen_xmlNodePtr(n_cur, 1);
45045
45046 ret_val = xmlXPathNextAttribute(ctxt, cur);
45047 desret_xmlNodePtr(ret_val);
45048 call_tests++;
45049 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45050 des_xmlNodePtr(n_cur, cur, 1);
45051 xmlResetLastError();
45052 if (mem_base != xmlMemBlocks()) {
45053 printf("Leak of %d blocks found in xmlXPathNextAttribute",
45054 xmlMemBlocks() - mem_base);
45055 test_ret++;
45056 printf(" %d", n_ctxt);
45057 printf(" %d", n_cur);
45058 printf("\n");
45059 }
45060 }
45061 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045062 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045063#endif
45064
Daniel Veillarda82b1822004-11-08 16:24:57 +000045065 return(test_ret);
45066}
45067
45068
45069static int
45070test_xmlXPathNextChild(void) {
45071 int test_ret = 0;
45072
William M. Brack21e4ef22005-01-02 09:53:13 +000045073#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045074 int mem_base;
45075 xmlNodePtr ret_val;
45076 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45077 int n_ctxt;
45078 xmlNodePtr cur; /* the current node in the traversal */
45079 int n_cur;
45080
45081 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45082 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45083 mem_base = xmlMemBlocks();
45084 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45085 cur = gen_xmlNodePtr(n_cur, 1);
45086
45087 ret_val = xmlXPathNextChild(ctxt, cur);
45088 desret_xmlNodePtr(ret_val);
45089 call_tests++;
45090 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45091 des_xmlNodePtr(n_cur, cur, 1);
45092 xmlResetLastError();
45093 if (mem_base != xmlMemBlocks()) {
45094 printf("Leak of %d blocks found in xmlXPathNextChild",
45095 xmlMemBlocks() - mem_base);
45096 test_ret++;
45097 printf(" %d", n_ctxt);
45098 printf(" %d", n_cur);
45099 printf("\n");
45100 }
45101 }
45102 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045103 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045104#endif
45105
Daniel Veillarda82b1822004-11-08 16:24:57 +000045106 return(test_ret);
45107}
45108
45109
45110static int
45111test_xmlXPathNextDescendant(void) {
45112 int test_ret = 0;
45113
William M. Brack21e4ef22005-01-02 09:53:13 +000045114#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045115 int mem_base;
45116 xmlNodePtr ret_val;
45117 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45118 int n_ctxt;
45119 xmlNodePtr cur; /* the current node in the traversal */
45120 int n_cur;
45121
45122 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45123 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45124 mem_base = xmlMemBlocks();
45125 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45126 cur = gen_xmlNodePtr(n_cur, 1);
45127
45128 ret_val = xmlXPathNextDescendant(ctxt, cur);
45129 desret_xmlNodePtr(ret_val);
45130 call_tests++;
45131 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45132 des_xmlNodePtr(n_cur, cur, 1);
45133 xmlResetLastError();
45134 if (mem_base != xmlMemBlocks()) {
45135 printf("Leak of %d blocks found in xmlXPathNextDescendant",
45136 xmlMemBlocks() - mem_base);
45137 test_ret++;
45138 printf(" %d", n_ctxt);
45139 printf(" %d", n_cur);
45140 printf("\n");
45141 }
45142 }
45143 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045144 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045145#endif
45146
Daniel Veillarda82b1822004-11-08 16:24:57 +000045147 return(test_ret);
45148}
45149
45150
45151static int
45152test_xmlXPathNextDescendantOrSelf(void) {
45153 int test_ret = 0;
45154
William M. Brack21e4ef22005-01-02 09:53:13 +000045155#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045156 int mem_base;
45157 xmlNodePtr ret_val;
45158 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45159 int n_ctxt;
45160 xmlNodePtr cur; /* the current node in the traversal */
45161 int n_cur;
45162
45163 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45164 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45165 mem_base = xmlMemBlocks();
45166 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45167 cur = gen_xmlNodePtr(n_cur, 1);
45168
45169 ret_val = xmlXPathNextDescendantOrSelf(ctxt, cur);
45170 desret_xmlNodePtr(ret_val);
45171 call_tests++;
45172 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45173 des_xmlNodePtr(n_cur, cur, 1);
45174 xmlResetLastError();
45175 if (mem_base != xmlMemBlocks()) {
45176 printf("Leak of %d blocks found in xmlXPathNextDescendantOrSelf",
45177 xmlMemBlocks() - mem_base);
45178 test_ret++;
45179 printf(" %d", n_ctxt);
45180 printf(" %d", n_cur);
45181 printf("\n");
45182 }
45183 }
45184 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045185 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045186#endif
45187
Daniel Veillarda82b1822004-11-08 16:24:57 +000045188 return(test_ret);
45189}
45190
45191
45192static int
45193test_xmlXPathNextFollowing(void) {
45194 int test_ret = 0;
45195
William M. Brack21e4ef22005-01-02 09:53:13 +000045196#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045197 int mem_base;
45198 xmlNodePtr ret_val;
45199 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45200 int n_ctxt;
45201 xmlNodePtr cur; /* the current node in the traversal */
45202 int n_cur;
45203
45204 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45205 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45206 mem_base = xmlMemBlocks();
45207 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45208 cur = gen_xmlNodePtr(n_cur, 1);
45209
45210 ret_val = xmlXPathNextFollowing(ctxt, cur);
45211 desret_xmlNodePtr(ret_val);
45212 call_tests++;
45213 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45214 des_xmlNodePtr(n_cur, cur, 1);
45215 xmlResetLastError();
45216 if (mem_base != xmlMemBlocks()) {
45217 printf("Leak of %d blocks found in xmlXPathNextFollowing",
45218 xmlMemBlocks() - mem_base);
45219 test_ret++;
45220 printf(" %d", n_ctxt);
45221 printf(" %d", n_cur);
45222 printf("\n");
45223 }
45224 }
45225 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045226 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045227#endif
45228
Daniel Veillarda82b1822004-11-08 16:24:57 +000045229 return(test_ret);
45230}
45231
45232
45233static int
45234test_xmlXPathNextFollowingSibling(void) {
45235 int test_ret = 0;
45236
William M. Brack21e4ef22005-01-02 09:53:13 +000045237#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045238 int mem_base;
45239 xmlNodePtr ret_val;
45240 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45241 int n_ctxt;
45242 xmlNodePtr cur; /* the current node in the traversal */
45243 int n_cur;
45244
45245 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45246 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45247 mem_base = xmlMemBlocks();
45248 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45249 cur = gen_xmlNodePtr(n_cur, 1);
45250
45251 ret_val = xmlXPathNextFollowingSibling(ctxt, cur);
45252 desret_xmlNodePtr(ret_val);
45253 call_tests++;
45254 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45255 des_xmlNodePtr(n_cur, cur, 1);
45256 xmlResetLastError();
45257 if (mem_base != xmlMemBlocks()) {
45258 printf("Leak of %d blocks found in xmlXPathNextFollowingSibling",
45259 xmlMemBlocks() - mem_base);
45260 test_ret++;
45261 printf(" %d", n_ctxt);
45262 printf(" %d", n_cur);
45263 printf("\n");
45264 }
45265 }
45266 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045267 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045268#endif
45269
Daniel Veillarda82b1822004-11-08 16:24:57 +000045270 return(test_ret);
45271}
45272
45273
45274static int
45275test_xmlXPathNextNamespace(void) {
45276 int test_ret = 0;
45277
William M. Brack21e4ef22005-01-02 09:53:13 +000045278#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045279 int mem_base;
45280 xmlNodePtr ret_val;
45281 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45282 int n_ctxt;
45283 xmlNodePtr cur; /* the current attribute in the traversal */
45284 int n_cur;
45285
45286 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45287 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45288 mem_base = xmlMemBlocks();
45289 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45290 cur = gen_xmlNodePtr(n_cur, 1);
45291
45292 ret_val = xmlXPathNextNamespace(ctxt, cur);
45293 desret_xmlNodePtr(ret_val);
45294 call_tests++;
45295 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45296 des_xmlNodePtr(n_cur, cur, 1);
45297 xmlResetLastError();
45298 if (mem_base != xmlMemBlocks()) {
45299 printf("Leak of %d blocks found in xmlXPathNextNamespace",
45300 xmlMemBlocks() - mem_base);
45301 test_ret++;
45302 printf(" %d", n_ctxt);
45303 printf(" %d", n_cur);
45304 printf("\n");
45305 }
45306 }
45307 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045308 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045309#endif
45310
Daniel Veillarda82b1822004-11-08 16:24:57 +000045311 return(test_ret);
45312}
45313
45314
45315static int
45316test_xmlXPathNextParent(void) {
45317 int test_ret = 0;
45318
William M. Brack21e4ef22005-01-02 09:53:13 +000045319#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045320 int mem_base;
45321 xmlNodePtr ret_val;
45322 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45323 int n_ctxt;
45324 xmlNodePtr cur; /* the current node in the traversal */
45325 int n_cur;
45326
45327 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45328 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45329 mem_base = xmlMemBlocks();
45330 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45331 cur = gen_xmlNodePtr(n_cur, 1);
45332
45333 ret_val = xmlXPathNextParent(ctxt, cur);
45334 desret_xmlNodePtr(ret_val);
45335 call_tests++;
45336 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45337 des_xmlNodePtr(n_cur, cur, 1);
45338 xmlResetLastError();
45339 if (mem_base != xmlMemBlocks()) {
45340 printf("Leak of %d blocks found in xmlXPathNextParent",
45341 xmlMemBlocks() - mem_base);
45342 test_ret++;
45343 printf(" %d", n_ctxt);
45344 printf(" %d", n_cur);
45345 printf("\n");
45346 }
45347 }
45348 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045349 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045350#endif
45351
Daniel Veillarda82b1822004-11-08 16:24:57 +000045352 return(test_ret);
45353}
45354
45355
45356static int
45357test_xmlXPathNextPreceding(void) {
45358 int test_ret = 0;
45359
William M. Brack21e4ef22005-01-02 09:53:13 +000045360#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045361 int mem_base;
45362 xmlNodePtr ret_val;
45363 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45364 int n_ctxt;
45365 xmlNodePtr cur; /* the current node in the traversal */
45366 int n_cur;
45367
45368 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45369 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45370 mem_base = xmlMemBlocks();
45371 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45372 cur = gen_xmlNodePtr(n_cur, 1);
45373
45374 ret_val = xmlXPathNextPreceding(ctxt, cur);
45375 desret_xmlNodePtr(ret_val);
45376 call_tests++;
45377 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45378 des_xmlNodePtr(n_cur, cur, 1);
45379 xmlResetLastError();
45380 if (mem_base != xmlMemBlocks()) {
45381 printf("Leak of %d blocks found in xmlXPathNextPreceding",
45382 xmlMemBlocks() - mem_base);
45383 test_ret++;
45384 printf(" %d", n_ctxt);
45385 printf(" %d", n_cur);
45386 printf("\n");
45387 }
45388 }
45389 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045390 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045391#endif
45392
Daniel Veillarda82b1822004-11-08 16:24:57 +000045393 return(test_ret);
45394}
45395
45396
45397static int
45398test_xmlXPathNextPrecedingSibling(void) {
45399 int test_ret = 0;
45400
William M. Brack21e4ef22005-01-02 09:53:13 +000045401#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045402 int mem_base;
45403 xmlNodePtr ret_val;
45404 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45405 int n_ctxt;
45406 xmlNodePtr cur; /* the current node in the traversal */
45407 int n_cur;
45408
45409 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45410 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45411 mem_base = xmlMemBlocks();
45412 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45413 cur = gen_xmlNodePtr(n_cur, 1);
45414
45415 ret_val = xmlXPathNextPrecedingSibling(ctxt, cur);
45416 desret_xmlNodePtr(ret_val);
45417 call_tests++;
45418 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45419 des_xmlNodePtr(n_cur, cur, 1);
45420 xmlResetLastError();
45421 if (mem_base != xmlMemBlocks()) {
45422 printf("Leak of %d blocks found in xmlXPathNextPrecedingSibling",
45423 xmlMemBlocks() - mem_base);
45424 test_ret++;
45425 printf(" %d", n_ctxt);
45426 printf(" %d", n_cur);
45427 printf("\n");
45428 }
45429 }
45430 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045431 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045432#endif
45433
Daniel Veillarda82b1822004-11-08 16:24:57 +000045434 return(test_ret);
45435}
45436
45437
45438static int
45439test_xmlXPathNextSelf(void) {
45440 int test_ret = 0;
45441
William M. Brack21e4ef22005-01-02 09:53:13 +000045442#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045443 int mem_base;
45444 xmlNodePtr ret_val;
45445 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45446 int n_ctxt;
45447 xmlNodePtr cur; /* the current node in the traversal */
45448 int n_cur;
45449
45450 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45451 for (n_cur = 0;n_cur < gen_nb_xmlNodePtr;n_cur++) {
45452 mem_base = xmlMemBlocks();
45453 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45454 cur = gen_xmlNodePtr(n_cur, 1);
45455
45456 ret_val = xmlXPathNextSelf(ctxt, cur);
45457 desret_xmlNodePtr(ret_val);
45458 call_tests++;
45459 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45460 des_xmlNodePtr(n_cur, cur, 1);
45461 xmlResetLastError();
45462 if (mem_base != xmlMemBlocks()) {
45463 printf("Leak of %d blocks found in xmlXPathNextSelf",
45464 xmlMemBlocks() - mem_base);
45465 test_ret++;
45466 printf(" %d", n_ctxt);
45467 printf(" %d", n_cur);
45468 printf("\n");
45469 }
45470 }
45471 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045472 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045473#endif
45474
Daniel Veillarda82b1822004-11-08 16:24:57 +000045475 return(test_ret);
45476}
45477
45478
45479static int
45480test_xmlXPathNodeLeading(void) {
45481 int test_ret = 0;
45482
William M. Brack21e4ef22005-01-02 09:53:13 +000045483#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045484 int mem_base;
45485 xmlNodeSetPtr ret_val;
45486 xmlNodeSetPtr nodes; /* a node-set */
45487 int n_nodes;
45488 xmlNodePtr node; /* a node */
45489 int n_node;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045490
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045491 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
45492 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
45493 mem_base = xmlMemBlocks();
45494 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
45495 node = gen_xmlNodePtr(n_node, 1);
45496
45497 ret_val = xmlXPathNodeLeading(nodes, node);
45498 desret_xmlNodeSetPtr(ret_val);
45499 call_tests++;
45500 des_xmlNodeSetPtr(n_nodes, nodes, 0);
45501 des_xmlNodePtr(n_node, node, 1);
45502 xmlResetLastError();
45503 if (mem_base != xmlMemBlocks()) {
45504 printf("Leak of %d blocks found in xmlXPathNodeLeading",
45505 xmlMemBlocks() - mem_base);
45506 test_ret++;
45507 printf(" %d", n_nodes);
45508 printf(" %d", n_node);
45509 printf("\n");
45510 }
45511 }
45512 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045513 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045514#endif
45515
Daniel Veillarda82b1822004-11-08 16:24:57 +000045516 return(test_ret);
45517}
45518
45519
45520static int
45521test_xmlXPathNodeLeadingSorted(void) {
45522 int test_ret = 0;
45523
William M. Brack21e4ef22005-01-02 09:53:13 +000045524#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045525 int mem_base;
45526 xmlNodeSetPtr ret_val;
45527 xmlNodeSetPtr nodes; /* a node-set, sorted by document order */
45528 int n_nodes;
45529 xmlNodePtr node; /* a node */
45530 int n_node;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045531
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045532 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
45533 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
45534 mem_base = xmlMemBlocks();
45535 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
45536 node = gen_xmlNodePtr(n_node, 1);
45537
45538 ret_val = xmlXPathNodeLeadingSorted(nodes, node);
45539 desret_xmlNodeSetPtr(ret_val);
45540 call_tests++;
45541 des_xmlNodeSetPtr(n_nodes, nodes, 0);
45542 des_xmlNodePtr(n_node, node, 1);
45543 xmlResetLastError();
45544 if (mem_base != xmlMemBlocks()) {
45545 printf("Leak of %d blocks found in xmlXPathNodeLeadingSorted",
45546 xmlMemBlocks() - mem_base);
45547 test_ret++;
45548 printf(" %d", n_nodes);
45549 printf(" %d", n_node);
45550 printf("\n");
45551 }
45552 }
45553 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045554 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045555#endif
45556
Daniel Veillarda82b1822004-11-08 16:24:57 +000045557 return(test_ret);
45558}
45559
45560
45561static int
45562test_xmlXPathNodeSetAdd(void) {
45563 int test_ret = 0;
45564
William M. Brack21e4ef22005-01-02 09:53:13 +000045565#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045566 int mem_base;
45567 xmlNodeSetPtr cur; /* the initial node set */
45568 int n_cur;
45569 xmlNodePtr val; /* a new xmlNodePtr */
45570 int n_val;
45571
45572 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
45573 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
45574 mem_base = xmlMemBlocks();
45575 cur = gen_xmlNodeSetPtr(n_cur, 0);
45576 val = gen_xmlNodePtr(n_val, 1);
45577
45578 xmlXPathNodeSetAdd(cur, val);
45579 call_tests++;
45580 des_xmlNodeSetPtr(n_cur, cur, 0);
45581 des_xmlNodePtr(n_val, val, 1);
45582 xmlResetLastError();
45583 if (mem_base != xmlMemBlocks()) {
45584 printf("Leak of %d blocks found in xmlXPathNodeSetAdd",
45585 xmlMemBlocks() - mem_base);
45586 test_ret++;
45587 printf(" %d", n_cur);
45588 printf(" %d", n_val);
45589 printf("\n");
45590 }
45591 }
45592 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045593 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045594#endif
45595
Daniel Veillarda82b1822004-11-08 16:24:57 +000045596 return(test_ret);
45597}
45598
45599
45600static int
45601test_xmlXPathNodeSetAddNs(void) {
45602 int test_ret = 0;
45603
William M. Brack21e4ef22005-01-02 09:53:13 +000045604#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045605 int mem_base;
45606 xmlNodeSetPtr cur; /* the initial node set */
45607 int n_cur;
45608 xmlNodePtr node; /* the hosting node */
45609 int n_node;
45610 xmlNsPtr ns; /* a the namespace node */
45611 int n_ns;
45612
45613 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
45614 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
45615 for (n_ns = 0;n_ns < gen_nb_xmlNsPtr;n_ns++) {
45616 mem_base = xmlMemBlocks();
45617 cur = gen_xmlNodeSetPtr(n_cur, 0);
45618 node = gen_xmlNodePtr(n_node, 1);
45619 ns = gen_xmlNsPtr(n_ns, 2);
45620
45621 xmlXPathNodeSetAddNs(cur, node, ns);
45622 call_tests++;
45623 des_xmlNodeSetPtr(n_cur, cur, 0);
45624 des_xmlNodePtr(n_node, node, 1);
45625 des_xmlNsPtr(n_ns, ns, 2);
45626 xmlResetLastError();
45627 if (mem_base != xmlMemBlocks()) {
45628 printf("Leak of %d blocks found in xmlXPathNodeSetAddNs",
45629 xmlMemBlocks() - mem_base);
45630 test_ret++;
45631 printf(" %d", n_cur);
45632 printf(" %d", n_node);
45633 printf(" %d", n_ns);
45634 printf("\n");
45635 }
45636 }
45637 }
45638 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045639 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045640#endif
45641
Daniel Veillarda82b1822004-11-08 16:24:57 +000045642 return(test_ret);
45643}
45644
45645
45646static int
45647test_xmlXPathNodeSetAddUnique(void) {
45648 int test_ret = 0;
45649
William M. Brack21e4ef22005-01-02 09:53:13 +000045650#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045651 int mem_base;
45652 xmlNodeSetPtr cur; /* the initial node set */
45653 int n_cur;
45654 xmlNodePtr val; /* a new xmlNodePtr */
45655 int n_val;
45656
45657 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
45658 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
45659 mem_base = xmlMemBlocks();
45660 cur = gen_xmlNodeSetPtr(n_cur, 0);
45661 val = gen_xmlNodePtr(n_val, 1);
45662
45663 xmlXPathNodeSetAddUnique(cur, val);
45664 call_tests++;
45665 des_xmlNodeSetPtr(n_cur, cur, 0);
45666 des_xmlNodePtr(n_val, val, 1);
45667 xmlResetLastError();
45668 if (mem_base != xmlMemBlocks()) {
45669 printf("Leak of %d blocks found in xmlXPathNodeSetAddUnique",
45670 xmlMemBlocks() - mem_base);
45671 test_ret++;
45672 printf(" %d", n_cur);
45673 printf(" %d", n_val);
45674 printf("\n");
45675 }
45676 }
45677 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045678 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045679#endif
45680
Daniel Veillarda82b1822004-11-08 16:24:57 +000045681 return(test_ret);
45682}
45683
45684
45685static int
45686test_xmlXPathNodeSetContains(void) {
45687 int test_ret = 0;
45688
William M. Brack21e4ef22005-01-02 09:53:13 +000045689#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045690 int mem_base;
45691 int ret_val;
45692 xmlNodeSetPtr cur; /* the node-set */
45693 int n_cur;
45694 xmlNodePtr val; /* the node */
45695 int n_val;
45696
45697 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
45698 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
45699 mem_base = xmlMemBlocks();
45700 cur = gen_xmlNodeSetPtr(n_cur, 0);
45701 val = gen_xmlNodePtr(n_val, 1);
45702
45703 ret_val = xmlXPathNodeSetContains(cur, val);
45704 desret_int(ret_val);
45705 call_tests++;
45706 des_xmlNodeSetPtr(n_cur, cur, 0);
45707 des_xmlNodePtr(n_val, val, 1);
45708 xmlResetLastError();
45709 if (mem_base != xmlMemBlocks()) {
45710 printf("Leak of %d blocks found in xmlXPathNodeSetContains",
45711 xmlMemBlocks() - mem_base);
45712 test_ret++;
45713 printf(" %d", n_cur);
45714 printf(" %d", n_val);
45715 printf("\n");
45716 }
45717 }
45718 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045719 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045720#endif
45721
Daniel Veillarda82b1822004-11-08 16:24:57 +000045722 return(test_ret);
45723}
45724
45725
45726static int
45727test_xmlXPathNodeSetDel(void) {
45728 int test_ret = 0;
45729
William M. Brack21e4ef22005-01-02 09:53:13 +000045730#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045731 int mem_base;
45732 xmlNodeSetPtr cur; /* the initial node set */
45733 int n_cur;
45734 xmlNodePtr val; /* an xmlNodePtr */
45735 int n_val;
45736
45737 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
45738 for (n_val = 0;n_val < gen_nb_xmlNodePtr;n_val++) {
45739 mem_base = xmlMemBlocks();
45740 cur = gen_xmlNodeSetPtr(n_cur, 0);
45741 val = gen_xmlNodePtr(n_val, 1);
45742
45743 xmlXPathNodeSetDel(cur, val);
45744 call_tests++;
45745 des_xmlNodeSetPtr(n_cur, cur, 0);
45746 des_xmlNodePtr(n_val, val, 1);
45747 xmlResetLastError();
45748 if (mem_base != xmlMemBlocks()) {
45749 printf("Leak of %d blocks found in xmlXPathNodeSetDel",
45750 xmlMemBlocks() - mem_base);
45751 test_ret++;
45752 printf(" %d", n_cur);
45753 printf(" %d", n_val);
45754 printf("\n");
45755 }
45756 }
45757 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045758 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045759#endif
45760
Daniel Veillarda82b1822004-11-08 16:24:57 +000045761 return(test_ret);
45762}
45763
45764
45765static int
45766test_xmlXPathNodeSetMerge(void) {
45767 int test_ret = 0;
45768
William M. Brack21e4ef22005-01-02 09:53:13 +000045769#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045770 int mem_base;
45771 xmlNodeSetPtr ret_val;
45772 xmlNodeSetPtr val1; /* the first NodeSet or NULL */
45773 int n_val1;
45774 xmlNodeSetPtr val2; /* the second NodeSet */
45775 int n_val2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045776
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045777 for (n_val1 = 0;n_val1 < gen_nb_xmlNodeSetPtr;n_val1++) {
45778 for (n_val2 = 0;n_val2 < gen_nb_xmlNodeSetPtr;n_val2++) {
45779 mem_base = xmlMemBlocks();
45780 val1 = gen_xmlNodeSetPtr(n_val1, 0);
45781 val2 = gen_xmlNodeSetPtr(n_val2, 1);
45782
45783 ret_val = xmlXPathNodeSetMerge(val1, val2);
45784 desret_xmlNodeSetPtr(ret_val);
45785 call_tests++;
45786 des_xmlNodeSetPtr(n_val1, val1, 0);
45787 des_xmlNodeSetPtr(n_val2, val2, 1);
45788 xmlResetLastError();
45789 if (mem_base != xmlMemBlocks()) {
45790 printf("Leak of %d blocks found in xmlXPathNodeSetMerge",
45791 xmlMemBlocks() - mem_base);
45792 test_ret++;
45793 printf(" %d", n_val1);
45794 printf(" %d", n_val2);
45795 printf("\n");
45796 }
45797 }
45798 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045799 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045800#endif
45801
Daniel Veillarda82b1822004-11-08 16:24:57 +000045802 return(test_ret);
45803}
45804
45805
45806static int
45807test_xmlXPathNodeSetRemove(void) {
45808 int test_ret = 0;
45809
William M. Brack21e4ef22005-01-02 09:53:13 +000045810#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045811 int mem_base;
45812 xmlNodeSetPtr cur; /* the initial node set */
45813 int n_cur;
45814 int val; /* the index to remove */
45815 int n_val;
45816
45817 for (n_cur = 0;n_cur < gen_nb_xmlNodeSetPtr;n_cur++) {
45818 for (n_val = 0;n_val < gen_nb_int;n_val++) {
45819 mem_base = xmlMemBlocks();
45820 cur = gen_xmlNodeSetPtr(n_cur, 0);
45821 val = gen_int(n_val, 1);
45822
45823 xmlXPathNodeSetRemove(cur, val);
45824 call_tests++;
45825 des_xmlNodeSetPtr(n_cur, cur, 0);
45826 des_int(n_val, val, 1);
45827 xmlResetLastError();
45828 if (mem_base != xmlMemBlocks()) {
45829 printf("Leak of %d blocks found in xmlXPathNodeSetRemove",
45830 xmlMemBlocks() - mem_base);
45831 test_ret++;
45832 printf(" %d", n_cur);
45833 printf(" %d", n_val);
45834 printf("\n");
45835 }
45836 }
45837 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045838 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045839#endif
45840
Daniel Veillarda82b1822004-11-08 16:24:57 +000045841 return(test_ret);
45842}
45843
45844
45845static int
45846test_xmlXPathNodeSetSort(void) {
45847 int test_ret = 0;
45848
William M. Brack21e4ef22005-01-02 09:53:13 +000045849#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045850 int mem_base;
45851 xmlNodeSetPtr set; /* the node set */
45852 int n_set;
45853
45854 for (n_set = 0;n_set < gen_nb_xmlNodeSetPtr;n_set++) {
45855 mem_base = xmlMemBlocks();
45856 set = gen_xmlNodeSetPtr(n_set, 0);
45857
45858 xmlXPathNodeSetSort(set);
45859 call_tests++;
45860 des_xmlNodeSetPtr(n_set, set, 0);
45861 xmlResetLastError();
45862 if (mem_base != xmlMemBlocks()) {
45863 printf("Leak of %d blocks found in xmlXPathNodeSetSort",
45864 xmlMemBlocks() - mem_base);
45865 test_ret++;
45866 printf(" %d", n_set);
45867 printf("\n");
45868 }
45869 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045870 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045871#endif
45872
Daniel Veillarda82b1822004-11-08 16:24:57 +000045873 return(test_ret);
45874}
45875
45876
45877static int
45878test_xmlXPathNodeTrailing(void) {
45879 int test_ret = 0;
45880
William M. Brack21e4ef22005-01-02 09:53:13 +000045881#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045882 int mem_base;
45883 xmlNodeSetPtr ret_val;
45884 xmlNodeSetPtr nodes; /* a node-set */
45885 int n_nodes;
45886 xmlNodePtr node; /* a node */
45887 int n_node;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045888
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045889 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
45890 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
45891 mem_base = xmlMemBlocks();
45892 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
45893 node = gen_xmlNodePtr(n_node, 1);
45894
45895 ret_val = xmlXPathNodeTrailing(nodes, node);
45896 desret_xmlNodeSetPtr(ret_val);
45897 call_tests++;
45898 des_xmlNodeSetPtr(n_nodes, nodes, 0);
45899 des_xmlNodePtr(n_node, node, 1);
45900 xmlResetLastError();
45901 if (mem_base != xmlMemBlocks()) {
45902 printf("Leak of %d blocks found in xmlXPathNodeTrailing",
45903 xmlMemBlocks() - mem_base);
45904 test_ret++;
45905 printf(" %d", n_nodes);
45906 printf(" %d", n_node);
45907 printf("\n");
45908 }
45909 }
45910 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045911 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045912#endif
45913
Daniel Veillarda82b1822004-11-08 16:24:57 +000045914 return(test_ret);
45915}
45916
45917
45918static int
45919test_xmlXPathNodeTrailingSorted(void) {
45920 int test_ret = 0;
45921
William M. Brack21e4ef22005-01-02 09:53:13 +000045922#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045923 int mem_base;
45924 xmlNodeSetPtr ret_val;
45925 xmlNodeSetPtr nodes; /* a node-set, sorted by document order */
45926 int n_nodes;
45927 xmlNodePtr node; /* a node */
45928 int n_node;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045929
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045930 for (n_nodes = 0;n_nodes < gen_nb_xmlNodeSetPtr;n_nodes++) {
45931 for (n_node = 0;n_node < gen_nb_xmlNodePtr;n_node++) {
45932 mem_base = xmlMemBlocks();
45933 nodes = gen_xmlNodeSetPtr(n_nodes, 0);
45934 node = gen_xmlNodePtr(n_node, 1);
45935
45936 ret_val = xmlXPathNodeTrailingSorted(nodes, node);
45937 desret_xmlNodeSetPtr(ret_val);
45938 call_tests++;
45939 des_xmlNodeSetPtr(n_nodes, nodes, 0);
45940 des_xmlNodePtr(n_node, node, 1);
45941 xmlResetLastError();
45942 if (mem_base != xmlMemBlocks()) {
45943 printf("Leak of %d blocks found in xmlXPathNodeTrailingSorted",
45944 xmlMemBlocks() - mem_base);
45945 test_ret++;
45946 printf(" %d", n_nodes);
45947 printf(" %d", n_node);
45948 printf("\n");
45949 }
45950 }
45951 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045952 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000045953#endif
45954
Daniel Veillarda82b1822004-11-08 16:24:57 +000045955 return(test_ret);
45956}
45957
45958
45959static int
45960test_xmlXPathNormalizeFunction(void) {
45961 int test_ret = 0;
45962
William M. Brack21e4ef22005-01-02 09:53:13 +000045963#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000045964 int mem_base;
45965 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
45966 int n_ctxt;
45967 int nargs; /* the number of arguments */
45968 int n_nargs;
45969
45970 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
45971 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
45972 mem_base = xmlMemBlocks();
45973 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
45974 nargs = gen_int(n_nargs, 1);
45975
45976 xmlXPathNormalizeFunction(ctxt, nargs);
45977 call_tests++;
45978 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
45979 des_int(n_nargs, nargs, 1);
45980 xmlResetLastError();
45981 if (mem_base != xmlMemBlocks()) {
45982 printf("Leak of %d blocks found in xmlXPathNormalizeFunction",
45983 xmlMemBlocks() - mem_base);
45984 test_ret++;
45985 printf(" %d", n_ctxt);
45986 printf(" %d", n_nargs);
45987 printf("\n");
45988 }
45989 }
45990 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000045991 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000045992#endif
45993
Daniel Veillarda82b1822004-11-08 16:24:57 +000045994 return(test_ret);
45995}
45996
45997
45998static int
45999test_xmlXPathNotEqualValues(void) {
46000 int test_ret = 0;
46001
William M. Brack21e4ef22005-01-02 09:53:13 +000046002#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046003 int mem_base;
46004 int ret_val;
46005 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46006 int n_ctxt;
46007
46008 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46009 mem_base = xmlMemBlocks();
46010 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46011
46012 ret_val = xmlXPathNotEqualValues(ctxt);
46013 desret_int(ret_val);
46014 call_tests++;
46015 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46016 xmlResetLastError();
46017 if (mem_base != xmlMemBlocks()) {
46018 printf("Leak of %d blocks found in xmlXPathNotEqualValues",
46019 xmlMemBlocks() - mem_base);
46020 test_ret++;
46021 printf(" %d", n_ctxt);
46022 printf("\n");
46023 }
46024 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046025 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046026#endif
46027
Daniel Veillarda82b1822004-11-08 16:24:57 +000046028 return(test_ret);
46029}
46030
46031
46032static int
46033test_xmlXPathNotFunction(void) {
46034 int test_ret = 0;
46035
William M. Brack21e4ef22005-01-02 09:53:13 +000046036#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046037 int mem_base;
46038 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46039 int n_ctxt;
46040 int nargs; /* the number of arguments */
46041 int n_nargs;
46042
46043 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46044 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46045 mem_base = xmlMemBlocks();
46046 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46047 nargs = gen_int(n_nargs, 1);
46048
46049 xmlXPathNotFunction(ctxt, nargs);
46050 call_tests++;
46051 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46052 des_int(n_nargs, nargs, 1);
46053 xmlResetLastError();
46054 if (mem_base != xmlMemBlocks()) {
46055 printf("Leak of %d blocks found in xmlXPathNotFunction",
46056 xmlMemBlocks() - mem_base);
46057 test_ret++;
46058 printf(" %d", n_ctxt);
46059 printf(" %d", n_nargs);
46060 printf("\n");
46061 }
46062 }
46063 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046064 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046065#endif
46066
Daniel Veillarda82b1822004-11-08 16:24:57 +000046067 return(test_ret);
46068}
46069
46070
46071static int
46072test_xmlXPathNsLookup(void) {
46073 int test_ret = 0;
46074
William M. Brack21e4ef22005-01-02 09:53:13 +000046075#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046076 int mem_base;
46077 const xmlChar * ret_val;
46078 xmlXPathContextPtr ctxt; /* the XPath context */
46079 int n_ctxt;
46080 xmlChar * prefix; /* the namespace prefix value */
46081 int n_prefix;
46082
46083 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46084 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
46085 mem_base = xmlMemBlocks();
46086 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46087 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
46088
William M. Brackf13f77f2004-11-12 16:03:48 +000046089 ret_val = xmlXPathNsLookup(ctxt, (const xmlChar *)prefix);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046090 desret_const_xmlChar_ptr(ret_val);
46091 call_tests++;
46092 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000046093 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046094 xmlResetLastError();
46095 if (mem_base != xmlMemBlocks()) {
46096 printf("Leak of %d blocks found in xmlXPathNsLookup",
46097 xmlMemBlocks() - mem_base);
46098 test_ret++;
46099 printf(" %d", n_ctxt);
46100 printf(" %d", n_prefix);
46101 printf("\n");
46102 }
46103 }
46104 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046105 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046106#endif
46107
Daniel Veillarda82b1822004-11-08 16:24:57 +000046108 return(test_ret);
46109}
46110
46111
46112static int
46113test_xmlXPathNumberFunction(void) {
46114 int test_ret = 0;
46115
William M. Brack21e4ef22005-01-02 09:53:13 +000046116#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046117 int mem_base;
46118 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46119 int n_ctxt;
46120 int nargs; /* the number of arguments */
46121 int n_nargs;
46122
46123 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46124 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46125 mem_base = xmlMemBlocks();
46126 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46127 nargs = gen_int(n_nargs, 1);
46128
46129 xmlXPathNumberFunction(ctxt, nargs);
46130 call_tests++;
46131 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46132 des_int(n_nargs, nargs, 1);
46133 xmlResetLastError();
46134 if (mem_base != xmlMemBlocks()) {
46135 printf("Leak of %d blocks found in xmlXPathNumberFunction",
46136 xmlMemBlocks() - mem_base);
46137 test_ret++;
46138 printf(" %d", n_ctxt);
46139 printf(" %d", n_nargs);
46140 printf("\n");
46141 }
46142 }
46143 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046144 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046145#endif
46146
Daniel Veillarda82b1822004-11-08 16:24:57 +000046147 return(test_ret);
46148}
46149
46150
46151static int
46152test_xmlXPathParseNCName(void) {
46153 int test_ret = 0;
46154
William M. Brack21e4ef22005-01-02 09:53:13 +000046155#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046156 int mem_base;
46157 xmlChar * ret_val;
46158 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46159 int n_ctxt;
46160
46161 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46162 mem_base = xmlMemBlocks();
46163 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46164
46165 ret_val = xmlXPathParseNCName(ctxt);
46166 desret_xmlChar_ptr(ret_val);
46167 call_tests++;
46168 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46169 xmlResetLastError();
46170 if (mem_base != xmlMemBlocks()) {
46171 printf("Leak of %d blocks found in xmlXPathParseNCName",
46172 xmlMemBlocks() - mem_base);
46173 test_ret++;
46174 printf(" %d", n_ctxt);
46175 printf("\n");
46176 }
46177 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046178 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046179#endif
46180
Daniel Veillarda82b1822004-11-08 16:24:57 +000046181 return(test_ret);
46182}
46183
46184
46185static int
46186test_xmlXPathParseName(void) {
46187 int test_ret = 0;
46188
William M. Brack21e4ef22005-01-02 09:53:13 +000046189#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046190 int mem_base;
46191 xmlChar * ret_val;
46192 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46193 int n_ctxt;
46194
46195 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46196 mem_base = xmlMemBlocks();
46197 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46198
46199 ret_val = xmlXPathParseName(ctxt);
46200 desret_xmlChar_ptr(ret_val);
46201 call_tests++;
46202 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46203 xmlResetLastError();
46204 if (mem_base != xmlMemBlocks()) {
46205 printf("Leak of %d blocks found in xmlXPathParseName",
46206 xmlMemBlocks() - mem_base);
46207 test_ret++;
46208 printf(" %d", n_ctxt);
46209 printf("\n");
46210 }
46211 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046212 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046213#endif
46214
Daniel Veillarda82b1822004-11-08 16:24:57 +000046215 return(test_ret);
46216}
46217
46218
46219static int
46220test_xmlXPathPopBoolean(void) {
46221 int test_ret = 0;
46222
William M. Brack21e4ef22005-01-02 09:53:13 +000046223#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046224 int mem_base;
46225 int ret_val;
46226 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
46227 int n_ctxt;
46228
46229 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46230 mem_base = xmlMemBlocks();
46231 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46232
46233 ret_val = xmlXPathPopBoolean(ctxt);
46234 desret_int(ret_val);
46235 call_tests++;
46236 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46237 xmlResetLastError();
46238 if (mem_base != xmlMemBlocks()) {
46239 printf("Leak of %d blocks found in xmlXPathPopBoolean",
46240 xmlMemBlocks() - mem_base);
46241 test_ret++;
46242 printf(" %d", n_ctxt);
46243 printf("\n");
46244 }
46245 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046246 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046247#endif
46248
Daniel Veillarda82b1822004-11-08 16:24:57 +000046249 return(test_ret);
46250}
46251
46252
46253static int
46254test_xmlXPathPopExternal(void) {
46255 int test_ret = 0;
46256
William M. Brack21e4ef22005-01-02 09:53:13 +000046257#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046258 int mem_base;
46259 void * ret_val;
46260 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
46261 int n_ctxt;
46262
46263 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46264 mem_base = xmlMemBlocks();
46265 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46266
46267 ret_val = xmlXPathPopExternal(ctxt);
46268 desret_void_ptr(ret_val);
46269 call_tests++;
46270 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46271 xmlResetLastError();
46272 if (mem_base != xmlMemBlocks()) {
46273 printf("Leak of %d blocks found in xmlXPathPopExternal",
46274 xmlMemBlocks() - mem_base);
46275 test_ret++;
46276 printf(" %d", n_ctxt);
46277 printf("\n");
46278 }
46279 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046280 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046281#endif
46282
Daniel Veillarda82b1822004-11-08 16:24:57 +000046283 return(test_ret);
46284}
46285
46286
46287static int
46288test_xmlXPathPopNodeSet(void) {
46289 int test_ret = 0;
46290
William M. Brack21e4ef22005-01-02 09:53:13 +000046291#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046292 int mem_base;
46293 xmlNodeSetPtr ret_val;
46294 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
46295 int n_ctxt;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046296
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046297 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46298 mem_base = xmlMemBlocks();
46299 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46300
46301 ret_val = xmlXPathPopNodeSet(ctxt);
46302 desret_xmlNodeSetPtr(ret_val);
46303 call_tests++;
46304 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46305 xmlResetLastError();
46306 if (mem_base != xmlMemBlocks()) {
46307 printf("Leak of %d blocks found in xmlXPathPopNodeSet",
46308 xmlMemBlocks() - mem_base);
46309 test_ret++;
46310 printf(" %d", n_ctxt);
46311 printf("\n");
46312 }
46313 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046314 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000046315#endif
46316
Daniel Veillarda82b1822004-11-08 16:24:57 +000046317 return(test_ret);
46318}
46319
46320
46321static int
46322test_xmlXPathPopNumber(void) {
46323 int test_ret = 0;
46324
William M. Brack21e4ef22005-01-02 09:53:13 +000046325#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046326 int mem_base;
46327 double ret_val;
46328 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
46329 int n_ctxt;
46330
46331 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46332 mem_base = xmlMemBlocks();
46333 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46334
46335 ret_val = xmlXPathPopNumber(ctxt);
46336 desret_double(ret_val);
46337 call_tests++;
46338 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46339 xmlResetLastError();
46340 if (mem_base != xmlMemBlocks()) {
46341 printf("Leak of %d blocks found in xmlXPathPopNumber",
46342 xmlMemBlocks() - mem_base);
46343 test_ret++;
46344 printf(" %d", n_ctxt);
46345 printf("\n");
46346 }
46347 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046348 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046349#endif
46350
Daniel Veillarda82b1822004-11-08 16:24:57 +000046351 return(test_ret);
46352}
46353
46354
46355static int
46356test_xmlXPathPopString(void) {
46357 int test_ret = 0;
46358
William M. Brack21e4ef22005-01-02 09:53:13 +000046359#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046360 int mem_base;
46361 xmlChar * ret_val;
46362 xmlXPathParserContextPtr ctxt; /* an XPath parser context */
46363 int n_ctxt;
46364
46365 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46366 mem_base = xmlMemBlocks();
46367 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46368
46369 ret_val = xmlXPathPopString(ctxt);
46370 desret_xmlChar_ptr(ret_val);
46371 call_tests++;
46372 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46373 xmlResetLastError();
46374 if (mem_base != xmlMemBlocks()) {
46375 printf("Leak of %d blocks found in xmlXPathPopString",
46376 xmlMemBlocks() - mem_base);
46377 test_ret++;
46378 printf(" %d", n_ctxt);
46379 printf("\n");
46380 }
46381 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046382 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046383#endif
46384
Daniel Veillarda82b1822004-11-08 16:24:57 +000046385 return(test_ret);
46386}
46387
46388
46389static int
46390test_xmlXPathPositionFunction(void) {
46391 int test_ret = 0;
46392
William M. Brack21e4ef22005-01-02 09:53:13 +000046393#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046394 int mem_base;
46395 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46396 int n_ctxt;
46397 int nargs; /* the number of arguments */
46398 int n_nargs;
46399
46400 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46401 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46402 mem_base = xmlMemBlocks();
46403 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46404 nargs = gen_int(n_nargs, 1);
46405
46406 xmlXPathPositionFunction(ctxt, nargs);
46407 call_tests++;
46408 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46409 des_int(n_nargs, nargs, 1);
46410 xmlResetLastError();
46411 if (mem_base != xmlMemBlocks()) {
46412 printf("Leak of %d blocks found in xmlXPathPositionFunction",
46413 xmlMemBlocks() - mem_base);
46414 test_ret++;
46415 printf(" %d", n_ctxt);
46416 printf(" %d", n_nargs);
46417 printf("\n");
46418 }
46419 }
46420 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046421 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046422#endif
46423
Daniel Veillarda82b1822004-11-08 16:24:57 +000046424 return(test_ret);
46425}
46426
46427
46428static int
46429test_xmlXPathRegisterAllFunctions(void) {
46430 int test_ret = 0;
46431
William M. Brack21e4ef22005-01-02 09:53:13 +000046432#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046433 int mem_base;
46434 xmlXPathContextPtr ctxt; /* the XPath context */
46435 int n_ctxt;
46436
46437 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46438 mem_base = xmlMemBlocks();
46439 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46440
46441 xmlXPathRegisterAllFunctions(ctxt);
46442 call_tests++;
46443 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
46444 xmlResetLastError();
46445 if (mem_base != xmlMemBlocks()) {
46446 printf("Leak of %d blocks found in xmlXPathRegisterAllFunctions",
46447 xmlMemBlocks() - mem_base);
46448 test_ret++;
46449 printf(" %d", n_ctxt);
46450 printf("\n");
46451 }
46452 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046453 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046454#endif
46455
Daniel Veillarda82b1822004-11-08 16:24:57 +000046456 return(test_ret);
46457}
46458
46459
46460static int
46461test_xmlXPathRegisterFunc(void) {
46462 int test_ret = 0;
46463
46464
46465 /* missing type support */
46466 return(test_ret);
46467}
46468
46469
46470static int
46471test_xmlXPathRegisterFuncLookup(void) {
46472 int test_ret = 0;
46473
46474
46475 /* missing type support */
46476 return(test_ret);
46477}
46478
46479
46480static int
46481test_xmlXPathRegisterFuncNS(void) {
46482 int test_ret = 0;
46483
46484
46485 /* missing type support */
46486 return(test_ret);
46487}
46488
46489
46490static int
46491test_xmlXPathRegisterNs(void) {
46492 int test_ret = 0;
46493
William M. Brack21e4ef22005-01-02 09:53:13 +000046494#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046495 int mem_base;
46496 int ret_val;
46497 xmlXPathContextPtr ctxt; /* the XPath context */
46498 int n_ctxt;
46499 xmlChar * prefix; /* the namespace prefix */
46500 int n_prefix;
46501 xmlChar * ns_uri; /* the namespace name */
46502 int n_ns_uri;
46503
46504 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46505 for (n_prefix = 0;n_prefix < gen_nb_const_xmlChar_ptr;n_prefix++) {
46506 for (n_ns_uri = 0;n_ns_uri < gen_nb_const_xmlChar_ptr;n_ns_uri++) {
46507 mem_base = xmlMemBlocks();
46508 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46509 prefix = gen_const_xmlChar_ptr(n_prefix, 1);
46510 ns_uri = gen_const_xmlChar_ptr(n_ns_uri, 2);
46511
William M. Brackf13f77f2004-11-12 16:03:48 +000046512 ret_val = xmlXPathRegisterNs(ctxt, (const xmlChar *)prefix, (const xmlChar *)ns_uri);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046513 desret_int(ret_val);
46514 call_tests++;
46515 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000046516 des_const_xmlChar_ptr(n_prefix, (const xmlChar *)prefix, 1);
46517 des_const_xmlChar_ptr(n_ns_uri, (const xmlChar *)ns_uri, 2);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046518 xmlResetLastError();
46519 if (mem_base != xmlMemBlocks()) {
46520 printf("Leak of %d blocks found in xmlXPathRegisterNs",
46521 xmlMemBlocks() - mem_base);
46522 test_ret++;
46523 printf(" %d", n_ctxt);
46524 printf(" %d", n_prefix);
46525 printf(" %d", n_ns_uri);
46526 printf("\n");
46527 }
46528 }
46529 }
46530 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046531 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046532#endif
46533
Daniel Veillarda82b1822004-11-08 16:24:57 +000046534 return(test_ret);
46535}
46536
46537
46538static int
46539test_xmlXPathRegisterVariable(void) {
46540 int test_ret = 0;
46541
William M. Brack21e4ef22005-01-02 09:53:13 +000046542#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046543 int mem_base;
46544 int ret_val;
46545 xmlXPathContextPtr ctxt; /* the XPath context */
46546 int n_ctxt;
46547 xmlChar * name; /* the variable name */
46548 int n_name;
46549 xmlXPathObjectPtr value; /* the variable value or NULL */
46550 int n_value;
46551
46552 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46553 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
46554 for (n_value = 0;n_value < gen_nb_xmlXPathObjectPtr;n_value++) {
46555 mem_base = xmlMemBlocks();
46556 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46557 name = gen_const_xmlChar_ptr(n_name, 1);
46558 value = gen_xmlXPathObjectPtr(n_value, 2);
46559
William M. Brackf13f77f2004-11-12 16:03:48 +000046560 ret_val = xmlXPathRegisterVariable(ctxt, (const xmlChar *)name, value);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046561 desret_int(ret_val);
46562 call_tests++;
46563 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000046564 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046565 des_xmlXPathObjectPtr(n_value, value, 2);
46566 xmlResetLastError();
46567 if (mem_base != xmlMemBlocks()) {
46568 printf("Leak of %d blocks found in xmlXPathRegisterVariable",
46569 xmlMemBlocks() - mem_base);
46570 test_ret++;
46571 printf(" %d", n_ctxt);
46572 printf(" %d", n_name);
46573 printf(" %d", n_value);
46574 printf("\n");
46575 }
46576 }
46577 }
46578 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046579 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046580#endif
46581
Daniel Veillarda82b1822004-11-08 16:24:57 +000046582 return(test_ret);
46583}
46584
46585
46586static int
46587test_xmlXPathRegisterVariableLookup(void) {
46588 int test_ret = 0;
46589
46590
46591 /* missing type support */
46592 return(test_ret);
46593}
46594
46595
46596static int
46597test_xmlXPathRegisterVariableNS(void) {
46598 int test_ret = 0;
46599
William M. Brack21e4ef22005-01-02 09:53:13 +000046600#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046601 int mem_base;
46602 int ret_val;
46603 xmlXPathContextPtr ctxt; /* the XPath context */
46604 int n_ctxt;
46605 xmlChar * name; /* the variable name */
46606 int n_name;
46607 xmlChar * ns_uri; /* the variable namespace URI */
46608 int n_ns_uri;
46609 xmlXPathObjectPtr value; /* the variable value or NULL */
46610 int n_value;
46611
46612 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46613 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
46614 for (n_ns_uri = 0;n_ns_uri < gen_nb_const_xmlChar_ptr;n_ns_uri++) {
46615 for (n_value = 0;n_value < gen_nb_xmlXPathObjectPtr;n_value++) {
46616 mem_base = xmlMemBlocks();
46617 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46618 name = gen_const_xmlChar_ptr(n_name, 1);
46619 ns_uri = gen_const_xmlChar_ptr(n_ns_uri, 2);
46620 value = gen_xmlXPathObjectPtr(n_value, 3);
46621
William M. Brackf13f77f2004-11-12 16:03:48 +000046622 ret_val = xmlXPathRegisterVariableNS(ctxt, (const xmlChar *)name, (const xmlChar *)ns_uri, value);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046623 desret_int(ret_val);
46624 call_tests++;
46625 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000046626 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
46627 des_const_xmlChar_ptr(n_ns_uri, (const xmlChar *)ns_uri, 2);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046628 des_xmlXPathObjectPtr(n_value, value, 3);
46629 xmlResetLastError();
46630 if (mem_base != xmlMemBlocks()) {
46631 printf("Leak of %d blocks found in xmlXPathRegisterVariableNS",
46632 xmlMemBlocks() - mem_base);
46633 test_ret++;
46634 printf(" %d", n_ctxt);
46635 printf(" %d", n_name);
46636 printf(" %d", n_ns_uri);
46637 printf(" %d", n_value);
46638 printf("\n");
46639 }
46640 }
46641 }
46642 }
46643 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046644 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046645#endif
46646
Daniel Veillarda82b1822004-11-08 16:24:57 +000046647 return(test_ret);
46648}
46649
46650
46651static int
46652test_xmlXPathRegisteredFuncsCleanup(void) {
46653 int test_ret = 0;
46654
William M. Brack21e4ef22005-01-02 09:53:13 +000046655#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046656 int mem_base;
46657 xmlXPathContextPtr ctxt; /* the XPath context */
46658 int n_ctxt;
46659
46660 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46661 mem_base = xmlMemBlocks();
46662 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46663
46664 xmlXPathRegisteredFuncsCleanup(ctxt);
46665 call_tests++;
46666 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
46667 xmlResetLastError();
46668 if (mem_base != xmlMemBlocks()) {
46669 printf("Leak of %d blocks found in xmlXPathRegisteredFuncsCleanup",
46670 xmlMemBlocks() - mem_base);
46671 test_ret++;
46672 printf(" %d", n_ctxt);
46673 printf("\n");
46674 }
46675 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046676 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046677#endif
46678
Daniel Veillarda82b1822004-11-08 16:24:57 +000046679 return(test_ret);
46680}
46681
46682
46683static int
46684test_xmlXPathRegisteredNsCleanup(void) {
46685 int test_ret = 0;
46686
William M. Brack21e4ef22005-01-02 09:53:13 +000046687#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046688 int mem_base;
46689 xmlXPathContextPtr ctxt; /* the XPath context */
46690 int n_ctxt;
46691
46692 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46693 mem_base = xmlMemBlocks();
46694 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46695
46696 xmlXPathRegisteredNsCleanup(ctxt);
46697 call_tests++;
46698 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
46699 xmlResetLastError();
46700 if (mem_base != xmlMemBlocks()) {
46701 printf("Leak of %d blocks found in xmlXPathRegisteredNsCleanup",
46702 xmlMemBlocks() - mem_base);
46703 test_ret++;
46704 printf(" %d", n_ctxt);
46705 printf("\n");
46706 }
46707 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046708 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046709#endif
46710
Daniel Veillarda82b1822004-11-08 16:24:57 +000046711 return(test_ret);
46712}
46713
46714
46715static int
46716test_xmlXPathRegisteredVariablesCleanup(void) {
46717 int test_ret = 0;
46718
William M. Brack21e4ef22005-01-02 09:53:13 +000046719#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046720 int mem_base;
46721 xmlXPathContextPtr ctxt; /* the XPath context */
46722 int n_ctxt;
46723
46724 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
46725 mem_base = xmlMemBlocks();
46726 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
46727
46728 xmlXPathRegisteredVariablesCleanup(ctxt);
46729 call_tests++;
46730 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
46731 xmlResetLastError();
46732 if (mem_base != xmlMemBlocks()) {
46733 printf("Leak of %d blocks found in xmlXPathRegisteredVariablesCleanup",
46734 xmlMemBlocks() - mem_base);
46735 test_ret++;
46736 printf(" %d", n_ctxt);
46737 printf("\n");
46738 }
46739 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046740 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046741#endif
46742
Daniel Veillarda82b1822004-11-08 16:24:57 +000046743 return(test_ret);
46744}
46745
46746
46747static int
46748test_xmlXPathRoot(void) {
46749 int test_ret = 0;
46750
William M. Brack21e4ef22005-01-02 09:53:13 +000046751#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046752 int mem_base;
46753 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46754 int n_ctxt;
46755
46756 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46757 mem_base = xmlMemBlocks();
46758 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46759
46760 xmlXPathRoot(ctxt);
46761 call_tests++;
46762 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46763 xmlResetLastError();
46764 if (mem_base != xmlMemBlocks()) {
46765 printf("Leak of %d blocks found in xmlXPathRoot",
46766 xmlMemBlocks() - mem_base);
46767 test_ret++;
46768 printf(" %d", n_ctxt);
46769 printf("\n");
46770 }
46771 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046772 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046773#endif
46774
Daniel Veillarda82b1822004-11-08 16:24:57 +000046775 return(test_ret);
46776}
46777
46778
46779static int
46780test_xmlXPathRoundFunction(void) {
46781 int test_ret = 0;
46782
William M. Brack21e4ef22005-01-02 09:53:13 +000046783#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046784 int mem_base;
46785 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46786 int n_ctxt;
46787 int nargs; /* the number of arguments */
46788 int n_nargs;
46789
46790 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46791 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46792 mem_base = xmlMemBlocks();
46793 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46794 nargs = gen_int(n_nargs, 1);
46795
46796 xmlXPathRoundFunction(ctxt, nargs);
46797 call_tests++;
46798 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46799 des_int(n_nargs, nargs, 1);
46800 xmlResetLastError();
46801 if (mem_base != xmlMemBlocks()) {
46802 printf("Leak of %d blocks found in xmlXPathRoundFunction",
46803 xmlMemBlocks() - mem_base);
46804 test_ret++;
46805 printf(" %d", n_ctxt);
46806 printf(" %d", n_nargs);
46807 printf("\n");
46808 }
46809 }
46810 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046811 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046812#endif
46813
Daniel Veillarda82b1822004-11-08 16:24:57 +000046814 return(test_ret);
46815}
46816
46817
46818static int
46819test_xmlXPathStartsWithFunction(void) {
46820 int test_ret = 0;
46821
William M. Brack21e4ef22005-01-02 09:53:13 +000046822#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046823 int mem_base;
46824 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46825 int n_ctxt;
46826 int nargs; /* the number of arguments */
46827 int n_nargs;
46828
46829 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46830 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46831 mem_base = xmlMemBlocks();
46832 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46833 nargs = gen_int(n_nargs, 1);
46834
46835 xmlXPathStartsWithFunction(ctxt, nargs);
46836 call_tests++;
46837 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46838 des_int(n_nargs, nargs, 1);
46839 xmlResetLastError();
46840 if (mem_base != xmlMemBlocks()) {
46841 printf("Leak of %d blocks found in xmlXPathStartsWithFunction",
46842 xmlMemBlocks() - mem_base);
46843 test_ret++;
46844 printf(" %d", n_ctxt);
46845 printf(" %d", n_nargs);
46846 printf("\n");
46847 }
46848 }
46849 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046850 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046851#endif
46852
Daniel Veillarda82b1822004-11-08 16:24:57 +000046853 return(test_ret);
46854}
46855
46856
46857static int
46858test_xmlXPathStringEvalNumber(void) {
46859 int test_ret = 0;
46860
William M. Brack21e4ef22005-01-02 09:53:13 +000046861#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046862 int mem_base;
46863 double ret_val;
46864 xmlChar * str; /* A string to scan */
46865 int n_str;
46866
46867 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
46868 mem_base = xmlMemBlocks();
46869 str = gen_const_xmlChar_ptr(n_str, 0);
46870
William M. Brackf13f77f2004-11-12 16:03:48 +000046871 ret_val = xmlXPathStringEvalNumber((const xmlChar *)str);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046872 desret_double(ret_val);
46873 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000046874 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillarda82b1822004-11-08 16:24:57 +000046875 xmlResetLastError();
46876 if (mem_base != xmlMemBlocks()) {
46877 printf("Leak of %d blocks found in xmlXPathStringEvalNumber",
46878 xmlMemBlocks() - mem_base);
46879 test_ret++;
46880 printf(" %d", n_str);
46881 printf("\n");
46882 }
46883 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046884 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046885#endif
46886
Daniel Veillarda82b1822004-11-08 16:24:57 +000046887 return(test_ret);
46888}
46889
46890
46891static int
46892test_xmlXPathStringFunction(void) {
46893 int test_ret = 0;
46894
William M. Brack21e4ef22005-01-02 09:53:13 +000046895#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046896 int mem_base;
46897 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46898 int n_ctxt;
46899 int nargs; /* the number of arguments */
46900 int n_nargs;
46901
46902 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46903 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46904 mem_base = xmlMemBlocks();
46905 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46906 nargs = gen_int(n_nargs, 1);
46907
46908 xmlXPathStringFunction(ctxt, nargs);
46909 call_tests++;
46910 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46911 des_int(n_nargs, nargs, 1);
46912 xmlResetLastError();
46913 if (mem_base != xmlMemBlocks()) {
46914 printf("Leak of %d blocks found in xmlXPathStringFunction",
46915 xmlMemBlocks() - mem_base);
46916 test_ret++;
46917 printf(" %d", n_ctxt);
46918 printf(" %d", n_nargs);
46919 printf("\n");
46920 }
46921 }
46922 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046923 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046924#endif
46925
Daniel Veillarda82b1822004-11-08 16:24:57 +000046926 return(test_ret);
46927}
46928
46929
46930static int
46931test_xmlXPathStringLengthFunction(void) {
46932 int test_ret = 0;
46933
William M. Brack21e4ef22005-01-02 09:53:13 +000046934#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046935 int mem_base;
46936 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46937 int n_ctxt;
46938 int nargs; /* the number of arguments */
46939 int n_nargs;
46940
46941 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46942 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
46943 mem_base = xmlMemBlocks();
46944 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46945 nargs = gen_int(n_nargs, 1);
46946
46947 xmlXPathStringLengthFunction(ctxt, nargs);
46948 call_tests++;
46949 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46950 des_int(n_nargs, nargs, 1);
46951 xmlResetLastError();
46952 if (mem_base != xmlMemBlocks()) {
46953 printf("Leak of %d blocks found in xmlXPathStringLengthFunction",
46954 xmlMemBlocks() - mem_base);
46955 test_ret++;
46956 printf(" %d", n_ctxt);
46957 printf(" %d", n_nargs);
46958 printf("\n");
46959 }
46960 }
46961 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046962 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046963#endif
46964
Daniel Veillarda82b1822004-11-08 16:24:57 +000046965 return(test_ret);
46966}
46967
46968
46969static int
46970test_xmlXPathSubValues(void) {
46971 int test_ret = 0;
46972
William M. Brack21e4ef22005-01-02 09:53:13 +000046973#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000046974 int mem_base;
46975 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
46976 int n_ctxt;
46977
46978 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
46979 mem_base = xmlMemBlocks();
46980 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
46981
46982 xmlXPathSubValues(ctxt);
46983 call_tests++;
46984 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
46985 xmlResetLastError();
46986 if (mem_base != xmlMemBlocks()) {
46987 printf("Leak of %d blocks found in xmlXPathSubValues",
46988 xmlMemBlocks() - mem_base);
46989 test_ret++;
46990 printf(" %d", n_ctxt);
46991 printf("\n");
46992 }
46993 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000046994 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000046995#endif
46996
Daniel Veillarda82b1822004-11-08 16:24:57 +000046997 return(test_ret);
46998}
46999
47000
47001static int
47002test_xmlXPathSubstringAfterFunction(void) {
47003 int test_ret = 0;
47004
William M. Brack21e4ef22005-01-02 09:53:13 +000047005#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047006 int mem_base;
47007 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47008 int n_ctxt;
47009 int nargs; /* the number of arguments */
47010 int n_nargs;
47011
47012 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47013 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47014 mem_base = xmlMemBlocks();
47015 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47016 nargs = gen_int(n_nargs, 1);
47017
47018 xmlXPathSubstringAfterFunction(ctxt, nargs);
47019 call_tests++;
47020 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47021 des_int(n_nargs, nargs, 1);
47022 xmlResetLastError();
47023 if (mem_base != xmlMemBlocks()) {
47024 printf("Leak of %d blocks found in xmlXPathSubstringAfterFunction",
47025 xmlMemBlocks() - mem_base);
47026 test_ret++;
47027 printf(" %d", n_ctxt);
47028 printf(" %d", n_nargs);
47029 printf("\n");
47030 }
47031 }
47032 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047033 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047034#endif
47035
Daniel Veillarda82b1822004-11-08 16:24:57 +000047036 return(test_ret);
47037}
47038
47039
47040static int
47041test_xmlXPathSubstringBeforeFunction(void) {
47042 int test_ret = 0;
47043
William M. Brack21e4ef22005-01-02 09:53:13 +000047044#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047045 int mem_base;
47046 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47047 int n_ctxt;
47048 int nargs; /* the number of arguments */
47049 int n_nargs;
47050
47051 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47052 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47053 mem_base = xmlMemBlocks();
47054 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47055 nargs = gen_int(n_nargs, 1);
47056
47057 xmlXPathSubstringBeforeFunction(ctxt, nargs);
47058 call_tests++;
47059 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47060 des_int(n_nargs, nargs, 1);
47061 xmlResetLastError();
47062 if (mem_base != xmlMemBlocks()) {
47063 printf("Leak of %d blocks found in xmlXPathSubstringBeforeFunction",
47064 xmlMemBlocks() - mem_base);
47065 test_ret++;
47066 printf(" %d", n_ctxt);
47067 printf(" %d", n_nargs);
47068 printf("\n");
47069 }
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_xmlXPathSubstringFunction(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 xmlXPathSubstringFunction(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 xmlXPathSubstringFunction",
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_xmlXPathSumFunction(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 xmlXPathSumFunction(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 xmlXPathSumFunction",
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_xmlXPathTrailing(void) {
47159 int test_ret = 0;
47160
William M. Brack21e4ef22005-01-02 09:53:13 +000047161#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047162 int mem_base;
47163 xmlNodeSetPtr ret_val;
47164 xmlNodeSetPtr nodes1; /* a node-set */
47165 int n_nodes1;
47166 xmlNodeSetPtr nodes2; /* a node-set */
47167 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047168
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047169 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
47170 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
47171 mem_base = xmlMemBlocks();
47172 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
47173 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
47174
47175 ret_val = xmlXPathTrailing(nodes1, nodes2);
47176 desret_xmlNodeSetPtr(ret_val);
47177 call_tests++;
47178 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
47179 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
47180 xmlResetLastError();
47181 if (mem_base != xmlMemBlocks()) {
47182 printf("Leak of %d blocks found in xmlXPathTrailing",
47183 xmlMemBlocks() - mem_base);
47184 test_ret++;
47185 printf(" %d", n_nodes1);
47186 printf(" %d", n_nodes2);
47187 printf("\n");
47188 }
47189 }
47190 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047191 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047192#endif
47193
Daniel Veillarda82b1822004-11-08 16:24:57 +000047194 return(test_ret);
47195}
47196
47197
47198static int
47199test_xmlXPathTrailingSorted(void) {
47200 int test_ret = 0;
47201
William M. Brack21e4ef22005-01-02 09:53:13 +000047202#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047203 int mem_base;
47204 xmlNodeSetPtr ret_val;
47205 xmlNodeSetPtr nodes1; /* a node-set, sorted by document order */
47206 int n_nodes1;
47207 xmlNodeSetPtr nodes2; /* a node-set, sorted by document order */
47208 int n_nodes2;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047209
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047210 for (n_nodes1 = 0;n_nodes1 < gen_nb_xmlNodeSetPtr;n_nodes1++) {
47211 for (n_nodes2 = 0;n_nodes2 < gen_nb_xmlNodeSetPtr;n_nodes2++) {
47212 mem_base = xmlMemBlocks();
47213 nodes1 = gen_xmlNodeSetPtr(n_nodes1, 0);
47214 nodes2 = gen_xmlNodeSetPtr(n_nodes2, 1);
47215
47216 ret_val = xmlXPathTrailingSorted(nodes1, nodes2);
47217 desret_xmlNodeSetPtr(ret_val);
47218 call_tests++;
47219 des_xmlNodeSetPtr(n_nodes1, nodes1, 0);
47220 des_xmlNodeSetPtr(n_nodes2, nodes2, 1);
47221 xmlResetLastError();
47222 if (mem_base != xmlMemBlocks()) {
47223 printf("Leak of %d blocks found in xmlXPathTrailingSorted",
47224 xmlMemBlocks() - mem_base);
47225 test_ret++;
47226 printf(" %d", n_nodes1);
47227 printf(" %d", n_nodes2);
47228 printf("\n");
47229 }
47230 }
47231 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047232 function_tests++;
Daniel Veillardf2a36f92004-11-08 17:55:01 +000047233#endif
47234
Daniel Veillarda82b1822004-11-08 16:24:57 +000047235 return(test_ret);
47236}
47237
47238
47239static int
47240test_xmlXPathTranslateFunction(void) {
47241 int test_ret = 0;
47242
William M. Brack21e4ef22005-01-02 09:53:13 +000047243#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047244 int mem_base;
47245 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47246 int n_ctxt;
47247 int nargs; /* the number of arguments */
47248 int n_nargs;
47249
47250 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47251 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47252 mem_base = xmlMemBlocks();
47253 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47254 nargs = gen_int(n_nargs, 1);
47255
47256 xmlXPathTranslateFunction(ctxt, nargs);
47257 call_tests++;
47258 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47259 des_int(n_nargs, nargs, 1);
47260 xmlResetLastError();
47261 if (mem_base != xmlMemBlocks()) {
47262 printf("Leak of %d blocks found in xmlXPathTranslateFunction",
47263 xmlMemBlocks() - mem_base);
47264 test_ret++;
47265 printf(" %d", n_ctxt);
47266 printf(" %d", n_nargs);
47267 printf("\n");
47268 }
47269 }
47270 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047271 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047272#endif
47273
Daniel Veillarda82b1822004-11-08 16:24:57 +000047274 return(test_ret);
47275}
47276
47277
47278static int
47279test_xmlXPathTrueFunction(void) {
47280 int test_ret = 0;
47281
William M. Brack21e4ef22005-01-02 09:53:13 +000047282#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047283 int mem_base;
47284 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47285 int n_ctxt;
47286 int nargs; /* the number of arguments */
47287 int n_nargs;
47288
47289 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47290 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
47291 mem_base = xmlMemBlocks();
47292 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47293 nargs = gen_int(n_nargs, 1);
47294
47295 xmlXPathTrueFunction(ctxt, nargs);
47296 call_tests++;
47297 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47298 des_int(n_nargs, nargs, 1);
47299 xmlResetLastError();
47300 if (mem_base != xmlMemBlocks()) {
47301 printf("Leak of %d blocks found in xmlXPathTrueFunction",
47302 xmlMemBlocks() - mem_base);
47303 test_ret++;
47304 printf(" %d", n_ctxt);
47305 printf(" %d", n_nargs);
47306 printf("\n");
47307 }
47308 }
47309 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047310 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047311#endif
47312
Daniel Veillarda82b1822004-11-08 16:24:57 +000047313 return(test_ret);
47314}
47315
47316
47317static int
47318test_xmlXPathValueFlipSign(void) {
47319 int test_ret = 0;
47320
William M. Brack21e4ef22005-01-02 09:53:13 +000047321#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047322 int mem_base;
47323 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47324 int n_ctxt;
47325
47326 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47327 mem_base = xmlMemBlocks();
47328 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47329
47330 xmlXPathValueFlipSign(ctxt);
47331 call_tests++;
47332 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47333 xmlResetLastError();
47334 if (mem_base != xmlMemBlocks()) {
47335 printf("Leak of %d blocks found in xmlXPathValueFlipSign",
47336 xmlMemBlocks() - mem_base);
47337 test_ret++;
47338 printf(" %d", n_ctxt);
47339 printf("\n");
47340 }
47341 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047342 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047343#endif
47344
Daniel Veillarda82b1822004-11-08 16:24:57 +000047345 return(test_ret);
47346}
47347
47348
47349static int
47350test_xmlXPathVariableLookup(void) {
47351 int test_ret = 0;
47352
William M. Brack21e4ef22005-01-02 09:53:13 +000047353#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047354 int mem_base;
47355 xmlXPathObjectPtr ret_val;
47356 xmlXPathContextPtr ctxt; /* the XPath context */
47357 int n_ctxt;
47358 xmlChar * name; /* the variable name */
47359 int n_name;
47360
47361 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47362 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
47363 mem_base = xmlMemBlocks();
47364 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47365 name = gen_const_xmlChar_ptr(n_name, 1);
47366
William M. Brackf13f77f2004-11-12 16:03:48 +000047367 ret_val = xmlXPathVariableLookup(ctxt, (const xmlChar *)name);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047368 desret_xmlXPathObjectPtr(ret_val);
47369 call_tests++;
47370 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000047371 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047372 xmlResetLastError();
47373 if (mem_base != xmlMemBlocks()) {
47374 printf("Leak of %d blocks found in xmlXPathVariableLookup",
47375 xmlMemBlocks() - mem_base);
47376 test_ret++;
47377 printf(" %d", n_ctxt);
47378 printf(" %d", n_name);
47379 printf("\n");
47380 }
47381 }
47382 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047383 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047384#endif
47385
Daniel Veillarda82b1822004-11-08 16:24:57 +000047386 return(test_ret);
47387}
47388
47389
47390static int
47391test_xmlXPathVariableLookupNS(void) {
47392 int test_ret = 0;
47393
William M. Brack21e4ef22005-01-02 09:53:13 +000047394#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047395 int mem_base;
47396 xmlXPathObjectPtr ret_val;
47397 xmlXPathContextPtr ctxt; /* the XPath context */
47398 int n_ctxt;
47399 xmlChar * name; /* the variable name */
47400 int n_name;
47401 xmlChar * ns_uri; /* the variable namespace URI */
47402 int n_ns_uri;
47403
47404 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathContextPtr;n_ctxt++) {
47405 for (n_name = 0;n_name < gen_nb_const_xmlChar_ptr;n_name++) {
47406 for (n_ns_uri = 0;n_ns_uri < gen_nb_const_xmlChar_ptr;n_ns_uri++) {
47407 mem_base = xmlMemBlocks();
47408 ctxt = gen_xmlXPathContextPtr(n_ctxt, 0);
47409 name = gen_const_xmlChar_ptr(n_name, 1);
47410 ns_uri = gen_const_xmlChar_ptr(n_ns_uri, 2);
47411
William M. Brackf13f77f2004-11-12 16:03:48 +000047412 ret_val = xmlXPathVariableLookupNS(ctxt, (const xmlChar *)name, (const xmlChar *)ns_uri);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047413 desret_xmlXPathObjectPtr(ret_val);
47414 call_tests++;
47415 des_xmlXPathContextPtr(n_ctxt, ctxt, 0);
William M. Brackf13f77f2004-11-12 16:03:48 +000047416 des_const_xmlChar_ptr(n_name, (const xmlChar *)name, 1);
47417 des_const_xmlChar_ptr(n_ns_uri, (const xmlChar *)ns_uri, 2);
Daniel Veillarda82b1822004-11-08 16:24:57 +000047418 xmlResetLastError();
47419 if (mem_base != xmlMemBlocks()) {
47420 printf("Leak of %d blocks found in xmlXPathVariableLookupNS",
47421 xmlMemBlocks() - mem_base);
47422 test_ret++;
47423 printf(" %d", n_ctxt);
47424 printf(" %d", n_name);
47425 printf(" %d", n_ns_uri);
47426 printf("\n");
47427 }
47428 }
47429 }
47430 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047431 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047432#endif
47433
Daniel Veillarda82b1822004-11-08 16:24:57 +000047434 return(test_ret);
47435}
47436
47437
47438static int
47439test_xmlXPathWrapCString(void) {
47440 int test_ret = 0;
47441
William M. Brack21e4ef22005-01-02 09:53:13 +000047442#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047443 int mem_base;
47444 xmlXPathObjectPtr ret_val;
47445 char * val; /* the char * value */
47446 int n_val;
47447
47448 for (n_val = 0;n_val < gen_nb_char_ptr;n_val++) {
47449 mem_base = xmlMemBlocks();
47450 val = gen_char_ptr(n_val, 0);
47451
47452 ret_val = xmlXPathWrapCString(val);
47453 desret_xmlXPathObjectPtr(ret_val);
47454 call_tests++;
47455 des_char_ptr(n_val, val, 0);
47456 xmlResetLastError();
47457 if (mem_base != xmlMemBlocks()) {
47458 printf("Leak of %d blocks found in xmlXPathWrapCString",
47459 xmlMemBlocks() - mem_base);
47460 test_ret++;
47461 printf(" %d", n_val);
47462 printf("\n");
47463 }
47464 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047465 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047466#endif
47467
Daniel Veillarda82b1822004-11-08 16:24:57 +000047468 return(test_ret);
47469}
47470
47471
47472static int
47473test_xmlXPathWrapExternal(void) {
47474 int test_ret = 0;
47475
William M. Brack21e4ef22005-01-02 09:53:13 +000047476#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047477 int mem_base;
47478 xmlXPathObjectPtr ret_val;
47479 void * val; /* the user data */
47480 int n_val;
47481
47482 for (n_val = 0;n_val < gen_nb_void_ptr;n_val++) {
47483 mem_base = xmlMemBlocks();
47484 val = gen_void_ptr(n_val, 0);
47485
47486 ret_val = xmlXPathWrapExternal(val);
47487 desret_xmlXPathObjectPtr(ret_val);
47488 call_tests++;
47489 des_void_ptr(n_val, val, 0);
47490 xmlResetLastError();
47491 if (mem_base != xmlMemBlocks()) {
47492 printf("Leak of %d blocks found in xmlXPathWrapExternal",
47493 xmlMemBlocks() - mem_base);
47494 test_ret++;
47495 printf(" %d", n_val);
47496 printf("\n");
47497 }
47498 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047499 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047500#endif
47501
Daniel Veillarda82b1822004-11-08 16:24:57 +000047502 return(test_ret);
47503}
47504
47505
47506static int
47507test_xmlXPathWrapNodeSet(void) {
47508 int test_ret = 0;
47509
William M. Brack21e4ef22005-01-02 09:53:13 +000047510#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047511 int mem_base;
47512 xmlXPathObjectPtr ret_val;
47513 xmlNodeSetPtr val; /* the NodePtr value */
47514 int n_val;
47515
47516 for (n_val = 0;n_val < gen_nb_xmlNodeSetPtr;n_val++) {
47517 mem_base = xmlMemBlocks();
47518 val = gen_xmlNodeSetPtr(n_val, 0);
47519
47520 ret_val = xmlXPathWrapNodeSet(val);
47521 desret_xmlXPathObjectPtr(ret_val);
47522 call_tests++;
47523 des_xmlNodeSetPtr(n_val, val, 0);
47524 xmlResetLastError();
47525 if (mem_base != xmlMemBlocks()) {
47526 printf("Leak of %d blocks found in xmlXPathWrapNodeSet",
47527 xmlMemBlocks() - mem_base);
47528 test_ret++;
47529 printf(" %d", n_val);
47530 printf("\n");
47531 }
47532 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047533 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047534#endif
47535
Daniel Veillarda82b1822004-11-08 16:24:57 +000047536 return(test_ret);
47537}
47538
47539
47540static int
47541test_xmlXPatherror(void) {
47542 int test_ret = 0;
47543
William M. Brack21e4ef22005-01-02 09:53:13 +000047544#if defined(LIBXML_XPATH_ENABLED)
Daniel Veillarda82b1822004-11-08 16:24:57 +000047545 int mem_base;
47546 xmlXPathParserContextPtr ctxt; /* the XPath Parser context */
47547 int n_ctxt;
47548 const char * file; /* the file name */
47549 int n_file;
47550 int line; /* the line number */
47551 int n_line;
47552 int no; /* the error number */
47553 int n_no;
47554
47555 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47556 for (n_file = 0;n_file < gen_nb_filepath;n_file++) {
47557 for (n_line = 0;n_line < gen_nb_int;n_line++) {
47558 for (n_no = 0;n_no < gen_nb_int;n_no++) {
47559 mem_base = xmlMemBlocks();
47560 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47561 file = gen_filepath(n_file, 1);
47562 line = gen_int(n_line, 2);
47563 no = gen_int(n_no, 3);
47564
47565 xmlXPatherror(ctxt, file, line, no);
47566 call_tests++;
47567 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47568 des_filepath(n_file, file, 1);
47569 des_int(n_line, line, 2);
47570 des_int(n_no, no, 3);
47571 xmlResetLastError();
47572 if (mem_base != xmlMemBlocks()) {
47573 printf("Leak of %d blocks found in xmlXPatherror",
47574 xmlMemBlocks() - mem_base);
47575 test_ret++;
47576 printf(" %d", n_ctxt);
47577 printf(" %d", n_file);
47578 printf(" %d", n_line);
47579 printf(" %d", n_no);
47580 printf("\n");
47581 }
47582 }
47583 }
47584 }
47585 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047586 function_tests++;
Daniel Veillarda82b1822004-11-08 16:24:57 +000047587#endif
47588
Daniel Veillarda82b1822004-11-08 16:24:57 +000047589 return(test_ret);
47590}
47591
47592static int
47593test_xpathInternals(void) {
47594 int test_ret = 0;
47595
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047596 if (quiet == 0) printf("Testing xpathInternals : 106 of 117 functions ...\n");
Daniel Veillarda82b1822004-11-08 16:24:57 +000047597 test_ret += test_valuePop();
47598 test_ret += test_valuePush();
47599 test_ret += test_xmlXPathAddValues();
47600 test_ret += test_xmlXPathBooleanFunction();
47601 test_ret += test_xmlXPathCeilingFunction();
47602 test_ret += test_xmlXPathCompareValues();
47603 test_ret += test_xmlXPathConcatFunction();
47604 test_ret += test_xmlXPathContainsFunction();
47605 test_ret += test_xmlXPathCountFunction();
47606 test_ret += test_xmlXPathDebugDumpCompExpr();
47607 test_ret += test_xmlXPathDebugDumpObject();
47608 test_ret += test_xmlXPathDifference();
47609 test_ret += test_xmlXPathDistinct();
47610 test_ret += test_xmlXPathDistinctSorted();
47611 test_ret += test_xmlXPathDivValues();
47612 test_ret += test_xmlXPathEqualValues();
47613 test_ret += test_xmlXPathErr();
47614 test_ret += test_xmlXPathEvalExpr();
47615 test_ret += test_xmlXPathEvaluatePredicateResult();
47616 test_ret += test_xmlXPathFalseFunction();
47617 test_ret += test_xmlXPathFloorFunction();
47618 test_ret += test_xmlXPathFunctionLookup();
47619 test_ret += test_xmlXPathFunctionLookupNS();
47620 test_ret += test_xmlXPathHasSameNodes();
47621 test_ret += test_xmlXPathIdFunction();
47622 test_ret += test_xmlXPathIntersection();
47623 test_ret += test_xmlXPathIsNodeType();
47624 test_ret += test_xmlXPathLangFunction();
47625 test_ret += test_xmlXPathLastFunction();
47626 test_ret += test_xmlXPathLeading();
47627 test_ret += test_xmlXPathLeadingSorted();
47628 test_ret += test_xmlXPathLocalNameFunction();
47629 test_ret += test_xmlXPathModValues();
47630 test_ret += test_xmlXPathMultValues();
47631 test_ret += test_xmlXPathNamespaceURIFunction();
47632 test_ret += test_xmlXPathNewBoolean();
47633 test_ret += test_xmlXPathNewCString();
47634 test_ret += test_xmlXPathNewFloat();
47635 test_ret += test_xmlXPathNewNodeSet();
47636 test_ret += test_xmlXPathNewNodeSetList();
47637 test_ret += test_xmlXPathNewParserContext();
47638 test_ret += test_xmlXPathNewString();
47639 test_ret += test_xmlXPathNextAncestor();
47640 test_ret += test_xmlXPathNextAncestorOrSelf();
47641 test_ret += test_xmlXPathNextAttribute();
47642 test_ret += test_xmlXPathNextChild();
47643 test_ret += test_xmlXPathNextDescendant();
47644 test_ret += test_xmlXPathNextDescendantOrSelf();
47645 test_ret += test_xmlXPathNextFollowing();
47646 test_ret += test_xmlXPathNextFollowingSibling();
47647 test_ret += test_xmlXPathNextNamespace();
47648 test_ret += test_xmlXPathNextParent();
47649 test_ret += test_xmlXPathNextPreceding();
47650 test_ret += test_xmlXPathNextPrecedingSibling();
47651 test_ret += test_xmlXPathNextSelf();
47652 test_ret += test_xmlXPathNodeLeading();
47653 test_ret += test_xmlXPathNodeLeadingSorted();
47654 test_ret += test_xmlXPathNodeSetAdd();
47655 test_ret += test_xmlXPathNodeSetAddNs();
47656 test_ret += test_xmlXPathNodeSetAddUnique();
47657 test_ret += test_xmlXPathNodeSetContains();
47658 test_ret += test_xmlXPathNodeSetDel();
47659 test_ret += test_xmlXPathNodeSetMerge();
47660 test_ret += test_xmlXPathNodeSetRemove();
47661 test_ret += test_xmlXPathNodeSetSort();
47662 test_ret += test_xmlXPathNodeTrailing();
47663 test_ret += test_xmlXPathNodeTrailingSorted();
47664 test_ret += test_xmlXPathNormalizeFunction();
47665 test_ret += test_xmlXPathNotEqualValues();
47666 test_ret += test_xmlXPathNotFunction();
47667 test_ret += test_xmlXPathNsLookup();
47668 test_ret += test_xmlXPathNumberFunction();
47669 test_ret += test_xmlXPathParseNCName();
47670 test_ret += test_xmlXPathParseName();
47671 test_ret += test_xmlXPathPopBoolean();
47672 test_ret += test_xmlXPathPopExternal();
47673 test_ret += test_xmlXPathPopNodeSet();
47674 test_ret += test_xmlXPathPopNumber();
47675 test_ret += test_xmlXPathPopString();
47676 test_ret += test_xmlXPathPositionFunction();
47677 test_ret += test_xmlXPathRegisterAllFunctions();
47678 test_ret += test_xmlXPathRegisterFunc();
47679 test_ret += test_xmlXPathRegisterFuncLookup();
47680 test_ret += test_xmlXPathRegisterFuncNS();
47681 test_ret += test_xmlXPathRegisterNs();
47682 test_ret += test_xmlXPathRegisterVariable();
47683 test_ret += test_xmlXPathRegisterVariableLookup();
47684 test_ret += test_xmlXPathRegisterVariableNS();
47685 test_ret += test_xmlXPathRegisteredFuncsCleanup();
47686 test_ret += test_xmlXPathRegisteredNsCleanup();
47687 test_ret += test_xmlXPathRegisteredVariablesCleanup();
47688 test_ret += test_xmlXPathRoot();
47689 test_ret += test_xmlXPathRoundFunction();
47690 test_ret += test_xmlXPathStartsWithFunction();
47691 test_ret += test_xmlXPathStringEvalNumber();
47692 test_ret += test_xmlXPathStringFunction();
47693 test_ret += test_xmlXPathStringLengthFunction();
47694 test_ret += test_xmlXPathSubValues();
47695 test_ret += test_xmlXPathSubstringAfterFunction();
47696 test_ret += test_xmlXPathSubstringBeforeFunction();
47697 test_ret += test_xmlXPathSubstringFunction();
47698 test_ret += test_xmlXPathSumFunction();
47699 test_ret += test_xmlXPathTrailing();
47700 test_ret += test_xmlXPathTrailingSorted();
47701 test_ret += test_xmlXPathTranslateFunction();
47702 test_ret += test_xmlXPathTrueFunction();
47703 test_ret += test_xmlXPathValueFlipSign();
47704 test_ret += test_xmlXPathVariableLookup();
47705 test_ret += test_xmlXPathVariableLookupNS();
47706 test_ret += test_xmlXPathWrapCString();
47707 test_ret += test_xmlXPathWrapExternal();
47708 test_ret += test_xmlXPathWrapNodeSet();
47709 test_ret += test_xmlXPatherror();
47710
47711 if (test_ret != 0)
47712 printf("Module xpathInternals: %d errors\n", test_ret);
47713 return(test_ret);
47714}
47715
Daniel Veillardd93f6252004-11-02 15:53:51 +000047716static int
47717test_xmlXPtrBuildNodeList(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047718 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047719
William M. Brack21e4ef22005-01-02 09:53:13 +000047720#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardd005b9e2004-11-03 17:07:05 +000047721 int mem_base;
47722 xmlNodePtr ret_val;
47723 xmlXPathObjectPtr obj; /* the XPointer result from the evaluation. */
47724 int n_obj;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047725
Daniel Veillardd005b9e2004-11-03 17:07:05 +000047726 for (n_obj = 0;n_obj < gen_nb_xmlXPathObjectPtr;n_obj++) {
47727 mem_base = xmlMemBlocks();
Daniel Veillard3d97e662004-11-04 10:49:00 +000047728 obj = gen_xmlXPathObjectPtr(n_obj, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000047729
47730 ret_val = xmlXPtrBuildNodeList(obj);
47731 desret_xmlNodePtr(ret_val);
47732 call_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000047733 des_xmlXPathObjectPtr(n_obj, obj, 0);
Daniel Veillardd005b9e2004-11-03 17:07:05 +000047734 xmlResetLastError();
47735 if (mem_base != xmlMemBlocks()) {
47736 printf("Leak of %d blocks found in xmlXPtrBuildNodeList",
47737 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000047738 test_ret++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000047739 printf(" %d", n_obj);
47740 printf("\n");
47741 }
47742 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047743 function_tests++;
Daniel Veillardd005b9e2004-11-03 17:07:05 +000047744#endif
47745
Daniel Veillard42595322004-11-08 10:52:06 +000047746 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047747}
47748
47749
47750static int
47751test_xmlXPtrEval(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047752 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047753
William M. Brack21e4ef22005-01-02 09:53:13 +000047754#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000047755 int mem_base;
47756 xmlXPathObjectPtr ret_val;
47757 xmlChar * str; /* the XPointer expression */
47758 int n_str;
47759 xmlXPathContextPtr ctx; /* the XPointer context */
47760 int n_ctx;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047761
Daniel Veillardce682bc2004-11-05 17:22:25 +000047762 for (n_str = 0;n_str < gen_nb_const_xmlChar_ptr;n_str++) {
47763 for (n_ctx = 0;n_ctx < gen_nb_xmlXPathContextPtr;n_ctx++) {
47764 mem_base = xmlMemBlocks();
47765 str = gen_const_xmlChar_ptr(n_str, 0);
47766 ctx = gen_xmlXPathContextPtr(n_ctx, 1);
47767
William M. Brackf13f77f2004-11-12 16:03:48 +000047768 ret_val = xmlXPtrEval((const xmlChar *)str, ctx);
Daniel Veillardce682bc2004-11-05 17:22:25 +000047769 desret_xmlXPathObjectPtr(ret_val);
47770 call_tests++;
William M. Brackf13f77f2004-11-12 16:03:48 +000047771 des_const_xmlChar_ptr(n_str, (const xmlChar *)str, 0);
Daniel Veillardce682bc2004-11-05 17:22:25 +000047772 des_xmlXPathContextPtr(n_ctx, ctx, 1);
47773 xmlResetLastError();
47774 if (mem_base != xmlMemBlocks()) {
47775 printf("Leak of %d blocks found in xmlXPtrEval",
47776 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000047777 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000047778 printf(" %d", n_str);
47779 printf(" %d", n_ctx);
47780 printf("\n");
47781 }
47782 }
47783 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047784 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000047785#endif
47786
Daniel Veillard42595322004-11-08 10:52:06 +000047787 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047788}
47789
47790
47791static int
47792test_xmlXPtrEvalRangePredicate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047793 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047794
William M. Brack21e4ef22005-01-02 09:53:13 +000047795#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000047796 int mem_base;
47797 xmlXPathParserContextPtr ctxt; /* the XPointer Parser context */
47798 int n_ctxt;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047799
Daniel Veillardce682bc2004-11-05 17:22:25 +000047800 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
47801 mem_base = xmlMemBlocks();
47802 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
47803
47804 xmlXPtrEvalRangePredicate(ctxt);
47805 call_tests++;
47806 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
47807 xmlResetLastError();
47808 if (mem_base != xmlMemBlocks()) {
47809 printf("Leak of %d blocks found in xmlXPtrEvalRangePredicate",
47810 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000047811 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000047812 printf(" %d", n_ctxt);
47813 printf("\n");
47814 }
47815 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047816 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000047817#endif
47818
Daniel Veillard42595322004-11-08 10:52:06 +000047819 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047820}
47821
Daniel Veillarda521d282004-11-09 14:59:59 +000047822#ifdef LIBXML_XPTR_ENABLED
Daniel Veillardd93f6252004-11-02 15:53:51 +000047823
Daniel Veillardce682bc2004-11-05 17:22:25 +000047824#define gen_nb_xmlLocationSetPtr 1
47825static xmlLocationSetPtr gen_xmlLocationSetPtr(int no ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
47826 return(NULL);
47827}
47828static void des_xmlLocationSetPtr(int no ATTRIBUTE_UNUSED, xmlLocationSetPtr val ATTRIBUTE_UNUSED, int nr ATTRIBUTE_UNUSED) {
47829}
Daniel Veillarda521d282004-11-09 14:59:59 +000047830#endif
47831
Daniel Veillardce682bc2004-11-05 17:22:25 +000047832
Daniel Veillardd93f6252004-11-02 15:53:51 +000047833static int
47834test_xmlXPtrLocationSetAdd(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047835 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047836
William M. Brack21e4ef22005-01-02 09:53:13 +000047837#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000047838 int mem_base;
47839 xmlLocationSetPtr cur; /* the initial range set */
47840 int n_cur;
47841 xmlXPathObjectPtr val; /* a new xmlXPathObjectPtr */
47842 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047843
Daniel Veillardce682bc2004-11-05 17:22:25 +000047844 for (n_cur = 0;n_cur < gen_nb_xmlLocationSetPtr;n_cur++) {
47845 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
47846 mem_base = xmlMemBlocks();
47847 cur = gen_xmlLocationSetPtr(n_cur, 0);
47848 val = gen_xmlXPathObjectPtr(n_val, 1);
47849
47850 xmlXPtrLocationSetAdd(cur, val);
47851 call_tests++;
47852 des_xmlLocationSetPtr(n_cur, cur, 0);
47853 des_xmlXPathObjectPtr(n_val, val, 1);
47854 xmlResetLastError();
47855 if (mem_base != xmlMemBlocks()) {
47856 printf("Leak of %d blocks found in xmlXPtrLocationSetAdd",
47857 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000047858 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000047859 printf(" %d", n_cur);
47860 printf(" %d", n_val);
47861 printf("\n");
47862 }
47863 }
47864 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047865 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000047866#endif
47867
Daniel Veillard42595322004-11-08 10:52:06 +000047868 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047869}
47870
47871
47872static int
47873test_xmlXPtrLocationSetCreate(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047874 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047875
47876
47877 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000047878 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047879}
47880
47881
47882static int
47883test_xmlXPtrLocationSetDel(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047884 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047885
William M. Brack21e4ef22005-01-02 09:53:13 +000047886#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000047887 int mem_base;
47888 xmlLocationSetPtr cur; /* the initial range set */
47889 int n_cur;
47890 xmlXPathObjectPtr val; /* an xmlXPathObjectPtr */
47891 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047892
Daniel Veillardce682bc2004-11-05 17:22:25 +000047893 for (n_cur = 0;n_cur < gen_nb_xmlLocationSetPtr;n_cur++) {
47894 for (n_val = 0;n_val < gen_nb_xmlXPathObjectPtr;n_val++) {
47895 mem_base = xmlMemBlocks();
47896 cur = gen_xmlLocationSetPtr(n_cur, 0);
47897 val = gen_xmlXPathObjectPtr(n_val, 1);
47898
47899 xmlXPtrLocationSetDel(cur, val);
47900 call_tests++;
47901 des_xmlLocationSetPtr(n_cur, cur, 0);
47902 des_xmlXPathObjectPtr(n_val, val, 1);
47903 xmlResetLastError();
47904 if (mem_base != xmlMemBlocks()) {
47905 printf("Leak of %d blocks found in xmlXPtrLocationSetDel",
47906 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000047907 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000047908 printf(" %d", n_cur);
47909 printf(" %d", n_val);
47910 printf("\n");
47911 }
47912 }
47913 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047914 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000047915#endif
47916
Daniel Veillard42595322004-11-08 10:52:06 +000047917 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047918}
47919
47920
47921static int
47922test_xmlXPtrLocationSetMerge(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047923 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047924
47925
47926 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000047927 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047928}
47929
47930
47931static int
47932test_xmlXPtrLocationSetRemove(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047933 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047934
William M. Brack21e4ef22005-01-02 09:53:13 +000047935#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000047936 int mem_base;
47937 xmlLocationSetPtr cur; /* the initial range set */
47938 int n_cur;
47939 int val; /* the index to remove */
47940 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047941
Daniel Veillardce682bc2004-11-05 17:22:25 +000047942 for (n_cur = 0;n_cur < gen_nb_xmlLocationSetPtr;n_cur++) {
47943 for (n_val = 0;n_val < gen_nb_int;n_val++) {
47944 mem_base = xmlMemBlocks();
47945 cur = gen_xmlLocationSetPtr(n_cur, 0);
47946 val = gen_int(n_val, 1);
47947
47948 xmlXPtrLocationSetRemove(cur, val);
47949 call_tests++;
47950 des_xmlLocationSetPtr(n_cur, cur, 0);
47951 des_int(n_val, val, 1);
47952 xmlResetLastError();
47953 if (mem_base != xmlMemBlocks()) {
47954 printf("Leak of %d blocks found in xmlXPtrLocationSetRemove",
47955 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000047956 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000047957 printf(" %d", n_cur);
47958 printf(" %d", n_val);
47959 printf("\n");
47960 }
47961 }
47962 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047963 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000047964#endif
47965
Daniel Veillard42595322004-11-08 10:52:06 +000047966 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000047967}
47968
47969
47970static int
47971test_xmlXPtrNewCollapsedRange(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000047972 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047973
William M. Brack21e4ef22005-01-02 09:53:13 +000047974#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000047975 int mem_base;
47976 xmlXPathObjectPtr ret_val;
47977 xmlNodePtr start; /* the starting and ending node */
47978 int n_start;
Daniel Veillardd93f6252004-11-02 15:53:51 +000047979
Daniel Veillard3d97e662004-11-04 10:49:00 +000047980 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
47981 mem_base = xmlMemBlocks();
47982 start = gen_xmlNodePtr(n_start, 0);
47983
47984 ret_val = xmlXPtrNewCollapsedRange(start);
47985 desret_xmlXPathObjectPtr(ret_val);
47986 call_tests++;
47987 des_xmlNodePtr(n_start, start, 0);
47988 xmlResetLastError();
47989 if (mem_base != xmlMemBlocks()) {
47990 printf("Leak of %d blocks found in xmlXPtrNewCollapsedRange",
47991 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000047992 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000047993 printf(" %d", n_start);
47994 printf("\n");
47995 }
47996 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000047997 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000047998#endif
47999
Daniel Veillard42595322004-11-08 10:52:06 +000048000 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048001}
48002
48003
48004static int
48005test_xmlXPtrNewContext(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048006 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048007
48008
48009 /* missing type support */
Daniel Veillard42595322004-11-08 10:52:06 +000048010 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048011}
48012
48013
48014static int
48015test_xmlXPtrNewLocationSetNodeSet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048016 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048017
William M. Brack21e4ef22005-01-02 09:53:13 +000048018#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000048019 int mem_base;
48020 xmlXPathObjectPtr ret_val;
48021 xmlNodeSetPtr set; /* a node set */
48022 int n_set;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048023
Daniel Veillardce682bc2004-11-05 17:22:25 +000048024 for (n_set = 0;n_set < gen_nb_xmlNodeSetPtr;n_set++) {
48025 mem_base = xmlMemBlocks();
48026 set = gen_xmlNodeSetPtr(n_set, 0);
48027
48028 ret_val = xmlXPtrNewLocationSetNodeSet(set);
48029 desret_xmlXPathObjectPtr(ret_val);
48030 call_tests++;
48031 des_xmlNodeSetPtr(n_set, set, 0);
48032 xmlResetLastError();
48033 if (mem_base != xmlMemBlocks()) {
48034 printf("Leak of %d blocks found in xmlXPtrNewLocationSetNodeSet",
48035 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048036 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048037 printf(" %d", n_set);
48038 printf("\n");
48039 }
48040 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048041 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048042#endif
48043
Daniel Veillard42595322004-11-08 10:52:06 +000048044 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048045}
48046
48047
48048static int
48049test_xmlXPtrNewLocationSetNodes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048050 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048051
William M. Brack21e4ef22005-01-02 09:53:13 +000048052#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000048053 int mem_base;
48054 xmlXPathObjectPtr ret_val;
48055 xmlNodePtr start; /* the start NodePtr value */
48056 int n_start;
48057 xmlNodePtr end; /* the end NodePtr value or NULL */
48058 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048059
Daniel Veillard3d97e662004-11-04 10:49:00 +000048060 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48061 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
48062 mem_base = xmlMemBlocks();
48063 start = gen_xmlNodePtr(n_start, 0);
48064 end = gen_xmlNodePtr(n_end, 1);
48065
48066 ret_val = xmlXPtrNewLocationSetNodes(start, end);
48067 desret_xmlXPathObjectPtr(ret_val);
48068 call_tests++;
48069 des_xmlNodePtr(n_start, start, 0);
48070 des_xmlNodePtr(n_end, end, 1);
48071 xmlResetLastError();
48072 if (mem_base != xmlMemBlocks()) {
48073 printf("Leak of %d blocks found in xmlXPtrNewLocationSetNodes",
48074 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048075 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048076 printf(" %d", n_start);
48077 printf(" %d", n_end);
48078 printf("\n");
48079 }
48080 }
48081 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048082 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048083#endif
48084
Daniel Veillard42595322004-11-08 10:52:06 +000048085 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048086}
48087
48088
48089static int
48090test_xmlXPtrNewRange(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048091 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048092
William M. Brack21e4ef22005-01-02 09:53:13 +000048093#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000048094 int mem_base;
48095 xmlXPathObjectPtr ret_val;
48096 xmlNodePtr start; /* the starting node */
48097 int n_start;
48098 int startindex; /* the start index */
48099 int n_startindex;
48100 xmlNodePtr end; /* the ending point */
48101 int n_end;
48102 int endindex; /* the ending index */
48103 int n_endindex;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048104
Daniel Veillard3d97e662004-11-04 10:49:00 +000048105 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48106 for (n_startindex = 0;n_startindex < gen_nb_int;n_startindex++) {
48107 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
48108 for (n_endindex = 0;n_endindex < gen_nb_int;n_endindex++) {
48109 mem_base = xmlMemBlocks();
48110 start = gen_xmlNodePtr(n_start, 0);
48111 startindex = gen_int(n_startindex, 1);
48112 end = gen_xmlNodePtr(n_end, 2);
48113 endindex = gen_int(n_endindex, 3);
48114
48115 ret_val = xmlXPtrNewRange(start, startindex, end, endindex);
48116 desret_xmlXPathObjectPtr(ret_val);
48117 call_tests++;
48118 des_xmlNodePtr(n_start, start, 0);
48119 des_int(n_startindex, startindex, 1);
48120 des_xmlNodePtr(n_end, end, 2);
48121 des_int(n_endindex, endindex, 3);
48122 xmlResetLastError();
48123 if (mem_base != xmlMemBlocks()) {
48124 printf("Leak of %d blocks found in xmlXPtrNewRange",
48125 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048126 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048127 printf(" %d", n_start);
48128 printf(" %d", n_startindex);
48129 printf(" %d", n_end);
48130 printf(" %d", n_endindex);
48131 printf("\n");
48132 }
48133 }
48134 }
48135 }
48136 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048137 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048138#endif
48139
Daniel Veillard42595322004-11-08 10:52:06 +000048140 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048141}
48142
48143
48144static int
48145test_xmlXPtrNewRangeNodeObject(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048146 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048147
William M. Brack21e4ef22005-01-02 09:53:13 +000048148#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000048149 int mem_base;
48150 xmlXPathObjectPtr ret_val;
48151 xmlNodePtr start; /* the starting node */
48152 int n_start;
48153 xmlXPathObjectPtr end; /* the ending object */
48154 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048155
Daniel Veillard3d97e662004-11-04 10:49:00 +000048156 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48157 for (n_end = 0;n_end < gen_nb_xmlXPathObjectPtr;n_end++) {
48158 mem_base = xmlMemBlocks();
48159 start = gen_xmlNodePtr(n_start, 0);
48160 end = gen_xmlXPathObjectPtr(n_end, 1);
48161
48162 ret_val = xmlXPtrNewRangeNodeObject(start, end);
48163 desret_xmlXPathObjectPtr(ret_val);
48164 call_tests++;
48165 des_xmlNodePtr(n_start, start, 0);
48166 des_xmlXPathObjectPtr(n_end, end, 1);
48167 xmlResetLastError();
48168 if (mem_base != xmlMemBlocks()) {
48169 printf("Leak of %d blocks found in xmlXPtrNewRangeNodeObject",
48170 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048171 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048172 printf(" %d", n_start);
48173 printf(" %d", n_end);
48174 printf("\n");
48175 }
48176 }
48177 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048178 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048179#endif
48180
Daniel Veillard42595322004-11-08 10:52:06 +000048181 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048182}
48183
48184
48185static int
48186test_xmlXPtrNewRangeNodePoint(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048187 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048188
William M. Brack21e4ef22005-01-02 09:53:13 +000048189#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000048190 int mem_base;
48191 xmlXPathObjectPtr ret_val;
48192 xmlNodePtr start; /* the starting node */
48193 int n_start;
48194 xmlXPathObjectPtr end; /* the ending point */
48195 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048196
Daniel Veillard3d97e662004-11-04 10:49:00 +000048197 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48198 for (n_end = 0;n_end < gen_nb_xmlXPathObjectPtr;n_end++) {
48199 mem_base = xmlMemBlocks();
48200 start = gen_xmlNodePtr(n_start, 0);
48201 end = gen_xmlXPathObjectPtr(n_end, 1);
48202
48203 ret_val = xmlXPtrNewRangeNodePoint(start, end);
48204 desret_xmlXPathObjectPtr(ret_val);
48205 call_tests++;
48206 des_xmlNodePtr(n_start, start, 0);
48207 des_xmlXPathObjectPtr(n_end, end, 1);
48208 xmlResetLastError();
48209 if (mem_base != xmlMemBlocks()) {
48210 printf("Leak of %d blocks found in xmlXPtrNewRangeNodePoint",
48211 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048212 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048213 printf(" %d", n_start);
48214 printf(" %d", n_end);
48215 printf("\n");
48216 }
48217 }
48218 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048219 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048220#endif
48221
Daniel Veillard42595322004-11-08 10:52:06 +000048222 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048223}
48224
48225
48226static int
48227test_xmlXPtrNewRangeNodes(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048228 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048229
William M. Brack21e4ef22005-01-02 09:53:13 +000048230#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000048231 int mem_base;
48232 xmlXPathObjectPtr ret_val;
48233 xmlNodePtr start; /* the starting node */
48234 int n_start;
48235 xmlNodePtr end; /* the ending node */
48236 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048237
Daniel Veillard3d97e662004-11-04 10:49:00 +000048238 for (n_start = 0;n_start < gen_nb_xmlNodePtr;n_start++) {
48239 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
48240 mem_base = xmlMemBlocks();
48241 start = gen_xmlNodePtr(n_start, 0);
48242 end = gen_xmlNodePtr(n_end, 1);
48243
48244 ret_val = xmlXPtrNewRangeNodes(start, end);
48245 desret_xmlXPathObjectPtr(ret_val);
48246 call_tests++;
48247 des_xmlNodePtr(n_start, start, 0);
48248 des_xmlNodePtr(n_end, end, 1);
48249 xmlResetLastError();
48250 if (mem_base != xmlMemBlocks()) {
48251 printf("Leak of %d blocks found in xmlXPtrNewRangeNodes",
48252 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048253 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048254 printf(" %d", n_start);
48255 printf(" %d", n_end);
48256 printf("\n");
48257 }
48258 }
48259 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048260 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048261#endif
48262
Daniel Veillard42595322004-11-08 10:52:06 +000048263 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048264}
48265
48266
48267static int
48268test_xmlXPtrNewRangePointNode(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048269 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048270
William M. Brack21e4ef22005-01-02 09:53:13 +000048271#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000048272 int mem_base;
48273 xmlXPathObjectPtr ret_val;
48274 xmlXPathObjectPtr start; /* the starting point */
48275 int n_start;
48276 xmlNodePtr end; /* the ending node */
48277 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048278
Daniel Veillard3d97e662004-11-04 10:49:00 +000048279 for (n_start = 0;n_start < gen_nb_xmlXPathObjectPtr;n_start++) {
48280 for (n_end = 0;n_end < gen_nb_xmlNodePtr;n_end++) {
48281 mem_base = xmlMemBlocks();
48282 start = gen_xmlXPathObjectPtr(n_start, 0);
48283 end = gen_xmlNodePtr(n_end, 1);
48284
48285 ret_val = xmlXPtrNewRangePointNode(start, end);
48286 desret_xmlXPathObjectPtr(ret_val);
48287 call_tests++;
48288 des_xmlXPathObjectPtr(n_start, start, 0);
48289 des_xmlNodePtr(n_end, end, 1);
48290 xmlResetLastError();
48291 if (mem_base != xmlMemBlocks()) {
48292 printf("Leak of %d blocks found in xmlXPtrNewRangePointNode",
48293 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048294 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048295 printf(" %d", n_start);
48296 printf(" %d", n_end);
48297 printf("\n");
48298 }
48299 }
48300 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048301 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048302#endif
48303
Daniel Veillard42595322004-11-08 10:52:06 +000048304 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048305}
48306
48307
48308static int
48309test_xmlXPtrNewRangePoints(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048310 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048311
William M. Brack21e4ef22005-01-02 09:53:13 +000048312#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillard3d97e662004-11-04 10:49:00 +000048313 int mem_base;
48314 xmlXPathObjectPtr ret_val;
48315 xmlXPathObjectPtr start; /* the starting point */
48316 int n_start;
48317 xmlXPathObjectPtr end; /* the ending point */
48318 int n_end;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048319
Daniel Veillard3d97e662004-11-04 10:49:00 +000048320 for (n_start = 0;n_start < gen_nb_xmlXPathObjectPtr;n_start++) {
48321 for (n_end = 0;n_end < gen_nb_xmlXPathObjectPtr;n_end++) {
48322 mem_base = xmlMemBlocks();
48323 start = gen_xmlXPathObjectPtr(n_start, 0);
48324 end = gen_xmlXPathObjectPtr(n_end, 1);
48325
48326 ret_val = xmlXPtrNewRangePoints(start, end);
48327 desret_xmlXPathObjectPtr(ret_val);
48328 call_tests++;
48329 des_xmlXPathObjectPtr(n_start, start, 0);
48330 des_xmlXPathObjectPtr(n_end, end, 1);
48331 xmlResetLastError();
48332 if (mem_base != xmlMemBlocks()) {
48333 printf("Leak of %d blocks found in xmlXPtrNewRangePoints",
48334 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048335 test_ret++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048336 printf(" %d", n_start);
48337 printf(" %d", n_end);
48338 printf("\n");
48339 }
48340 }
48341 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048342 function_tests++;
Daniel Veillard3d97e662004-11-04 10:49:00 +000048343#endif
48344
Daniel Veillard42595322004-11-08 10:52:06 +000048345 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048346}
48347
48348
48349static int
48350test_xmlXPtrRangeToFunction(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048351 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048352
William M. Brack21e4ef22005-01-02 09:53:13 +000048353#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000048354 int mem_base;
48355 xmlXPathParserContextPtr ctxt; /* the XPointer Parser context */
48356 int n_ctxt;
48357 int nargs; /* the number of args */
48358 int n_nargs;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048359
Daniel Veillardce682bc2004-11-05 17:22:25 +000048360 for (n_ctxt = 0;n_ctxt < gen_nb_xmlXPathParserContextPtr;n_ctxt++) {
48361 for (n_nargs = 0;n_nargs < gen_nb_int;n_nargs++) {
48362 mem_base = xmlMemBlocks();
48363 ctxt = gen_xmlXPathParserContextPtr(n_ctxt, 0);
48364 nargs = gen_int(n_nargs, 1);
48365
48366 xmlXPtrRangeToFunction(ctxt, nargs);
48367 call_tests++;
48368 des_xmlXPathParserContextPtr(n_ctxt, ctxt, 0);
48369 des_int(n_nargs, nargs, 1);
48370 xmlResetLastError();
48371 if (mem_base != xmlMemBlocks()) {
48372 printf("Leak of %d blocks found in xmlXPtrRangeToFunction",
48373 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048374 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048375 printf(" %d", n_ctxt);
48376 printf(" %d", n_nargs);
48377 printf("\n");
48378 }
48379 }
48380 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048381 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048382#endif
48383
Daniel Veillard42595322004-11-08 10:52:06 +000048384 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048385}
48386
48387
48388static int
48389test_xmlXPtrWrapLocationSet(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048390 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048391
William M. Brack21e4ef22005-01-02 09:53:13 +000048392#if defined(LIBXML_XPTR_ENABLED)
Daniel Veillardce682bc2004-11-05 17:22:25 +000048393 int mem_base;
48394 xmlXPathObjectPtr ret_val;
48395 xmlLocationSetPtr val; /* the LocationSet value */
48396 int n_val;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048397
Daniel Veillardce682bc2004-11-05 17:22:25 +000048398 for (n_val = 0;n_val < gen_nb_xmlLocationSetPtr;n_val++) {
48399 mem_base = xmlMemBlocks();
48400 val = gen_xmlLocationSetPtr(n_val, 0);
48401
48402 ret_val = xmlXPtrWrapLocationSet(val);
48403 desret_xmlXPathObjectPtr(ret_val);
48404 call_tests++;
48405 des_xmlLocationSetPtr(n_val, val, 0);
48406 xmlResetLastError();
48407 if (mem_base != xmlMemBlocks()) {
48408 printf("Leak of %d blocks found in xmlXPtrWrapLocationSet",
48409 xmlMemBlocks() - mem_base);
Daniel Veillard42595322004-11-08 10:52:06 +000048410 test_ret++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048411 printf(" %d", n_val);
48412 printf("\n");
48413 }
48414 }
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048415 function_tests++;
Daniel Veillardce682bc2004-11-05 17:22:25 +000048416#endif
48417
Daniel Veillard42595322004-11-08 10:52:06 +000048418 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048419}
48420
48421static int
48422test_xpointer(void) {
Daniel Veillard42595322004-11-08 10:52:06 +000048423 int test_ret = 0;
Daniel Veillardd93f6252004-11-02 15:53:51 +000048424
Daniel Veillardd0cf7f62004-11-09 16:17:02 +000048425 if (quiet == 0) printf("Testing xpointer : 17 of 21 functions ...\n");
Daniel Veillard42595322004-11-08 10:52:06 +000048426 test_ret += test_xmlXPtrBuildNodeList();
48427 test_ret += test_xmlXPtrEval();
48428 test_ret += test_xmlXPtrEvalRangePredicate();
48429 test_ret += test_xmlXPtrLocationSetAdd();
48430 test_ret += test_xmlXPtrLocationSetCreate();
48431 test_ret += test_xmlXPtrLocationSetDel();
48432 test_ret += test_xmlXPtrLocationSetMerge();
48433 test_ret += test_xmlXPtrLocationSetRemove();
48434 test_ret += test_xmlXPtrNewCollapsedRange();
48435 test_ret += test_xmlXPtrNewContext();
48436 test_ret += test_xmlXPtrNewLocationSetNodeSet();
48437 test_ret += test_xmlXPtrNewLocationSetNodes();
48438 test_ret += test_xmlXPtrNewRange();
48439 test_ret += test_xmlXPtrNewRangeNodeObject();
48440 test_ret += test_xmlXPtrNewRangeNodePoint();
48441 test_ret += test_xmlXPtrNewRangeNodes();
48442 test_ret += test_xmlXPtrNewRangePointNode();
48443 test_ret += test_xmlXPtrNewRangePoints();
48444 test_ret += test_xmlXPtrRangeToFunction();
48445 test_ret += test_xmlXPtrWrapLocationSet();
Daniel Veillardd93f6252004-11-02 15:53:51 +000048446
Daniel Veillard42595322004-11-08 10:52:06 +000048447 if (test_ret != 0)
48448 printf("Module xpointer: %d errors\n", test_ret);
48449 return(test_ret);
Daniel Veillardd93f6252004-11-02 15:53:51 +000048450}
Daniel Veillardce244ad2004-11-05 10:03:46 +000048451static int
48452test_module(const char *module) {
48453 if (!strcmp(module, "HTMLparser")) return(test_HTMLparser());
48454 if (!strcmp(module, "HTMLtree")) return(test_HTMLtree());
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000048455 if (!strcmp(module, "SAX2")) return(test_SAX2());
Daniel Veillarda82b1822004-11-08 16:24:57 +000048456 if (!strcmp(module, "c14n")) return(test_c14n());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048457 if (!strcmp(module, "catalog")) return(test_catalog());
48458 if (!strcmp(module, "chvalid")) return(test_chvalid());
Daniel Veillarda82b1822004-11-08 16:24:57 +000048459 if (!strcmp(module, "debugXML")) return(test_debugXML());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048460 if (!strcmp(module, "dict")) return(test_dict());
48461 if (!strcmp(module, "encoding")) return(test_encoding());
48462 if (!strcmp(module, "entities")) return(test_entities());
48463 if (!strcmp(module, "hash")) return(test_hash());
48464 if (!strcmp(module, "list")) return(test_list());
48465 if (!strcmp(module, "nanoftp")) return(test_nanoftp());
48466 if (!strcmp(module, "nanohttp")) return(test_nanohttp());
48467 if (!strcmp(module, "parser")) return(test_parser());
Daniel Veillard2a4fb5a2004-11-08 14:02:18 +000048468 if (!strcmp(module, "parserInternals")) return(test_parserInternals());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048469 if (!strcmp(module, "pattern")) return(test_pattern());
48470 if (!strcmp(module, "relaxng")) return(test_relaxng());
48471 if (!strcmp(module, "schemasInternals")) return(test_schemasInternals());
48472 if (!strcmp(module, "tree")) return(test_tree());
48473 if (!strcmp(module, "uri")) return(test_uri());
48474 if (!strcmp(module, "valid")) return(test_valid());
48475 if (!strcmp(module, "xinclude")) return(test_xinclude());
48476 if (!strcmp(module, "xmlIO")) return(test_xmlIO());
Daniel Veillarda82b1822004-11-08 16:24:57 +000048477 if (!strcmp(module, "xmlautomata")) return(test_xmlautomata());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048478 if (!strcmp(module, "xmlerror")) return(test_xmlerror());
48479 if (!strcmp(module, "xmlreader")) return(test_xmlreader());
Daniel Veillarda82b1822004-11-08 16:24:57 +000048480 if (!strcmp(module, "xmlregexp")) return(test_xmlregexp());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048481 if (!strcmp(module, "xmlsave")) return(test_xmlsave());
48482 if (!strcmp(module, "xmlschemas")) return(test_xmlschemas());
48483 if (!strcmp(module, "xmlschemastypes")) return(test_xmlschemastypes());
48484 if (!strcmp(module, "xmlstring")) return(test_xmlstring());
Daniel Veillard0ea9c9f2004-11-05 14:30:41 +000048485 if (!strcmp(module, "xmlunicode")) return(test_xmlunicode());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048486 if (!strcmp(module, "xmlwriter")) return(test_xmlwriter());
48487 if (!strcmp(module, "xpath")) return(test_xpath());
Daniel Veillarda82b1822004-11-08 16:24:57 +000048488 if (!strcmp(module, "xpathInternals")) return(test_xpathInternals());
Daniel Veillardce244ad2004-11-05 10:03:46 +000048489 if (!strcmp(module, "xpointer")) return(test_xpointer());
48490 return(0);
48491}